Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve mobile app quitting https://github.com/siyuan-note/siyuan/issues/19111

Danield0018b5ba5ef
diff --git a/app/src/assets/template/mobile/index.tpl b/app/src/assets/template/mobile/index.tpl
index 8df714d599..ce0ba588b0 100644
--- a/app/src/assets/template/mobile/index.tpl
+++ b/app/src/assets/template/mobile/index.tpl
@@ -45,6 +45,9 @@
<svg data-type="sidebar-backlink-tab" class="toolbar__icon"><use xlink:href="#iconLink"></use></svg>
<svg data-type="sidebar-agent-tab" class="toolbar__icon fn__none"><use xlink:href="#iconSparkles"></use></svg>
</div>
+ <button id="sidebarRightExit" class="toolbar__button ft__error ariaLabel fn__none" type="button">
+ <svg><use xlink:href="#iconQuit"></use></svg>
+ </button>
<svg class="toolbar__icon"><use xlink:href="#iconLeft"></use></svg>
</div>
<div class="fn__flex-1 b3-list--mobile">
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 7137581ac1..f587572889 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -3,7 +3,7 @@ import {closeModel, closePanel} from "./closePanel";
import {getCurrentEditor, openMobileFileById} from "../editor";
import {openMobileOnboarding} from "../../onboarding";
import {validateName} from "../../editor/rename";
-import {getEventName, isDisabledFeature} from "../../protyle/util/compatibility";
+import {getEventName, isDisabledFeature, isInMobileApp} from "../../protyle/util/compatibility";
import {fetchPost} from "../../util/fetch";
import {setInlineStyle} from "../../util/assets";
import {renderSnippet} from "../../config/util/snippets";
@@ -44,6 +44,7 @@ import {
removeMobilePluginDock,
type IMobilePluginDockEntry,
} from "../dock/pluginDockState";
+import {exitSiYuan} from "../../dialog/processSystem";
const getDockTabElement = (type: string) => {
return document.querySelector(`[data-type="${CSS.escape(`sidebar-${type}-tab`)}"]`) as HTMLElement;
@@ -300,6 +301,15 @@ export const initFramework = async (app: App, isStart: boolean) => {
renderMobileSidePanelLayout(app);
initSidePanelTabs(app, sidebarElement);
initSidePanelTabs(app, sidebarRightElement);
+ const sidebarRightExitElement = document.getElementById("sidebarRightExit");
+ if (isInMobileApp() && sidebarRightExitElement) {
+ sidebarRightExitElement.classList.remove("fn__none");
+ sidebarRightExitElement.setAttribute("aria-label", window.siyuan.languages.safeQuit);
+ sidebarRightExitElement.addEventListener("click", (event) => {
+ event.stopPropagation();
+ void exitSiYuan();
+ });
+ }
window.addEventListener(MOBILE_SIDE_PANEL_CONFIG_CHANGE_EVENT, () => {
renderMobileSidePanelLayout(app);
updateOpenSidePanelDocks(app, [sidebarElement, sidebarRightElement]);