✨ feat(update): 更新插件模板前端部分
This commit is contained in:
parent
3de8bc6134
commit
8e841a4a90
4 changed files with 34 additions and 6 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,6 +1,14 @@
|
|||
# Changelog
|
||||
|
||||
## 0.2.7 2023-10
|
||||
## 0.2.8 2023-11-15
|
||||
|
||||
* [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)
|
||||
|
||||
## 0.2.7 2023-10-31
|
||||
|
||||
* [Export `Constants` to plugin](https://github.com/siyuan-note/siyuan/issues/9555)
|
||||
* [Add plugin `app.appId`](https://github.com/siyuan-note/siyuan/issues/9538)
|
||||
* [Add plugin event bus `switch-protyle`](https://github.com/siyuan-note/siyuan/issues/9454)
|
||||
|
||||
## 0.2.6 2023-10-24
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* API 文档见 [API_zh_CN.md](https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md)
|
||||
*/
|
||||
|
||||
import { time } from "console";
|
||||
import { fetchSyncPost, IWebSocketData } from "siyuan";
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
</script>
|
||||
|
||||
<div class="b3-dialog__content">
|
||||
<div>appId:</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="plugin-sample__time">${app?.appId}</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="fn__hr"></div>
|
||||
<div>API demo:</div>
|
||||
<div class="fn__hr" />
|
||||
<div class="plugin-sample__time">
|
||||
|
|
24
src/index.ts
24
src/index.ts
|
@ -9,9 +9,10 @@ import {
|
|||
getFrontend,
|
||||
getBackend,
|
||||
IModel,
|
||||
Setting,
|
||||
fetchPost,
|
||||
Protyle, openWindow, IOperation
|
||||
Protyle,
|
||||
openWindow,
|
||||
IOperation,
|
||||
Constants
|
||||
} from "siyuan";
|
||||
import "@/index.scss";
|
||||
|
||||
|
@ -120,6 +121,9 @@ export default class PluginSample extends Plugin {
|
|||
text: "This is my custom dock"
|
||||
},
|
||||
type: DOCK_TYPE,
|
||||
resize() {
|
||||
console.log(DOCK_TYPE + " resize");
|
||||
},
|
||||
init() {
|
||||
this.element.innerHTML = `<div class="fn__flex-1 fn__flex-column">
|
||||
<div class="block__icons">
|
||||
|
@ -308,7 +312,7 @@ export default class PluginSample extends Plugin {
|
|||
|
||||
private showDialog() {
|
||||
let dialog = new Dialog({
|
||||
title: "Hello World",
|
||||
title: `SiYuan ${Constants.SIYUAN_VERSION}`,
|
||||
content: `<div id="helloPanel" class="b3-dialog__content"></div>`,
|
||||
width: this.isMobile ? "92vw" : "720px",
|
||||
destroyCallback(options) {
|
||||
|
@ -528,6 +532,18 @@ export default class PluginSample extends Plugin {
|
|||
click: () => {
|
||||
this.eventBus.off("loaded-protyle-dynamic", this.eventBusLog);
|
||||
}
|
||||
}, {
|
||||
icon: "iconSelect",
|
||||
label: "On switch-protyle",
|
||||
click: () => {
|
||||
this.eventBus.on("switch-protyle", this.eventBusLog);
|
||||
}
|
||||
}, {
|
||||
icon: "iconClose",
|
||||
label: "Off switch-protyle",
|
||||
click: () => {
|
||||
this.eventBus.off("switch-protyle", this.eventBusLog);
|
||||
}
|
||||
}, {
|
||||
icon: "iconSelect",
|
||||
label: "On destroy-protyle",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue