Skip to content

Commit

Permalink
🚀 update to v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jan 13, 2024
1 parent 74d62ac commit 1735ec4
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": "",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
73 changes: 72 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
openWindow,
IOperation,
Constants,
openMobileFileById
openMobileFileById,
lockScreen,
ICard,
ICardData
} from "siyuan";
import "@/index.scss";

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1735ec4

Please sign in to comment.