Skip to content

Commit a2a615a

Browse files
committedDec 28, 2023
⬆️ update with siyuan petal
1 parent c179519 commit a2a615a

File tree

6 files changed

+66
-22
lines changed

6 files changed

+66
-22
lines changed
 

‎CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 0.3.2 2024-01
4+
5+
## 0.3.1 2023-12-06
6+
7+
* [Support `Dock Plugin` and `Command Palette` on mobile](https://github.com/siyuan-note/siyuan/issues/9926)
8+
9+
## 0.3.0 2023-12-05
10+
11+
* Upgrade Siyuan to 0.9.0
12+
* Support more platforms
13+
14+
## 0.2.9 2023-11-28
15+
16+
* [Add plugin method `openMobileFileById`](https://github.com/siyuan-note/siyuan/issues/9738)
17+
18+
319
## 0.2.8 2023-11-15
420

521
* [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)

‎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.2.8](https://github.com/siyuan-note/plugin-sample/tree/v0.2.8)
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)
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.2.8](https://github.com/siyuan-note/plugin-sample/tree/v0.2.8)
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)
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.2.6",
3+
"version": "0.3.1",
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.8.8",
25+
"siyuan": "0.9.1",
2626
"svelte": "^3.57.0",
2727
"ts-node": "^10.9.1",
2828
"typescript": "^5.0.4",

‎plugin.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
"name": "plugin-sample-vite-svelte",
33
"author": "frostime",
44
"url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
5-
"version": "0.2.8",
6-
"minAppVersion": "2.10.14",
5+
"version": "0.3.1",
6+
"minAppVersion": "2.11.4",
77
"backends": [
88
"windows",
99
"linux",
10-
"darwin"
10+
"darwin",
11+
"ios",
12+
"android"
1113
],
1214
"frontends": [
1315
"desktop",
16+
"mobile",
17+
"browser-desktop",
18+
"browser-mobile",
1419
"desktop-window"
1520
],
1621
"displayName": {

‎src/index.ts

+38-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
Protyle,
1313
openWindow,
1414
IOperation,
15-
Constants
15+
Constants,
16+
openMobileFileById
1617
} from "siyuan";
1718
import "@/index.scss";
1819

@@ -124,20 +125,34 @@ export default class PluginSample extends Plugin {
124125
resize() {
125126
console.log(DOCK_TYPE + " resize");
126127
},
127-
init() {
128-
this.element.innerHTML = `<div class="fn__flex-1 fn__flex-column">
129-
<div class="block__icons">
130-
<div class="block__logo">
131-
<svg><use xlink:href="#iconEmoji"></use></svg>
132-
Custom Dock
133-
</div>
134-
<span class="fn__flex-1 fn__space"></span>
135-
<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>
136-
</div>
137-
<div class="fn__flex-1 plugin-sample__custom-dock">
138-
${this.data.text}
139-
</div>
140-
</div>`;
128+
update() {
129+
console.log(DOCK_TYPE + " update");
130+
},
131+
init: (dock) => {
132+
if (this.isMobile) {
133+
dock.element.innerHTML = `<div class="toolbar toolbar--border toolbar--dark">
134+
<svg class="toolbar__icon"><use xlink:href="#iconEmoji"></use></svg>
135+
<div class="toolbar__text">Custom Dock</div>
136+
</div>
137+
<div class="fn__flex-1 plugin-sample__custom-dock">
138+
${dock.data.text}
139+
</div>
140+
</div>`;
141+
} else {
142+
dock.element.innerHTML = `<div class="fn__flex-1 fn__flex-column">
143+
<div class="block__icons">
144+
<div class="block__logo">
145+
<svg><use xlink:href="#iconEmoji"></use></svg>
146+
Custom Dock
147+
</div>
148+
<span class="fn__flex-1 fn__space"></span>
149+
<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>
150+
</div>
151+
<div class="fn__flex-1 plugin-sample__custom-dock">
152+
${dock.data.text}
153+
</div>
154+
</div>`;
155+
}
141156
},
142157
destroy() {
143158
console.log("destroy dock:", DOCK_TYPE);
@@ -423,6 +438,14 @@ export default class PluginSample extends Plugin {
423438
});
424439
}
425440
});
441+
} else {
442+
menu.addItem({
443+
icon: "iconFile",
444+
label: "Open Doc(open help first)",
445+
click: () => {
446+
openMobileFileById(this.app, "20200812220555-lj3enxa");
447+
}
448+
});
426449
}
427450
menu.addItem({
428451
icon: "iconScrollHoriz",

0 commit comments

Comments
 (0)
Please sign in to comment.