🚀 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)
|
||||
|
||||
> 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)
|
||||
|
||||
|
||||
> 本例同 [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 打包
|
||||
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "plugin-sample-vite-svelte",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"type": "module",
|
||||
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan)",
|
||||
"repository": "",
|
||||
|
@ -22,7 +22,7 @@
|
|||
"minimist": "^1.2.8",
|
||||
"rollup-plugin-livereload": "^2.0.5",
|
||||
"sass": "^1.62.1",
|
||||
"siyuan": "0.9.1",
|
||||
"siyuan": "0.9.2",
|
||||
"svelte": "^3.57.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.4",
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name": "plugin-sample-vite-svelte",
|
||||
"author": "frostime",
|
||||
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
|
||||
"version": "0.3.1",
|
||||
"minAppVersion": "2.11.4",
|
||||
"version": "0.3.2",
|
||||
"minAppVersion": "2.12.1",
|
||||
"backends": [
|
||||
"windows",
|
||||
"linux",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
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 res = response.code === 0 ? response.data : null;
|
||||
return res;
|
||||
|
|
73
src/index.ts
73
src/index.ts
|
@ -13,7 +13,10 @@ import {
|
|||
openWindow,
|
||||
IOperation,
|
||||
Constants,
|
||||
openMobileFileById
|
||||
openMobileFileById,
|
||||
lockScreen,
|
||||
ICard,
|
||||
ICardData
|
||||
} from "siyuan";
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -263,6 +298,23 @@ export default class PluginSample extends Plugin {
|
|||
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
|
||||
*/
|
||||
|
@ -447,6 +499,13 @@ export default class PluginSample extends Plugin {
|
|||
}
|
||||
});
|
||||
}
|
||||
menu.addItem({
|
||||
icon: "iconLock",
|
||||
label: "Lockscreen",
|
||||
click: () => {
|
||||
lockScreen(this.app);
|
||||
}
|
||||
});
|
||||
menu.addItem({
|
||||
icon: "iconScrollHoriz",
|
||||
label: "Event Bus",
|
||||
|
@ -679,6 +738,18 @@ export default class PluginSample extends Plugin {
|
|||
click: () => {
|
||||
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",
|
||||
label: "On input-search",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue