⬆️ update with siyuan petal

This commit is contained in:
frostime 2023-12-28 22:37:37 +08:00
parent c179519f95
commit a2a615aae2
6 changed files with 66 additions and 22 deletions

View file

@ -1,5 +1,21 @@
# Changelog # Changelog
## 0.3.2 2024-01
## 0.3.1 2023-12-06
* [Support `Dock Plugin` and `Command Palette` on mobile](https://github.com/siyuan-note/siyuan/issues/9926)
## 0.3.0 2023-12-05
* Upgrade Siyuan to 0.9.0
* Support more platforms
## 0.2.9 2023-11-28
* [Add plugin method `openMobileFileById`](https://github.com/siyuan-note/siyuan/issues/9738)
## 0.2.8 2023-11-15 ## 0.2.8 2023-11-15
* [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640) * [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)

View file

@ -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.2.8](https://github.com/siyuan-note/plugin-sample/tree/v0.2.8) > 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)

View file

@ -4,7 +4,7 @@
[English](./README.md) [English](./README.md)
> 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.2.8](https://github.com/siyuan-note/plugin-sample/tree/v0.2.8) > 本例同 [siyuan/plugin-sample](https://github.com/siyuan-note/plugin-sample) [v0.3.1](https://github.com/siyuan-note/plugin-sample/tree/v0.3.1)
1. 使用 vite 打包 1. 使用 vite 打包
2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发 2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发

View file

@ -1,6 +1,6 @@
{ {
"name": "plugin-sample-vite-svelte", "name": "plugin-sample-vite-svelte",
"version": "0.2.6", "version": "0.3.1",
"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.8.8", "siyuan": "0.9.1",
"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",

View file

@ -2,15 +2,20 @@
"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.2.8", "version": "0.3.1",
"minAppVersion": "2.10.14", "minAppVersion": "2.11.4",
"backends": [ "backends": [
"windows", "windows",
"linux", "linux",
"darwin" "darwin",
"ios",
"android"
], ],
"frontends": [ "frontends": [
"desktop", "desktop",
"mobile",
"browser-desktop",
"browser-mobile",
"desktop-window" "desktop-window"
], ],
"displayName": { "displayName": {

View file

@ -12,7 +12,8 @@ import {
Protyle, Protyle,
openWindow, openWindow,
IOperation, IOperation,
Constants Constants,
openMobileFileById
} from "siyuan"; } from "siyuan";
import "@/index.scss"; import "@/index.scss";
@ -124,20 +125,34 @@ export default class PluginSample extends Plugin {
resize() { resize() {
console.log(DOCK_TYPE + " resize"); console.log(DOCK_TYPE + " resize");
}, },
init() { update() {
this.element.innerHTML = `<div class="fn__flex-1 fn__flex-column"> console.log(DOCK_TYPE + " update");
<div class="block__icons"> },
<div class="block__logo"> init: (dock) => {
<svg><use xlink:href="#iconEmoji"></use></svg> if (this.isMobile) {
Custom Dock dock.element.innerHTML = `<div class="toolbar toolbar--border toolbar--dark">
</div> <svg class="toolbar__icon"><use xlink:href="#iconEmoji"></use></svg>
<span class="fn__flex-1 fn__space"></span> <div class="toolbar__text">Custom Dock</div>
<span data-type="min" class="block__icon b3-tooltips b3-tooltips__sw" aria-label="Min ${adaptHotkey("W")}"><svg><use xlink:href="#iconMin"></use></svg></span> </div>
</div> <div class="fn__flex-1 plugin-sample__custom-dock">
<div class="fn__flex-1 plugin-sample__custom-dock"> ${dock.data.text}
${this.data.text} </div>
</div> </div>`;
</div>`; } else {
dock.element.innerHTML = `<div class="fn__flex-1 fn__flex-column">
<div class="block__icons">
<div class="block__logo">
<svg><use xlink:href="#iconEmoji"></use></svg>
Custom Dock
</div>
<span class="fn__flex-1 fn__space"></span>
<span data-type="min" class="block__icon b3-tooltips b3-tooltips__sw" aria-label="Min ${adaptHotkey("W")}"><svg><use xlink:href="#iconMin"></use></svg></span>
</div>
<div class="fn__flex-1 plugin-sample__custom-dock">
${dock.data.text}
</div>
</div>`;
}
}, },
destroy() { destroy() {
console.log("destroy dock:", DOCK_TYPE); console.log("destroy dock:", DOCK_TYPE);
@ -423,6 +438,14 @@ export default class PluginSample extends Plugin {
}); });
} }
}); });
} else {
menu.addItem({
icon: "iconFile",
label: "Open Doc(open help first)",
click: () => {
openMobileFileById(this.app, "20200812220555-lj3enxa");
}
});
} }
menu.addItem({ menu.addItem({
icon: "iconScrollHoriz", icon: "iconScrollHoriz",