From b739c5ad54d288b4b088681cc5ef96f4fad2c19c Mon Sep 17 00:00:00 2001 From: frostime Date: Fri, 19 Jul 2024 15:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=90=84=E4=B8=AA=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 33 +++++++++++++++------- src/libs/components/item-input.svelte | 40 +++++++++++++++++---------- src/libs/components/item-wrap.svelte | 8 ++++-- src/libs/dialog.ts | 36 +++++++++++++++++++++++- 4 files changed, 88 insertions(+), 29 deletions(-) diff --git a/src/index.ts b/src/index.ts index 62a09a7..5b50c49 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ import HelloExample from "@/hello.svelte"; import SettingExample from "@/setting-example.svelte"; import { SettingUtils } from "./libs/setting-utils"; +import { svelteDialog } from "./libs/dialog"; const STORAGE_NAME = "menu-config"; const TAB_TYPE = "custom_tab"; @@ -455,18 +456,30 @@ export default class PluginSample extends Plugin { } private showDialog() { - let dialog = new Dialog({ + // let dialog = new Dialog({ + // title: `SiYuan ${Constants.SIYUAN_VERSION}`, + // content: `
`, + // width: this.isMobile ? "92vw" : "720px", + // destroyCallback() { + // // hello.$destroy(); + // }, + // }); + // new HelloExample({ + // target: dialog.element.querySelector("#helloPanel"), + // props: { + // app: this.app, + // } + // }); + svelteDialog({ title: `SiYuan ${Constants.SIYUAN_VERSION}`, - content: `
`, width: this.isMobile ? "92vw" : "720px", - destroyCallback() { - // hello.$destroy(); - }, - }); - new HelloExample({ - target: dialog.element.querySelector("#helloPanel"), - props: { - app: this.app, + constructor: (container: HTMLElement) => { + return new HelloExample({ + target: container, + props: { + app: this.app, + } + }); } }); } diff --git a/src/libs/components/item-input.svelte b/src/libs/components/item-input.svelte index 3a42b45..cbf5a7e 100644 --- a/src/libs/components/item-input.svelte +++ b/src/libs/components/item-input.svelte @@ -1,18 +1,10 @@ -