diff --git a/src/index.ts b/src/index.ts index 1899daa..9a47d54 100644 --- a/src/index.ts +++ b/src/index.ts @@ -382,7 +382,7 @@ export default class PluginSample extends Plugin { let dialog = new Dialog({ title: "SettingPannel", content: `
`, - width: "600px", + width: "800px", destroyCallback: (options) => { console.log("destroyCallback", options); //You'd better destroy the component when the dialog is closed diff --git a/src/libs/setting-item.svelte b/src/libs/setting-item.svelte index d59912b..ef1a964 100644 --- a/src/libs/setting-item.svelte +++ b/src/libs/setting-item.svelte @@ -14,11 +14,16 @@ max: number; step: number; } = { min: 0, max: 100, step: 1 }; // Use it if type is slider + export let button: { + label: string; + callback: () => void; + } = { label: settingValue, callback: () => {} }; // Use it if type is button const dispatch = createEventDispatcher(); - function clicked() { - dispatch("clicked"); + function click() { + button?.callback(); + dispatch("click", { key: settingKey }); } function changed() { @@ -66,9 +71,9 @@ {:else if type === "select"} diff --git a/src/libs/setting-panel.svelte b/src/libs/setting-panel.svelte index fc5e508..038d890 100644 --- a/src/libs/setting-panel.svelte +++ b/src/libs/setting-panel.svelte @@ -3,7 +3,7 @@ Author : frostime Date : 2023-07-01 19:23:50 FilePath : /src/libs/setting-panel.svelte - LastEditTime : 2023-11-28 21:45:10 + LastEditTime : 2024-04-27 16:46:49 Description : --> @@ -83,6 +99,7 @@ settingItems={SettingItems} display={focusGroup === groups[0]} on:changed={onChanged} + on:click={({ detail }) => { console.debug("Click:", detail.key); }} >
💡 This is our default settings.