Skip to content

Commit deb0656

Browse files
authored
Merge pull request #21 from siyuan-note/dev
Update
2 parents f114305 + 06f598b commit deb0656

8 files changed

+73
-15
lines changed

CHANGELOG.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
## 0.2.0
1+
# Changelog
2+
3+
## 0.2.3 2023-09-05
4+
5+
* [Plugin API add openWindow and command.globalCallback](https://github.com/siyuan-note/siyuan/issues/9032)
6+
7+
## 0.2.2 2023-08-29
8+
9+
* [Add plugin event bus `destroy-protyle`](https://github.com/siyuan-note/siyuan/issues/9033)
10+
* [Add plugin event bus `loaded-protyle-dynamic`](https://github.com/siyuan-note/siyuan/issues/9021)
11+
12+
## 0.2.1 2023-08-21
13+
14+
* [Plugin API add getOpenedTab method](https://github.com/siyuan-note/siyuan/issues/9002)
15+
* [Plugin API custom.fn => custom.id in openTab](https://github.com/siyuan-note/siyuan/issues/8944)
16+
17+
## 0.2.0 2023-08-15
218

319
* [Add plugin event bus `open-siyuan-url-plugin` and `open-siyuan-url-block`](https://github.com/siyuan-note/siyuan/pull/8927)
420

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[中文版](./README_zh_CN.md)
55

6-
> 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)
6+
> 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)
77
88

99

README_zh_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[English](./README.md)
55

66

7-
> 本例和 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.1.12](https://github.com/siyuan-note/plugin-sample/tree/v0.1.12)
7+
> 本例和 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.2.3](https://github.com/siyuan-note/plugin-sample/tree/v0.2.3)
88
99
1. 使用 vite 打包
1010
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plugin-sample-vite-svelte",
3-
"version": "0.1.12",
3+
"version": "0.2.3",
44
"type": "module",
55
"description": "",
66
"repository": "",
@@ -22,7 +22,7 @@
2222
"minimist": "^1.2.8",
2323
"rollup-plugin-livereload": "^2.0.5",
2424
"sass": "^1.62.1",
25-
"siyuan": "0.8.1",
25+
"siyuan": "0.8.3",
2626
"svelte": "^3.57.0",
2727
"ts-node": "^10.9.1",
2828
"typescript": "^5.0.4",

plugin.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "plugin-sample-vite-svelte",
33
"author": "frostime",
44
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
5-
"version": "0.1.12",
6-
"minAppVersion": "2.9.0",
5+
"version": "0.2.3",
6+
"minAppVersion": "2.10.3",
77
"backends": ["all"],
88
"frontends": ["all"],
99
"displayName": {

src/i18n/en_US.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"removedData": "Data deleted",
1010
"confirmRemove": "Confirm to delete the data in ${name}?",
1111
"insertEmoji": "Insert Emoji",
12+
"getTab": "Print out all opened custom tabs in the debugger",
1213
"name": "SiYuan",
1314
"hello": {
1415
"makesure": "Before using this template, please read the <a href=\"https://github.com/siyuan-note/plugin-sample\">offical sample</a>, make sure that you've known about the pipeline for plugin developing."

src/i18n/zh_CN.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"removedData": "数据已删除",
1010
"confirmRemove": "确认删除 ${name} 中的数据?",
1111
"insertEmoji": "插入表情",
12+
"getTab": "在日志中打印出已打开的所有自定义页签",
1213
"name": "思源",
1314
"hello": {
1415
"makesure": "使用这个模板之前,请阅读<a href=\"https://github.com/siyuan-note/plugin-sample\">官方教程</a>, 确保自己已经理解了插件的基本开发流程。"

src/index.ts

+48-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
IModel,
1212
Setting,
1313
fetchPost,
14-
Protyle
14+
Protyle, openWindow
1515
} from "siyuan";
1616
import "@/index.scss";
1717

@@ -105,7 +105,7 @@ export default class PluginSample extends Plugin {
105105

106106
this.addCommand({
107107
langKey: "showDialog",
108-
hotkey: "⇧⌘M",
108+
hotkey: "⇧⌘O",
109109
callback: () => {
110110
this.showDialog();
111111
},
@@ -119,6 +119,13 @@ export default class PluginSample extends Plugin {
119119
console.log(element, "dockCallback");
120120
},
121121
});
122+
this.addCommand({
123+
langKey: "getTab",
124+
hotkey: "⇧⌘M",
125+
globalCallback: () => {
126+
console.log(this.getOpenedTab());
127+
},
128+
});
122129

123130
this.addDock({
124131
config: {
@@ -267,7 +274,7 @@ export default class PluginSample extends Plugin {
267274
});
268275
if (!this.isMobile) {
269276
menu.addItem({
270-
icon: "iconLayoutBottom",
277+
icon: "iconFace",
271278
label: "Open Custom Tab",
272279
click: () => {
273280
const tab = openTab({
@@ -278,14 +285,14 @@ export default class PluginSample extends Plugin {
278285
data: {
279286
text: "This is my custom tab",
280287
},
281-
fn: this.customTab
288+
id: this.name + TAB_TYPE
282289
},
283290
});
284291
console.log(tab);
285292
}
286293
});
287294
menu.addItem({
288-
icon: "iconLayoutBottom",
295+
icon: "iconImage",
289296
label: "Open Asset Tab(open help first)",
290297
click: () => {
291298
const tab = openTab({
@@ -298,7 +305,7 @@ export default class PluginSample extends Plugin {
298305
}
299306
});
300307
menu.addItem({
301-
icon: "iconLayoutBottom",
308+
icon: "iconFile",
302309
label: "Open Doc Tab(open help first)",
303310
click: async () => {
304311
const tab = await openTab({
@@ -311,7 +318,7 @@ export default class PluginSample extends Plugin {
311318
}
312319
});
313320
menu.addItem({
314-
icon: "iconLayoutBottom",
321+
icon: "iconSearch",
315322
label: "Open Search Tab",
316323
click: () => {
317324
const tab = openTab({
@@ -324,7 +331,7 @@ export default class PluginSample extends Plugin {
324331
}
325332
});
326333
menu.addItem({
327-
icon: "iconLayoutBottom",
334+
icon: "iconRiffCard",
328335
label: "Open Card Tab",
329336
click: () => {
330337
const tab = openTab({
@@ -348,6 +355,15 @@ export default class PluginSample extends Plugin {
348355
});
349356
}
350357
});
358+
menu.addItem({
359+
icon: "iconOpenWindow",
360+
label: "Open Doc Window(open help first)",
361+
click: () => {
362+
openWindow({
363+
doc: {id: "20200812220555-lj3enxa"}
364+
});
365+
}
366+
});
351367
}
352368
menu.addItem({
353369
icon: "iconScrollHoriz",
@@ -431,6 +447,30 @@ export default class PluginSample extends Plugin {
431447
click: () => {
432448
this.eventBus.on("loaded-protyle", this.eventBusLog);
433449
}
450+
}, {
451+
icon: "iconSelect",
452+
label: "On loaded-protyle-dynamic",
453+
click: () => {
454+
this.eventBus.on("loaded-protyle-dynamic", this.eventBusLog);
455+
}
456+
}, {
457+
icon: "iconClose",
458+
label: "Off loaded-protyle-dynamic",
459+
click: () => {
460+
this.eventBus.off("loaded-protyle-dynamic", this.eventBusLog);
461+
}
462+
}, {
463+
icon: "iconSelect",
464+
label: "On destroy-protyle",
465+
click: () => {
466+
this.eventBus.on("destroy-protyle", this.eventBusLog);
467+
}
468+
}, {
469+
icon: "iconClose",
470+
label: "Off destroy-protyle",
471+
click: () => {
472+
this.eventBus.off("destroy-protyle", this.eventBusLog);
473+
}
434474
}, {
435475
icon: "iconClose",
436476
label: "Off loaded-protyle",

0 commit comments

Comments
 (0)