Skip to content

Commit 1735ec4

Browse files
committed
🚀 update to v0.3.2
1 parent 74d62ac commit 1735ec4

File tree

6 files changed

+79
-8
lines changed

6 files changed

+79
-8
lines changed

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.3.1](https://github.com/siyuan-note/plugin-sample/tree/v0.3.1)
6+
> Consistent with [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.2](https://github.com/siyuan-note/plugin-sample/tree/v0.3.2)
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.3.1](https://github.com/siyuan-note/plugin-sample/tree/v0.3.1)
7+
> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.2](https://github.com/siyuan-note/plugin-sample/tree/v0.3.2)
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.3.1",
3+
"version": "0.3.2",
44
"type": "module",
55
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan)",
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.9.1",
25+
"siyuan": "0.9.2",
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.3.1",
6-
"minAppVersion": "2.11.4",
5+
"version": "0.3.2",
6+
"minAppVersion": "2.12.1",
77
"backends": [
88
"windows",
99
"linux",

src/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { fetchSyncPost, IWebSocketData } from "siyuan";
1010

1111

12-
async function request(url: string, data: any) {
12+
export async function request(url: string, data: any) {
1313
let response: IWebSocketData = await fetchSyncPost(url, data);
1414
let res = response.code === 0 ? response.data : null;
1515
return res;

src/index.ts

+72-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
openWindow,
1414
IOperation,
1515
Constants,
16-
openMobileFileById
16+
openMobileFileById,
17+
lockScreen,
18+
ICard,
19+
ICardData
1720
} from "siyuan";
1821
import "@/index.scss";
1922

@@ -227,6 +230,38 @@ export default class PluginSample extends Plugin {
227230
}
228231
}];
229232

233+
this.protyleOptions = {
234+
toolbar: ["block-ref",
235+
"a",
236+
"|",
237+
"text",
238+
"strong",
239+
"em",
240+
"u",
241+
"s",
242+
"mark",
243+
"sup",
244+
"sub",
245+
"clear",
246+
"|",
247+
"code",
248+
"kbd",
249+
"tag",
250+
"inline-math",
251+
"inline-memo",
252+
"|",
253+
{
254+
name: "insert-smail-emoji",
255+
icon: "iconEmoji",
256+
hotkey: "⇧⌘I",
257+
tipPosition: "n",
258+
tip: this.i18n.insertEmoji,
259+
click(protyle: Protyle) {
260+
protyle.insert("😊");
261+
}
262+
}],
263+
};
264+
230265
console.log(this.i18n.helloPlugin);
231266
}
232267

@@ -263,6 +298,23 @@ export default class PluginSample extends Plugin {
263298
console.log("onunload");
264299
}
265300

301+
uninstall() {
302+
console.log("uninstall");
303+
}
304+
305+
async updateCards(options: ICardData) {
306+
options.cards.sort((a: ICard, b: ICard) => {
307+
if (a.blockID < b.blockID) {
308+
return -1;
309+
}
310+
if (a.blockID > b.blockID) {
311+
return 1;
312+
}
313+
return 0;
314+
});
315+
return options;
316+
}
317+
266318
/**
267319
* A custom setting pannel provided by svelte
268320
*/
@@ -447,6 +499,13 @@ export default class PluginSample extends Plugin {
447499
}
448500
});
449501
}
502+
menu.addItem({
503+
icon: "iconLock",
504+
label: "Lockscreen",
505+
click: () => {
506+
lockScreen(this.app);
507+
}
508+
});
450509
menu.addItem({
451510
icon: "iconScrollHoriz",
452511
label: "Event Bus",
@@ -679,6 +738,18 @@ export default class PluginSample extends Plugin {
679738
click: () => {
680739
this.eventBus.off("open-menu-breadcrumbmore", this.eventBusLog);
681740
}
741+
}, {
742+
icon: "iconSelect",
743+
label: "On open-menu-inbox",
744+
click: () => {
745+
this.eventBus.on("open-menu-inbox", this.eventBusLog);
746+
}
747+
}, {
748+
icon: "iconClose",
749+
label: "Off open-menu-inbox",
750+
click: () => {
751+
this.eventBus.off("open-menu-inbox", this.eventBusLog);
752+
}
682753
}, {
683754
icon: "iconSelect",
684755
label: "On input-search",

0 commit comments

Comments
 (0)