From 67082df105c414a1505cd89c6a40396bc3a8e6ef Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 24 Aug 2023 12:19:55 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/9033 --- app/src/protyle/util/destroy.ts | 5 +++++ app/src/protyle/util/onGet.ts | 6 ++++++ app/src/types/index.d.ts | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/util/destroy.ts b/app/src/protyle/util/destroy.ts index 15c70377f..75af11a53 100644 --- a/app/src/protyle/util/destroy.ts +++ b/app/src/protyle/util/destroy.ts @@ -17,4 +17,9 @@ export const destroy = (protyle: IProtyle) => { protyle.ws.send("closews", {}); }, 10240); } + protyle.app.plugins.forEach(item => { + item.eventBus.emit("destroy-protyle", { + protyle, + }); + }); }; diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index be48441b8..b8fedc003 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -265,6 +265,12 @@ const setHTML = (options: { } if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE)) { + protyle.app.plugins.forEach(item => { + item.eventBus.emit("loaded-protyle-dynamic", { + protyle, + positon: options.action.includes(Constants.CB_GET_APPEND) ? "afterend" : "beforebegin" + }); + }); return; } if (protyle.options.render.breadcrumb) { diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 25d56b5eb..cefb72b12 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -46,7 +46,8 @@ type TEventBus = "ws-main" | "open-menu-av" | "open-menu-content" | "open-menu-breadcrumbmore" | "open-siyuan-url-plugin" | "open-siyuan-url-block" | "input-search" | - "loaded-protyle" + "loaded-protyle" | "loaded-protyle-dynamic"| + "destroy-protyle" type TAVCol = "text" | "date"