From 796df799315490e3a9d6e045f1c6bc98fb661e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yingyi=20/=20=E9=A2=96=E9=80=B8?= <49649786+Zuoqiu-Yingyi@users.noreply.github.com> Date: Sun, 7 Jan 2024 14:37:17 +0800 Subject: [PATCH] :bug: Fix `name` attribute could not be visited in the plugin constructor (#10071) --- app/src/plugin/index.ts | 6 ++++++ app/src/plugin/loader.ts | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts index 9cf7babac..5dd3d337d 100644 --- a/app/src/plugin/index.ts +++ b/app/src/plugin/index.ts @@ -68,6 +68,12 @@ export class Plugin { this.i18n = options.i18n; this.displayName = options.displayName; this.eventBus = new EventBus(options.name); + + // https://github.com/siyuan-note/siyuan/issues/9943 + Object.defineProperty(this, "name", { + value: options.name, + writable: false, + }); } public onload() { diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts index 4b9104d55..a63b19bef 100644 --- a/app/src/plugin/loader.ts +++ b/app/src/plugin/loader.ts @@ -64,11 +64,6 @@ const loadPluginJS = async (app: App, item: IPluginData) => { name: item.name, i18n: item.i18n }); - // https://github.com/siyuan-note/siyuan/issues/9943 - Object.defineProperty(plugin, "name", { - value: item.name, - writable: false, - }); app.plugins.push(plugin); try { await plugin.onload();