Skip to content

Commit 8e841a4

Browse files
committed
✨ feat(update): 更新插件模板前端部分
1 parent 3de8bc6 commit 8e841a4

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22

3-
## 0.2.7 2023-10
3+
## 0.2.8 2023-11-15
4+
5+
* [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)
6+
7+
## 0.2.7 2023-10-31
8+
9+
* [Export `Constants` to plugin](https://github.com/siyuan-note/siyuan/issues/9555)
10+
* [Add plugin `app.appId`](https://github.com/siyuan-note/siyuan/issues/9538)
11+
* [Add plugin event bus `switch-protyle`](https://github.com/siyuan-note/siyuan/issues/9454)
412

513
## 0.2.6 2023-10-24
614

src/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* API 文档见 [API_zh_CN.md](https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md)
77
*/
88

9-
import { time } from "console";
109
import { fetchSyncPost, IWebSocketData } from "siyuan";
1110

1211

src/hello.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
</script>
3737

3838
<div class="b3-dialog__content">
39+
<div>appId:</div>
40+
<div class="fn__hr"></div>
41+
<div class="plugin-sample__time">${app?.appId}</div>
42+
<div class="fn__hr"></div>
43+
<div class="fn__hr"></div>
3944
<div>API demo:</div>
4045
<div class="fn__hr" />
4146
<div class="plugin-sample__time">

src/index.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import {
99
getFrontend,
1010
getBackend,
1111
IModel,
12-
Setting,
13-
fetchPost,
14-
Protyle, openWindow, IOperation
12+
Protyle,
13+
openWindow,
14+
IOperation,
15+
Constants
1516
} from "siyuan";
1617
import "@/index.scss";
1718

@@ -120,6 +121,9 @@ export default class PluginSample extends Plugin {
120121
text: "This is my custom dock"
121122
},
122123
type: DOCK_TYPE,
124+
resize() {
125+
console.log(DOCK_TYPE + " resize");
126+
},
123127
init() {
124128
this.element.innerHTML = `<div class="fn__flex-1 fn__flex-column">
125129
<div class="block__icons">
@@ -308,7 +312,7 @@ export default class PluginSample extends Plugin {
308312

309313
private showDialog() {
310314
let dialog = new Dialog({
311-
title: "Hello World",
315+
title: `SiYuan ${Constants.SIYUAN_VERSION}`,
312316
content: `<div id="helloPanel" class="b3-dialog__content"></div>`,
313317
width: this.isMobile ? "92vw" : "720px",
314318
destroyCallback(options) {
@@ -528,6 +532,18 @@ export default class PluginSample extends Plugin {
528532
click: () => {
529533
this.eventBus.off("loaded-protyle-dynamic", this.eventBusLog);
530534
}
535+
}, {
536+
icon: "iconSelect",
537+
label: "On switch-protyle",
538+
click: () => {
539+
this.eventBus.on("switch-protyle", this.eventBusLog);
540+
}
541+
}, {
542+
icon: "iconClose",
543+
label: "Off switch-protyle",
544+
click: () => {
545+
this.eventBus.off("switch-protyle", this.eventBusLog);
546+
}
531547
}, {
532548
icon: "iconSelect",
533549
label: "On destroy-protyle",

0 commit comments

Comments
 (0)