From bc635356dc37fb74e7a34a6ba2912931f27872f7 Mon Sep 17 00:00:00 2001 From: frostime Date: Fri, 27 Oct 2023 21:04:12 +0800 Subject: [PATCH] fix protyle bug --- src/hello.svelte | 2 +- src/index.ts | 41 ++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/hello.svelte b/src/hello.svelte index 6d10108..63a54a2 100644 --- a/src/hello.svelte +++ b/src/hello.svelte @@ -6,7 +6,7 @@ export let app; let time: string = ""; - let ver: string; + let ver: string = ""; let divProtyle: HTMLDivElement; let protyle: any; diff --git a/src/index.ts b/src/index.ts index 353d472..aa7bd75 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,27 +85,6 @@ export default class PluginSample extends Plugin { element: statusIconTemp.content.firstElementChild as HTMLElement, }); - let tabDiv = document.createElement("div"); - new HelloExample({ - target: tabDiv, - props: { - app: this.app, - } - }); - this.customTab = this.addTab({ - type: TAB_TYPE, - init() { - this.element.appendChild(tabDiv); - console.log(this.element); - }, - beforeDestroy() { - console.log("before destroy tab:", TAB_TYPE); - }, - destroy() { - console.log("destroy tab:", TAB_TYPE); - } - }); - this.addCommand({ langKey: "showDialog", hotkey: "⇧⌘O", @@ -244,6 +223,26 @@ export default class PluginSample extends Plugin { // this.loadData(STORAGE_NAME); this.settingUtils.load(); console.log(`frontend: ${getFrontend()}; backend: ${getBackend()}`); + let tabDiv = document.createElement("div"); + new HelloExample({ + target: tabDiv, + props: { + app: this.app, + } + }); + this.customTab = this.addTab({ + type: TAB_TYPE, + init() { + this.element.appendChild(tabDiv); + console.log(this.element); + }, + beforeDestroy() { + console.log("before destroy tab:", TAB_TYPE); + }, + destroy() { + console.log("destroy tab:", TAB_TYPE); + } + }); } async onunload() {