diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3d0833..7310325 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,20 @@
-## 0.2.0
+# Changelog
+
+## 0.2.3 2023-09-05
+
+* [Plugin API add openWindow and command.globalCallback](https://github.com/siyuan-note/siyuan/issues/9032)
+
+## 0.2.2 2023-08-29
+
+* [Add plugin event bus `destroy-protyle`](https://github.com/siyuan-note/siyuan/issues/9033)
+* [Add plugin event bus `loaded-protyle-dynamic`](https://github.com/siyuan-note/siyuan/issues/9021)
+
+## 0.2.1 2023-08-21
+
+* [Plugin API add getOpenedTab method](https://github.com/siyuan-note/siyuan/issues/9002)
+* [Plugin API custom.fn => custom.id in openTab](https://github.com/siyuan-note/siyuan/issues/8944)
+
+## 0.2.0 2023-08-15
* [Add plugin event bus `open-siyuan-url-plugin` and `open-siyuan-url-block`](https://github.com/siyuan-note/siyuan/pull/8927)
diff --git a/README.md b/README.md
index 4ed21ad..d4ddddb 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.12](https://github.com/siyuan-note/plugin-sample/tree/v0.1.12)
+> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.2.3](https://github.com/siyuan-note/plugin-sample/tree/v0.2.3)
diff --git a/README_zh_CN.md b/README_zh_CN.md
index e3c15d8..c8ad1fd 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.12](https://github.com/siyuan-note/plugin-sample/tree/v0.1.12)
+> 本例和 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.2.3](https://github.com/siyuan-note/plugin-sample/tree/v0.2.3)
1. 使用 vite 打包
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
diff --git a/package.json b/package.json
index 7b229f4..528917a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "plugin-sample-vite-svelte",
- "version": "0.1.12",
+ "version": "0.2.3",
"type": "module",
"description": "",
"repository": "",
@@ -22,7 +22,7 @@
"minimist": "^1.2.8",
"rollup-plugin-livereload": "^2.0.5",
"sass": "^1.62.1",
- "siyuan": "0.8.1",
+ "siyuan": "0.8.3",
"svelte": "^3.57.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
diff --git a/plugin.json b/plugin.json
index 5def5dc..41c9250 100644
--- a/plugin.json
+++ b/plugin.json
@@ -2,8 +2,8 @@
"name": "plugin-sample-vite-svelte",
"author": "frostime",
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
- "version": "0.1.12",
- "minAppVersion": "2.9.0",
+ "version": "0.2.3",
+ "minAppVersion": "2.10.3",
"backends": ["all"],
"frontends": ["all"],
"displayName": {
diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json
index 58f63ff..4f21f86 100644
--- a/src/i18n/en_US.json
+++ b/src/i18n/en_US.json
@@ -9,6 +9,7 @@
"removedData": "Data deleted",
"confirmRemove": "Confirm to delete the data in ${name}?",
"insertEmoji": "Insert Emoji",
+ "getTab": "Print out all opened custom tabs in the debugger",
"name": "SiYuan",
"hello": {
"makesure": "Before using this template, please read the offical sample, make sure that you've known about the pipeline for plugin developing."
diff --git a/src/i18n/zh_CN.json b/src/i18n/zh_CN.json
index a1ee598..5a586e1 100644
--- a/src/i18n/zh_CN.json
+++ b/src/i18n/zh_CN.json
@@ -9,6 +9,7 @@
"removedData": "数据已删除",
"confirmRemove": "确认删除 ${name} 中的数据?",
"insertEmoji": "插入表情",
+ "getTab": "在日志中打印出已打开的所有自定义页签",
"name": "思源",
"hello": {
"makesure": "使用这个模板之前,请阅读官方教程, 确保自己已经理解了插件的基本开发流程。"
diff --git a/src/index.ts b/src/index.ts
index 53bfdb5..02aa494 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -11,7 +11,7 @@ import {
IModel,
Setting,
fetchPost,
- Protyle
+ Protyle, openWindow
} from "siyuan";
import "@/index.scss";
@@ -105,7 +105,7 @@ export default class PluginSample extends Plugin {
this.addCommand({
langKey: "showDialog",
- hotkey: "⇧⌘M",
+ hotkey: "⇧⌘O",
callback: () => {
this.showDialog();
},
@@ -119,6 +119,13 @@ export default class PluginSample extends Plugin {
console.log(element, "dockCallback");
},
});
+ this.addCommand({
+ langKey: "getTab",
+ hotkey: "⇧⌘M",
+ globalCallback: () => {
+ console.log(this.getOpenedTab());
+ },
+ });
this.addDock({
config: {
@@ -267,7 +274,7 @@ export default class PluginSample extends Plugin {
});
if (!this.isMobile) {
menu.addItem({
- icon: "iconLayoutBottom",
+ icon: "iconFace",
label: "Open Custom Tab",
click: () => {
const tab = openTab({
@@ -278,14 +285,14 @@ export default class PluginSample extends Plugin {
data: {
text: "This is my custom tab",
},
- fn: this.customTab
+ id: this.name + TAB_TYPE
},
});
console.log(tab);
}
});
menu.addItem({
- icon: "iconLayoutBottom",
+ icon: "iconImage",
label: "Open Asset Tab(open help first)",
click: () => {
const tab = openTab({
@@ -298,7 +305,7 @@ export default class PluginSample extends Plugin {
}
});
menu.addItem({
- icon: "iconLayoutBottom",
+ icon: "iconFile",
label: "Open Doc Tab(open help first)",
click: async () => {
const tab = await openTab({
@@ -311,7 +318,7 @@ export default class PluginSample extends Plugin {
}
});
menu.addItem({
- icon: "iconLayoutBottom",
+ icon: "iconSearch",
label: "Open Search Tab",
click: () => {
const tab = openTab({
@@ -324,7 +331,7 @@ export default class PluginSample extends Plugin {
}
});
menu.addItem({
- icon: "iconLayoutBottom",
+ icon: "iconRiffCard",
label: "Open Card Tab",
click: () => {
const tab = openTab({
@@ -348,6 +355,15 @@ export default class PluginSample extends Plugin {
});
}
});
+ menu.addItem({
+ icon: "iconOpenWindow",
+ label: "Open Doc Window(open help first)",
+ click: () => {
+ openWindow({
+ doc: {id: "20200812220555-lj3enxa"}
+ });
+ }
+ });
}
menu.addItem({
icon: "iconScrollHoriz",
@@ -431,6 +447,30 @@ export default class PluginSample extends Plugin {
click: () => {
this.eventBus.on("loaded-protyle", this.eventBusLog);
}
+ }, {
+ icon: "iconSelect",
+ label: "On loaded-protyle-dynamic",
+ click: () => {
+ this.eventBus.on("loaded-protyle-dynamic", this.eventBusLog);
+ }
+ }, {
+ icon: "iconClose",
+ label: "Off loaded-protyle-dynamic",
+ click: () => {
+ this.eventBus.off("loaded-protyle-dynamic", this.eventBusLog);
+ }
+ }, {
+ icon: "iconSelect",
+ label: "On destroy-protyle",
+ click: () => {
+ this.eventBus.on("destroy-protyle", this.eventBusLog);
+ }
+ }, {
+ icon: "iconClose",
+ label: "Off destroy-protyle",
+ click: () => {
+ this.eventBus.off("destroy-protyle", this.eventBusLog);
+ }
}, {
icon: "iconClose",
label: "Off loaded-protyle",