Skip to content

Commit

Permalink
perf: 兼容事件总线 loaded-protyle-static | Compatible with event bus `loa…
Browse files Browse the repository at this point in the history
…ded-protyle-static`.
  • Loading branch information
Zuoqiu-Yingyi committed Oct 24, 2023
1 parent ecc3f62 commit 1144a24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@sveltejs/vite-plugin-svelte": "^2.4.6",
"@tsconfig/svelte": "^5.0.2",
"less": "^4.2.0",
"svelte": "^4.2.1",
"svelte": "^4.2.2",
"svelte-check": "^3.5.2",
"svelte-preprocess-less": "^0.4.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.11"
"vite": "^4.5.0"
},
"dependencies": {
"@workspace/components": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Zuoqiu Yingyi",
"url": "https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter",
"version": "0.1.1",
"minAppVersion": "2.9.5",
"minAppVersion": "2.10.12",
"backends": [
"all"
],
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import constants from "./constants";

import type {
IClickEditorContentEvent,
ILoadedProtyleEvent,
ILoadedProtyleStaticEvent,
IDestroyProtyleEvent,
} from "@workspace/types/siyuan/events";
import type { IProtyle } from "siyuan/types/protyle";
Expand Down Expand Up @@ -237,12 +237,12 @@ export default class TypewriterPlugin extends siyuan.Plugin {
}

if (enable) {
this.eventBus.on("loaded-protyle", this.loadedProtyleEventListener);
this.eventBus.on("loaded-protyle-static", this.loadedProtyleStaticEventListener);
this.eventBus.on("destroy-protyle", this.destroyProtyleEventListener);
this.eventBus.on("click-editorcontent", this.clickEditorContentEventListener);
}
else {
this.eventBus.off("loaded-protyle", this.loadedProtyleEventListener);
this.eventBus.off("loaded-protyle-static", this.loadedProtyleStaticEventListener);
this.eventBus.off("destroy-protyle", this.destroyProtyleEventListener);
this.eventBus.off("click-editorcontent", this.clickEditorContentEventListener);
}
Expand Down Expand Up @@ -299,12 +299,12 @@ export default class TypewriterPlugin extends siyuan.Plugin {
};

/* 编辑器加载事件 */
protected readonly loadedProtyleEventListener = (e: ILoadedProtyleEvent) => {
protected readonly loadedProtyleStaticEventListener = (e: ILoadedProtyleStaticEvent) => {
// this.logger.debug(e);

/* 若开启打字机模式, 添加编辑事件监听器 */
if (this.enable) {
const protyle = e.detail;
const protyle = e.detail.protyle;
this.toggleEventListener(protyle, true);
}
};
Expand Down

0 comments on commit 1144a24

Please # to comment.