🚀 update to v0.3.2
This commit is contained in:
parent
74d62ac1aa
commit
1735ec4bce
6 changed files with 79 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
[中文版](./README_zh_CN.md)
|
[中文版](./README_zh_CN.md)
|
||||||
|
|
||||||
> 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)
|
> 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[English](./README.md)
|
[English](./README.md)
|
||||||
|
|
||||||
|
|
||||||
> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.1](https://github.com/siyuan-note/plugin-sample/tree/v0.3.1)
|
> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.2](https://github.com/siyuan-note/plugin-sample/tree/v0.3.2)
|
||||||
|
|
||||||
1. 使用 vite 打包
|
1. 使用 vite 打包
|
||||||
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
|
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "plugin-sample-vite-svelte",
|
"name": "plugin-sample-vite-svelte",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan)",
|
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan)",
|
||||||
"repository": "",
|
"repository": "",
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
"rollup-plugin-livereload": "^2.0.5",
|
"rollup-plugin-livereload": "^2.0.5",
|
||||||
"sass": "^1.62.1",
|
"sass": "^1.62.1",
|
||||||
"siyuan": "0.9.1",
|
"siyuan": "0.9.2",
|
||||||
"svelte": "^3.57.0",
|
"svelte": "^3.57.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name": "plugin-sample-vite-svelte",
|
"name": "plugin-sample-vite-svelte",
|
||||||
"author": "frostime",
|
"author": "frostime",
|
||||||
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
|
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"minAppVersion": "2.11.4",
|
"minAppVersion": "2.12.1",
|
||||||
"backends": [
|
"backends": [
|
||||||
"windows",
|
"windows",
|
||||||
"linux",
|
"linux",
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import { fetchSyncPost, IWebSocketData } from "siyuan";
|
import { fetchSyncPost, IWebSocketData } from "siyuan";
|
||||||
|
|
||||||
|
|
||||||
async function request(url: string, data: any) {
|
export async function request(url: string, data: any) {
|
||||||
let response: IWebSocketData = await fetchSyncPost(url, data);
|
let response: IWebSocketData = await fetchSyncPost(url, data);
|
||||||
let res = response.code === 0 ? response.data : null;
|
let res = response.code === 0 ? response.data : null;
|
||||||
return res;
|
return res;
|
||||||
|
|
73
src/index.ts
73
src/index.ts
|
@ -13,7 +13,10 @@ import {
|
||||||
openWindow,
|
openWindow,
|
||||||
IOperation,
|
IOperation,
|
||||||
Constants,
|
Constants,
|
||||||
openMobileFileById
|
openMobileFileById,
|
||||||
|
lockScreen,
|
||||||
|
ICard,
|
||||||
|
ICardData
|
||||||
} from "siyuan";
|
} from "siyuan";
|
||||||
import "@/index.scss";
|
import "@/index.scss";
|
||||||
|
|
||||||
|
@ -227,6 +230,38 @@ export default class PluginSample extends Plugin {
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
this.protyleOptions = {
|
||||||
|
toolbar: ["block-ref",
|
||||||
|
"a",
|
||||||
|
"|",
|
||||||
|
"text",
|
||||||
|
"strong",
|
||||||
|
"em",
|
||||||
|
"u",
|
||||||
|
"s",
|
||||||
|
"mark",
|
||||||
|
"sup",
|
||||||
|
"sub",
|
||||||
|
"clear",
|
||||||
|
"|",
|
||||||
|
"code",
|
||||||
|
"kbd",
|
||||||
|
"tag",
|
||||||
|
"inline-math",
|
||||||
|
"inline-memo",
|
||||||
|
"|",
|
||||||
|
{
|
||||||
|
name: "insert-smail-emoji",
|
||||||
|
icon: "iconEmoji",
|
||||||
|
hotkey: "⇧⌘I",
|
||||||
|
tipPosition: "n",
|
||||||
|
tip: this.i18n.insertEmoji,
|
||||||
|
click(protyle: Protyle) {
|
||||||
|
protyle.insert("😊");
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
console.log(this.i18n.helloPlugin);
|
console.log(this.i18n.helloPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +298,23 @@ export default class PluginSample extends Plugin {
|
||||||
console.log("onunload");
|
console.log("onunload");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uninstall() {
|
||||||
|
console.log("uninstall");
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateCards(options: ICardData) {
|
||||||
|
options.cards.sort((a: ICard, b: ICard) => {
|
||||||
|
if (a.blockID < b.blockID) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (a.blockID > b.blockID) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom setting pannel provided by svelte
|
* A custom setting pannel provided by svelte
|
||||||
*/
|
*/
|
||||||
|
@ -447,6 +499,13 @@ export default class PluginSample extends Plugin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
menu.addItem({
|
||||||
|
icon: "iconLock",
|
||||||
|
label: "Lockscreen",
|
||||||
|
click: () => {
|
||||||
|
lockScreen(this.app);
|
||||||
|
}
|
||||||
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
icon: "iconScrollHoriz",
|
icon: "iconScrollHoriz",
|
||||||
label: "Event Bus",
|
label: "Event Bus",
|
||||||
|
@ -679,6 +738,18 @@ export default class PluginSample extends Plugin {
|
||||||
click: () => {
|
click: () => {
|
||||||
this.eventBus.off("open-menu-breadcrumbmore", this.eventBusLog);
|
this.eventBus.off("open-menu-breadcrumbmore", this.eventBusLog);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
icon: "iconSelect",
|
||||||
|
label: "On open-menu-inbox",
|
||||||
|
click: () => {
|
||||||
|
this.eventBus.on("open-menu-inbox", this.eventBusLog);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
icon: "iconClose",
|
||||||
|
label: "Off open-menu-inbox",
|
||||||
|
click: () => {
|
||||||
|
this.eventBus.off("open-menu-inbox", this.eventBusLog);
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
icon: "iconSelect",
|
icon: "iconSelect",
|
||||||
label: "On input-search",
|
label: "On input-search",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue