From b63cc1839a6c86a0fbd0c87877b121cb9e48fa02 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 21 Oct 2023 21:00:10 +0800 Subject: [PATCH] :alien: fix https://github.com/siyuan-note/siyuan/issues/9468 --- app/src/plugin/EventBus.ts | 3 +++ app/src/protyle/util/onGet.ts | 3 ++- app/src/types/index.d.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/plugin/EventBus.ts b/app/src/plugin/EventBus.ts index 09e2a956c..f470ada02 100644 --- a/app/src/plugin/EventBus.ts +++ b/app/src/plugin/EventBus.ts @@ -8,6 +8,9 @@ export class EventBus { } on(type: TEventBus, listener: (event: CustomEvent) => void) { + if (type ==="loaded-protyle") { + console.warn("0.8.8 将移除 loaded-protyle, 请使用 loaded-protyle-static 进行替代"); + } this.eventTarget.addEventListener(type, listener); } diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 33b90b970..6c85acdad 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -298,7 +298,8 @@ const setHTML = (options: { options.afterCB(); } protyle.app.plugins.forEach(item => { - item.eventBus.emit("loaded-protyle", protyle); + item.eventBus.emit("loaded-protyle", protyle); // 准备废弃 + item.eventBus.emit("loaded-protyle-static", {protyle}); }); }; diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index db6f3cb37..ecaffbd9d 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -51,7 +51,7 @@ type TEventBus = "ws-main" | "open-siyuan-url-plugin" | "open-siyuan-url-block" | "paste" | "input-search" | - "loaded-protyle" | "loaded-protyle-dynamic" | + "loaded-protyle" | "loaded-protyle-dynamic" | "loaded-protyle-static" | "destroy-protyle" type TAVCol = "text"