From a2a615aae2531e4c170ead4829c5a88d028eefd2 Mon Sep 17 00:00:00 2001
From: frostime <frostime@foxmail.com>
Date: Thu, 28 Dec 2023 22:37:37 +0800
Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20update=20with=20siyuan=20p?=
 =?UTF-8?q?etal?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 CHANGELOG.md    | 16 +++++++++++++++
 README.md       |  2 +-
 README_zh_CN.md |  2 +-
 package.json    |  4 ++--
 plugin.json     | 11 +++++++---
 src/index.ts    | 53 +++++++++++++++++++++++++++++++++++--------------
 6 files changed, 66 insertions(+), 22 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4411dd8..c5116c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
 # 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
 
 * [`resize` cannot be triggered after dragging to unpin the dock](https://github.com/siyuan-note/siyuan/issues/9640)
diff --git a/README.md b/README.md
index b7da17d..4d2e0be 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 
 [中文版](./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)
 
 
 
diff --git a/README_zh_CN.md b/README_zh_CN.md
index 950f11c..817c11e 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -4,7 +4,7 @@
 [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 打包
 2. 使用符号链接、而不是把项目放到插件目录下的模式进行开发
diff --git a/package.json b/package.json
index e4c06a2..7a6045b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "plugin-sample-vite-svelte",
-  "version": "0.2.6",
+  "version": "0.3.1",
   "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.8.8",
+    "siyuan": "0.9.1",
     "svelte": "^3.57.0",
     "ts-node": "^10.9.1",
     "typescript": "^5.0.4",
diff --git a/plugin.json b/plugin.json
index 7bb3bea..2385760 100644
--- a/plugin.json
+++ b/plugin.json
@@ -2,15 +2,20 @@
   "name": "plugin-sample-vite-svelte",
   "author": "frostime",
   "url": "https://github.com/siyuan-note/plugin-sample-vite-svelte",
-  "version": "0.2.8",
-  "minAppVersion": "2.10.14",
+  "version": "0.3.1",
+  "minAppVersion": "2.11.4",
   "backends": [
     "windows",
     "linux",
-    "darwin"
+    "darwin",
+    "ios",
+    "android"
   ],
   "frontends": [
     "desktop",
+    "mobile",
+    "browser-desktop",
+    "browser-mobile",
     "desktop-window"
   ],
   "displayName": {
diff --git a/src/index.ts b/src/index.ts
index 14ba467..d70da65 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -12,7 +12,8 @@ import {
     Protyle,
     openWindow,
     IOperation,
-    Constants
+    Constants,
+    openMobileFileById
 } from "siyuan";
 import "@/index.scss";
 
@@ -124,20 +125,34 @@ export default class PluginSample extends Plugin {
             resize() {
                 console.log(DOCK_TYPE + " resize");
             },
-            init() {
-                this.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">
-        ${this.data.text}
-    </div>
-</div>`;
+            update() {
+                console.log(DOCK_TYPE + " update");
+            },
+            init: (dock) => {
+                if (this.isMobile) {
+                    dock.element.innerHTML = `<div class="toolbar toolbar--border toolbar--dark">
+                    <svg class="toolbar__icon"><use xlink:href="#iconEmoji"></use></svg>
+                        <div class="toolbar__text">Custom Dock</div>
+                    </div>
+                    <div class="fn__flex-1 plugin-sample__custom-dock">
+                        ${dock.data.text}
+                    </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() {
                 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({
             icon: "iconScrollHoriz",