diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d5ed1..a3d0833 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.0 + +* [Add plugin event bus `open-siyuan-url-plugin` and `open-siyuan-url-block`](https://github.com/siyuan-note/siyuan/pull/8927) + + ## 0.1.12 2023-08-01 * Upgrade siyuan to 0.7.9 diff --git a/README.md b/README.md index 7eba330..4ed21ad 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [中文版](./README_zh_CN.md) -> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.1.10](https://github.com/siyuan-note/plugin-sample/tree/v0.1.10) +> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.1.12](https://github.com/siyuan-note/plugin-sample/tree/v0.1.12) diff --git a/README_zh_CN.md b/README_zh_CN.md index 6c2bf01..e3c15d8 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -4,7 +4,7 @@ [English](./README.md) -> 本例和 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.1.10](https://github.com/siyuan-note/plugin-sample/tree/v0.1.10) +> 本例和 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.1.12](https://github.com/siyuan-note/plugin-sample/tree/v0.1.12) 1. 使用 vite 打包 2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发 diff --git a/src/index.ts b/src/index.ts index ed17f48..53bfdb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -108,7 +108,16 @@ export default class PluginSample extends Plugin { hotkey: "⇧⌘M", callback: () => { this.showDialog(); - } + }, + fileTreeCallback: (file: any) => { + console.log(file, "fileTreeCallback"); + }, + editorCallback: (protyle: any) => { + console.log(protyle, "editorCallback"); + }, + dockCallback: (element: HTMLElement) => { + console.log(element, "dockCallback"); + }, }); this.addDock({ @@ -536,6 +545,30 @@ export default class PluginSample extends Plugin { click: () => { this.eventBus.off("input-search", this.eventBusLog); } + }, { + icon: "iconSelect", + label: "On open-siyuan-url-plugin", + click: () => { + this.eventBus.on("open-siyuan-url-plugin", this.eventBusLog); + } + }, { + icon: "iconClose", + label: "Off open-siyuan-url-plugin", + click: () => { + this.eventBus.off("open-siyuan-url-plugin", this.eventBusLog); + } + }, { + icon: "iconSelect", + label: "On open-siyuan-url-block", + click: () => { + this.eventBus.on("open-siyuan-url-block", this.eventBusLog); + } + }, { + icon: "iconClose", + label: "Off open-siyuan-url-block", + click: () => { + this.eventBus.off("open-siyuan-url-block", this.eventBusLog); + } }] }); menu.addSeparator();