An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Improve mobile sidebar access https://github.com/siyuan-note/siyuan/issues/19581
Daniel7d29e31640d3
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex a7a1a41bb2..30fbcded13 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "السحب لفتح الأشرطة الجانبية",+ "mobileSidebarButtons": "إظهار أزرار الأشرطة الجانبية",+ "mobileSidebarAccessTip": "أبقِ طريقة واحدة على الأقل لفتح الأشرطة الجانبية مفعّلة",+ "openLeftSidebar": "فتح الشريط الجانبي الأيسر",+ "openRightSidebar": "فتح الشريط الجانبي الأيمن","listMindmapPlaceholder": "أدخل نصًا","listMindmapToMindmap": "التبديل إلى عرض الخريطة الذهنية","listMindmapToList": "التبديل إلى عرض القائمة",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex dc3af2cbb2..7083642652 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Seitenleisten durch Wischen öffnen",+ "mobileSidebarButtons": "Schaltflächen für Seitenleisten anzeigen",+ "mobileSidebarAccessTip": "Mindestens eine Möglichkeit zum Öffnen der Seitenleisten muss aktiviert bleiben",+ "openLeftSidebar": "Linke Seitenleiste öffnen",+ "openRightSidebar": "Rechte Seitenleiste öffnen","listMindmapPlaceholder": "Text eingeben","listMindmapToMindmap": "Zur Mindmap-Ansicht wechseln","listMindmapToList": "Zur Listenansicht wechseln",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex 042a1def1c..bead55a2eb 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Swipe to open sidebars",+ "mobileSidebarButtons": "Show sidebar buttons",+ "mobileSidebarAccessTip": "Keep at least one way to open sidebars enabled",+ "openLeftSidebar": "Open left sidebar",+ "openRightSidebar": "Open right sidebar","listMindmapPlaceholder": "Enter text","listMindmapToMindmap": "Switch to mind map view","listMindmapToList": "Switch to list view",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex a44905111b..b243722984 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Deslizar para abrir los paneles laterales",+ "mobileSidebarButtons": "Mostrar botones de los paneles laterales",+ "mobileSidebarAccessTip": "Mantén habilitada al menos una forma de abrir los paneles laterales",+ "openLeftSidebar": "Abrir panel lateral izquierdo",+ "openRightSidebar": "Abrir panel lateral derecho","listMindmapPlaceholder": "Introducir texto","listMindmapToMindmap": "Cambiar a vista de mapa mental","listMindmapToList": "Cambiar a vista de lista",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex ed980f2116..fae6fdff07 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Balayer pour ouvrir les panneaux latéraux",+ "mobileSidebarButtons": "Afficher les boutons des panneaux latéraux",+ "mobileSidebarAccessTip": "Gardez au moins un moyen d’ouvrir les panneaux latéraux activé",+ "openLeftSidebar": "Ouvrir le panneau latéral gauche",+ "openRightSidebar": "Ouvrir le panneau latéral droit","listMindmapPlaceholder": "Saisir du texte","listMindmapToMindmap": "Passer à la vue carte mentale","listMindmapToList": "Passer à la vue liste",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex a066ed304d..bfa431b8b6 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "החלקה לפתיחת סרגלי הצד",+ "mobileSidebarButtons": "הצגת כפתורי סרגלי הצד",+ "mobileSidebarAccessTip": "יש להשאיר לפחות דרך אחת לפתיחת סרגלי הצד פעילה",+ "openLeftSidebar": "פתיחת סרגל הצד השמאלי",+ "openRightSidebar": "פתיחת סרגל הצד הימני","listMindmapPlaceholder": "הזן טקסט","listMindmapToMindmap": "מעבר לתצוגת מפת חשיבה","listMindmapToList": "מעבר לתצוגת רשימה",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex 994e92560c..bd501bcad2 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "साइडबार खोलने के लिए स्वाइप करें",+ "mobileSidebarButtons": "साइडबार बटन दिखाएँ",+ "mobileSidebarAccessTip": "साइडबार खोलने का कम से कम एक तरीका सक्षम रखें",+ "openLeftSidebar": "बायाँ साइडबार खोलें",+ "openRightSidebar": "दायाँ साइडबार खोलें","listMindmapPlaceholder": "पाठ दर्ज करें","listMindmapToMindmap": "माइंड मैप दृश्य पर जाएँ","listMindmapToList": "सूची दृश्य पर जाएँ",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex 471dc40d6f..071c62e3ae 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Geser untuk membuka bilah samping",+ "mobileSidebarButtons": "Tampilkan tombol bilah samping",+ "mobileSidebarAccessTip": "Aktifkan setidaknya satu cara untuk membuka bilah samping",+ "openLeftSidebar": "Buka bilah samping kiri",+ "openRightSidebar": "Buka bilah samping kanan","listMindmapPlaceholder": "Masukkan teks","listMindmapToMindmap": "Beralih ke tampilan peta pikiran","listMindmapToList": "Beralih ke tampilan daftar",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex 76e9a6934d..0cceb2a360 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Scorri per aprire le barre laterali",+ "mobileSidebarButtons": "Mostra i pulsanti delle barre laterali",+ "mobileSidebarAccessTip": "Mantieni attivo almeno un modo per aprire le barre laterali",+ "openLeftSidebar": "Apri la barra laterale sinistra",+ "openRightSidebar": "Apri la barra laterale destra","listMindmapPlaceholder": "Inserisci testo","listMindmapToMindmap": "Passa alla vista mappa mentale","listMindmapToList": "Passa alla vista elenco",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex a3f29b341d..3b592428bb 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "スワイプでサイドバーを開く",+ "mobileSidebarButtons": "サイドバーボタンを表示",+ "mobileSidebarAccessTip": "サイドバーを開く方法を少なくとも1つ有効にしてください",+ "openLeftSidebar": "左サイドバーを開く",+ "openRightSidebar": "右サイドバーを開く","listMindmapPlaceholder": "テキストを入力","listMindmapToMindmap": "マインドマップ表示に切り替え","listMindmapToList": "リスト表示に切り替え",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex b00c8d5f83..faae2f698e 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "스와이프로 사이드바 열기",+ "mobileSidebarButtons": "사이드바 버튼 표시",+ "mobileSidebarAccessTip": "사이드바를 여는 방법을 하나 이상 활성화하세요",+ "openLeftSidebar": "왼쪽 사이드바 열기",+ "openRightSidebar": "오른쪽 사이드바 열기","listMindmapPlaceholder": "텍스트 입력","listMindmapToMindmap": "마인드맵 보기로 전환","listMindmapToList": "목록 보기로 전환",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex 1c54b9b698..4139af183f 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Vegen om zijbalken te openen",+ "mobileSidebarButtons": "Zijbalkknoppen tonen",+ "mobileSidebarAccessTip": "Houd minstens één manier om zijbalken te openen ingeschakeld",+ "openLeftSidebar": "Linkerzijbalk openen",+ "openRightSidebar": "Rechterzijbalk openen","listMindmapPlaceholder": "Voer tekst in","listMindmapToMindmap": "Naar mindmapweergave schakelen","listMindmapToList": "Naar lijstweergave schakelen",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 3258d44e58..eb707d0242 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Otwieraj panele boczne przesunięciem",+ "mobileSidebarButtons": "Pokaż przyciski paneli bocznych",+ "mobileSidebarAccessTip": "Pozostaw włączony co najmniej jeden sposób otwierania paneli bocznych",+ "openLeftSidebar": "Otwórz lewy panel boczny",+ "openRightSidebar": "Otwórz prawy panel boczny","listMindmapPlaceholder": "Wpisz tekst","listMindmapToMindmap": "Przełącz na widok mapy myśli","listMindmapToList": "Przełącz na widok listy",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex a0361fe520..4627a264d2 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Deslizar para abrir as barras laterais",+ "mobileSidebarButtons": "Mostrar botões das barras laterais",+ "mobileSidebarAccessTip": "Mantenha pelo menos uma forma de abrir as barras laterais ativada",+ "openLeftSidebar": "Abrir barra lateral esquerda",+ "openRightSidebar": "Abrir barra lateral direita","listMindmapPlaceholder": "Digite o texto","listMindmapToMindmap": "Alternar para a visualização de mapa mental","listMindmapToList": "Alternar para a visualização de lista",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex b5eee9372a..f28cd9bdab 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Открывать боковые панели свайпом",+ "mobileSidebarButtons": "Показывать кнопки боковых панелей",+ "mobileSidebarAccessTip": "Оставьте включённым хотя бы один способ открытия боковых панелей",+ "openLeftSidebar": "Открыть левую боковую панель",+ "openRightSidebar": "Открыть правую боковую панель","listMindmapPlaceholder": "Введите текст","listMindmapToMindmap": "Переключить на интеллект-карту","listMindmapToList": "Переключить на список",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex c23dad3a03..27fe6082f3 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Otvárať bočné panely potiahnutím",+ "mobileSidebarButtons": "Zobraziť tlačidlá bočných panelov",+ "mobileSidebarAccessTip": "Ponechajte zapnutý aspoň jeden spôsob otvárania bočných panelov",+ "openLeftSidebar": "Otvoriť ľavý bočný panel",+ "openRightSidebar": "Otvoriť pravý bočný panel","listMindmapPlaceholder": "Zadajte text","listMindmapToMindmap": "Prepnúť na zobrazenie myšlienkovej mapy","listMindmapToList": "Prepnúť na zobrazenie zoznamu",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex a53b899b2f..c0648ae64f 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Отварање бочних трака превлачењем",+ "mobileSidebarButtons": "Прикажи дугмад бочних трака",+ "mobileSidebarAccessTip": "Оставите укључен бар један начин отварања бочних трака",+ "openLeftSidebar": "Отвори леву бочну траку",+ "openRightSidebar": "Отвори десну бочну траку","listMindmapPlaceholder": "Унесите текст","listMindmapToMindmap": "Пређи на приказ мапе ума","listMindmapToList": "Пређи на приказ листе",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex d552e81741..b07102a607 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "ปัดเพื่อเปิดแถบด้านข้าง",+ "mobileSidebarButtons": "แสดงปุ่มแถบด้านข้าง",+ "mobileSidebarAccessTip": "เปิดใช้งานวิธีเปิดแถบด้านข้างไว้อย่างน้อยหนึ่งวิธี",+ "openLeftSidebar": "เปิดแถบด้านซ้าย",+ "openRightSidebar": "เปิดแถบด้านขวา","listMindmapPlaceholder": "ป้อนข้อความ","listMindmapToMindmap": "เปลี่ยนเป็นมุมมองแผนผังความคิด","listMindmapToList": "เปลี่ยนเป็นมุมมองรายการ",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex 9e443dcd03..050dbc544c 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Kenar çubuklarını kaydırarak aç",+ "mobileSidebarButtons": "Kenar çubuğu düğmelerini göster",+ "mobileSidebarAccessTip": "Kenar çubuklarını açmak için en az bir yöntemi etkin tutun",+ "openLeftSidebar": "Sol kenar çubuğunu aç",+ "openRightSidebar": "Sağ kenar çubuğunu aç","listMindmapPlaceholder": "Metin girin","listMindmapToMindmap": "Zihin haritası görünümüne geç","listMindmapToList": "Liste görünümüne geç",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex 2e1230d672..4dd64e74a0 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "Відкривати бічні панелі свайпом",+ "mobileSidebarButtons": "Показувати кнопки бічних панелей",+ "mobileSidebarAccessTip": "Залиште ввімкненим принаймні один спосіб відкриття бічних панелей",+ "openLeftSidebar": "Відкрити ліву бічну панель",+ "openRightSidebar": "Відкрити праву бічну панель","listMindmapPlaceholder": "Введіть текст","listMindmapToMindmap": "Перемкнути на мапу думок","listMindmapToList": "Перемкнути на список",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex 6141b85880..9c9f50c357 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "滑动打开侧栏",+ "mobileSidebarButtons": "显示侧栏按钮",+ "mobileSidebarAccessTip": "至少保留一种打开侧栏的方式",+ "openLeftSidebar": "打开左侧栏",+ "openRightSidebar": "打开右侧栏","listMindmapPlaceholder": "输入文字","listMindmapToMindmap": "切换为脑图视图","listMindmapToList": "切换为列表视图",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 25744e3969..6fe7bc1d8a 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,9 @@{+ "mobileSidebarSwipe": "滑動開啟側欄",+ "mobileSidebarButtons": "顯示側欄按鈕",+ "mobileSidebarAccessTip": "至少保留一種開啟側欄的方式",+ "openLeftSidebar": "開啟左側欄",+ "openRightSidebar": "開啟右側欄","listMindmapPlaceholder": "輸入文字","listMindmapToMindmap": "切換為心智圖檢視","listMindmapToList": "切換為清單檢視",diff --git a/app/src/assets/scss/main/_mobile.scss b/app/src/assets/scss/main/_mobile.scssindex dcd28f5b41..aa269287f2 100644--- a/app/src/assets/scss/main/_mobile.scss+++ b/app/src/assets/scss/main/_mobile.scss@@ -422,7 +422,7 @@ body.mobile-keyboard--open {box-sizing: border-box;height: var(--mobile-topbar-height);min-height: var(--mobile-topbar-height);- padding: 0 max(4px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));+ padding: 0 max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left));transform: translate3d(0, var(--mobile-bar-translate-y, 0), 0);will-change: transform;}diff --git a/app/src/assets/template/mobile/index.tpl b/app/src/assets/template/mobile/index.tplindex 3f414f20ec..82f3bd5140 100644--- a/app/src/assets/template/mobile/index.tpl+++ b/app/src/assets/template/mobile/index.tpl@@ -13,11 +13,17 @@</div><div class="mobile-safe-area"></div><div id="mobileTopBar" class="toolbar toolbar--border mobile-topbar">+ <button id="toolbarSidebarLeft" class="toolbar__button fn__none" type="button">+ <svg><use xlink:href="#iconPanelLeft"></use></svg>+ </button><input class="toolbar__title fn__hidden" id="toolbarName" autocomplete="off" enterkeyhint="next"><span class="toolbar__title toolbar__title--readonly fn__hidden fn__none" id="toolbarNameReadonly"></span><button id="toolbarSync" class="toolbar__button toolbar__icon-deactivate fn__none" type="button"><svg><use xlink:href="#iconCloudSucc"></use></svg></button>+ <button id="toolbarSidebarRight" class="toolbar__button fn__none" type="button">+ <svg><use xlink:href="#iconPanelRight"></use></svg>+ </button></div><div id="editor" class="fn__none fn__flex-1"></div><div id="empty" class="b3-list--mobile"></div>diff --git a/app/src/config/tabs/appearanceTab.test.ts b/app/src/config/tabs/appearanceTab.test.tsindex 6f5cc8417e..36f2012cd7 100644--- a/app/src/config/tabs/appearanceTab.test.ts+++ b/app/src/config/tabs/appearanceTab.test.ts@@ -47,5 +47,6 @@ for (const mobile of [true, false]) {assert.equal(mounted, true);assert.equal(slots.some(item => item.key === "mobileBottomBar"), mobile);assert.equal(slots.some(item => item.key === "mobileBarsAutoHide"), mobile);+ assert.equal(slots.some(item => item.key === "mobileSidebarAccess"), mobile);});}diff --git a/app/src/config/tabs/appearanceTab.ts b/app/src/config/tabs/appearanceTab.tsindex 4bb23668cb..794d319cd0 100644--- a/app/src/config/tabs/appearanceTab.ts+++ b/app/src/config/tabs/appearanceTab.ts@@ -50,6 +50,7 @@ import {/// #if MOBILEimport {genMobileBottomBarSettingHTML, mountMobileBottomBarSetting} from "../../mobile/util/mobileBottomBar";import {genMobileSidePanelSettingHTML, mountMobileSidePanelSetting} from "../../mobile/util/mobileSidePanelSetting";+import {genSidebarSettingHTML, mountSidebarSetting} from "../../mobile/util/sidebarSetting";import {genMobileBarsSettingHTML, mountMobileBarsSetting} from "../../mobile/util/mobileBarsSetting";/// #endifimport {genEntryVisibilityHtml, mountEntryVisibility} from "../entryVisibility/ui";@@ -905,6 +906,12 @@ const registerAppearanceControlsGroup = (tab: SettingTabBuilder) => {const group = tab.group("controls", window.siyuan.languages.configGroupControls);/// #if MOBILE+ group.slot({+ key: "mobileSidebarAccess",+ keywords: [window.siyuan.languages.mobileSidebarSwipe, window.siyuan.languages.mobileSidebarButtons],+ html: genSidebarSettingHTML,+ afterMount: mountSidebarSetting,+ });group.slot({key: "mobileBarsAutoHide",keywords: [window.siyuan.languages.mobileBarsAutoHide, window.siyuan.languages.mobileBarsAutoHideTip],diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex 3f2e9ef5f2..0a46c50d9e 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -26,6 +26,7 @@ import {setTitle} from "../../util/processTitle";import {activateQueuedAVLocate, queueAVLocateRequest} from "../../protyle/render/av/locate";import {MobileTabs} from "../tabs/MobileTabs";import {initMobileBottomBar} from "./mobileBottomBar";+import {initSidebarButtons, updateSidebarButtons} from "./sidebarButtons";import {initMobileBars} from "./mobileBars";import {openDock} from "../dock/util";import {@@ -303,6 +304,7 @@ export const initFramework = async (app: App, isStart: boolean) => {renderMobileSidePanelLayout(app);initSidePanelTabs(app, sidebarElement);initSidePanelTabs(app, sidebarRightElement);+ initSidebarButtons();const sidebarRightExitElement = document.getElementById("sidebarRightExit");if (isInMobileApp() && sidebarRightExitElement) {sidebarRightExitElement.classList.remove("fn__none");@@ -315,10 +317,12 @@ export const initFramework = async (app: App, isStart: boolean) => {window.addEventListener(MOBILE_SIDE_PANEL_CONFIG_CHANGE_EVENT, () => {renderMobileSidePanelLayout(app);updateOpenSidePanelDocks(app, [sidebarElement, sidebarRightElement]);+ updateSidebarButtons();});window.addEventListener(MOBILE_PLUGIN_DOCKS_CHANGE_EVENT, () => {renderMobileSidePanelLayout(app);updateOpenSidePanelDocks(app, [sidebarElement, sidebarRightElement]);+ updateSidebarButtons();});await Promise.all([inlineStyleReady, snippetReady]);window.siyuan.mobile.docks.file = new MobileFiles(app, getDockContentElement("file"));diff --git a/app/src/mobile/util/mobileBarsConfig.test.ts b/app/src/mobile/util/mobileBarsConfig.test.tsnew file mode 100644index 0000000000..0b9b25fab5--- /dev/null+++ b/app/src/mobile/util/mobileBarsConfig.test.ts@@ -0,0 +1,14 @@+import {test} from "node:test";+import * as assert from "node:assert/strict";+import {resolveMobileSidebarConfig} from "./mobileBarsConfig";++test("sidebar access defaults and stored configurations always retain an entry", () => {+ assert.deepEqual(resolveMobileSidebarConfig(), {sidebarSwipe: true, sidebarButtons: false});+ assert.deepEqual(resolveMobileSidebarConfig({sidebarButtons: true}), {sidebarSwipe: true, sidebarButtons: true});+ assert.deepEqual(resolveMobileSidebarConfig({sidebarSwipe: false}), {sidebarSwipe: false, sidebarButtons: true});+ assert.deepEqual(resolveMobileSidebarConfig({sidebarButtons: false}), {sidebarSwipe: true, sidebarButtons: false});+ assert.deepEqual(resolveMobileSidebarConfig({sidebarSwipe: false, sidebarButtons: false}), {+ sidebarSwipe: false,+ sidebarButtons: true,+ });+});diff --git a/app/src/mobile/util/mobileBarsConfig.ts b/app/src/mobile/util/mobileBarsConfig.tsindex 60fc5398f7..30f8c0b184 100644--- a/app/src/mobile/util/mobileBarsConfig.ts+++ b/app/src/mobile/util/mobileBarsConfig.ts@@ -2,3 +2,11 @@ export const MOBILE_BARS_CONFIG_KEY = "local-mobile-bars";export const isMobileBarsAutoHide = () =>window.siyuan.storage[MOBILE_BARS_CONFIG_KEY]?.autoHide !== false;++export const resolveMobileSidebarConfig = (config: {sidebarSwipe?: boolean, sidebarButtons?: boolean} = {}) => ({+ sidebarSwipe: config.sidebarSwipe !== false,+ sidebarButtons: config.sidebarButtons === true || config.sidebarSwipe === false,+});++export const getMobileSidebarConfig = () =>+ resolveMobileSidebarConfig(window.siyuan.storage[MOBILE_BARS_CONFIG_KEY]);diff --git a/app/src/mobile/util/mobileBarsSetting.ts b/app/src/mobile/util/mobileBarsSetting.tsindex 54a35ba433..05b9904bb6 100644--- a/app/src/mobile/util/mobileBarsSetting.ts+++ b/app/src/mobile/util/mobileBarsSetting.ts@@ -13,7 +13,7 @@ export const genMobileBarsSettingHTML = () => `<label class="b3-label fn__flex cexport const mountMobileBarsSetting = (root: HTMLElement) => {root.querySelector<HTMLInputElement>("#mobileBarsAutoHide")?.addEventListener("change", (event) => {- const config = {autoHide: (event.target as HTMLInputElement).checked};+ const config = {...window.siyuan.storage[MOBILE_BARS_CONFIG_KEY], autoHide: (event.target as HTMLInputElement).checked};window.siyuan.storage[MOBILE_BARS_CONFIG_KEY] = config;setStorageVal(MOBILE_BARS_CONFIG_KEY, config);showMobileBars();diff --git a/app/src/mobile/util/mobileBarsState.test.ts b/app/src/mobile/util/mobileBarsState.test.tsindex 817fd10019..af4f80eaf9 100644--- a/app/src/mobile/util/mobileBarsState.test.ts+++ b/app/src/mobile/util/mobileBarsState.test.ts@@ -96,17 +96,18 @@ describe("mobile bars state", () => {assert.equal(getVisibility(state).bottomBarVisible, true);});- it("keeps the hidden reading state while editing", () => {+ it("restores hidden reading bars when editing so sidebar buttons remain accessible", () => {let state = createMobileBarsState(100);state = update(state, {type: "set-reading-bars", visible: false});state = update(state, {type: "set-editing", active: true, scrollTop: 100});state = update(state, {type: "scroll", scrollTop: 180});- assert.equal(state.readingBarsOffset, 30);+ assert.equal(state.readingBarsOffset, 0);+ assert.equal(getVisibility(state).topbarVisible, true);state = update(state, {type: "set-editing", active: false, scrollTop: 180});assert.deepEqual(getVisibility(state), {- topbarVisible: false,- bottomBarVisible: false,+ topbarVisible: true,+ bottomBarVisible: true,editingBarVisible: false,scrollPaused: false,});diff --git a/app/src/mobile/util/mobileBarsState.ts b/app/src/mobile/util/mobileBarsState.tsindex a36263a81c..50a01c8d9c 100644--- a/app/src/mobile/util/mobileBarsState.ts+++ b/app/src/mobile/util/mobileBarsState.ts@@ -111,6 +111,7 @@ export const reduceMobileBarsState = (return {...resetScrollTracking(state, action.scrollTop),editing: action.active,+ readingBarsOffset: action.active ? 0 : state.readingBarsOffset,};}diff --git a/app/src/mobile/util/mobileTopBar.test.ts b/app/src/mobile/util/mobileTopBar.test.tsindex a5e1cbbf18..24679d2ad3 100644--- a/app/src/mobile/util/mobileTopBar.test.ts+++ b/app/src/mobile/util/mobileTopBar.test.ts@@ -58,17 +58,23 @@ describe("mobile top bar layout", () => {const toolbarName = new TestElement();const toolbarNameReadonly = new TestElement();const toolbarSync = new TestElement();+ const toolbarSidebarLeft = new TestElement();+ const toolbarSidebarRight = new TestElement();const elements = new Map<string, TestElement>([["mobileTopBar", topBarElement],["editor", editorElement],["toolbarName", toolbarName],["toolbarNameReadonly", toolbarNameReadonly],["toolbarSync", toolbarSync],+ ["toolbarSidebarLeft", toolbarSidebarLeft],+ ["toolbarSidebarRight", toolbarSidebarRight],]);editorElement.breadcrumbSpace = breadcrumbSpace;+ topBarElement.appendChild(toolbarSidebarLeft);topBarElement.appendChild(toolbarName);topBarElement.appendChild(toolbarNameReadonly);topBarElement.appendChild(toolbarSync);+ topBarElement.appendChild(toolbarSidebarRight);let landscape = true;Object.defineProperty(globalThis, "document", {@@ -89,31 +95,31 @@ describe("mobile top bar layout", () => {updateMobileTopBarLayout();assert.equal(bodyElement.classList.contains("mobile-topbar--merged"), true);assert.equal(breadcrumbSpace.classList.contains("protyle-breadcrumb__space--mobile-title"), true);- assert.deepEqual(breadcrumbSpace.children, [toolbarName, toolbarNameReadonly, toolbarSync]);+ assert.deepEqual(breadcrumbSpace.children, [toolbarSidebarLeft, toolbarName, toolbarNameReadonly, toolbarSync, toolbarSidebarRight]);restoreMobileTopBarLayout();assert.equal(bodyElement.classList.contains("mobile-topbar--merged"), false);assert.equal(breadcrumbSpace.classList.contains("protyle-breadcrumb__space--mobile-title"), false);- assert.deepEqual(topBarElement.children, [toolbarName, toolbarNameReadonly, toolbarSync]);+ assert.deepEqual(topBarElement.children, [toolbarSidebarLeft, toolbarName, toolbarNameReadonly, toolbarSync, toolbarSidebarRight]);const replacementBreadcrumbSpace = new TestElement();editorElement.breadcrumbSpace = replacementBreadcrumbSpace;updateMobileTopBarLayout();assert.equal(bodyElement.classList.contains("mobile-topbar--merged"), true);assert.equal(replacementBreadcrumbSpace.classList.contains("protyle-breadcrumb__space--mobile-title"), true);- assert.deepEqual(replacementBreadcrumbSpace.children, [toolbarName, toolbarNameReadonly, toolbarSync]);+ assert.deepEqual(replacementBreadcrumbSpace.children, [toolbarSidebarLeft, toolbarName, toolbarNameReadonly, toolbarSync, toolbarSidebarRight]);landscape = false;updateMobileTopBarLayout();assert.equal(bodyElement.classList.contains("mobile-topbar--merged"), false);assert.equal(replacementBreadcrumbSpace.classList.contains("protyle-breadcrumb__space--mobile-title"), false);- assert.deepEqual(topBarElement.children, [toolbarName, toolbarNameReadonly, toolbarSync]);+ assert.deepEqual(topBarElement.children, [toolbarSidebarLeft, toolbarName, toolbarNameReadonly, toolbarSync, toolbarSidebarRight]);landscape = true;editorElement.classList.add("fn__none");updateMobileTopBarLayout();assert.equal(bodyElement.classList.contains("mobile-topbar--merged"), false);- assert.deepEqual(topBarElement.children, [toolbarName, toolbarNameReadonly, toolbarSync]);+ assert.deepEqual(topBarElement.children, [toolbarSidebarLeft, toolbarName, toolbarNameReadonly, toolbarSync, toolbarSidebarRight]);} finally {Object.defineProperty(globalThis, "document", {configurable: true, value: originalDocument});Object.defineProperty(globalThis, "window", {configurable: true, value: originalWindow});diff --git a/app/src/mobile/util/mobileTopBar.ts b/app/src/mobile/util/mobileTopBar.tsindex e863c28316..0e114b2128 100644--- a/app/src/mobile/util/mobileTopBar.ts+++ b/app/src/mobile/util/mobileTopBar.ts@@ -1,4 +1,4 @@-const MOBILE_TOP_BAR_ELEMENT_IDS = ["toolbarName", "toolbarNameReadonly", "toolbarSync"] as const;+const MOBILE_TOP_BAR_ELEMENT_IDS = ["toolbarSidebarLeft", "toolbarName", "toolbarNameReadonly", "toolbarSync", "toolbarSidebarRight"] as const;let topBarElements: HTMLElement[];let mergedBreadcrumbSpace: HTMLElement | undefined;diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.tsindex 88d9060e9c..ccde4560d7 100644--- a/app/src/mobile/util/setEmpty.ts+++ b/app/src/mobile/util/setEmpty.ts@@ -20,7 +20,7 @@ export const setEmpty = (app: App) => {}setTitle("", true);clearMobileBarsScroll();- document.getElementById("mobileTopBar").classList.add("fn__none");+ document.getElementById("mobileTopBar").classList.remove("fn__none");document.getElementById("toolbarName").classList.add("fn__hidden");document.getElementById("toolbarNameReadonly").classList.add("fn__hidden");document.getElementById("editor").classList.add("fn__none");diff --git a/app/src/mobile/util/sidebar.test.ts b/app/src/mobile/util/sidebar.test.tsnew file mode 100644index 0000000000..61a2d1c16a--- /dev/null+++ b/app/src/mobile/util/sidebar.test.ts@@ -0,0 +1,60 @@+import {test} from "node:test";+import * as assert from "node:assert/strict";+import {readFileSync} from "node:fs";+import {resolve} from "node:path";+import {runInNewContext} from "node:vm";+import {ModuleKind, transpileModule} from "typescript";++test("sidebar opening restores the active dock, falls back to visible docks and ignores empty sides", () => {+ const tab = (type: string, active: boolean, hidden = false) => ({+ dataset: {type: `sidebar-${type}-tab`},+ classList: {contains: (name: string) => name === "fn__none" ? hidden : active},+ });+ let tabs = [tab("file", false), tab("bookmark", true)];+ const rendered: string[] = [];+ const toolbar = {querySelectorAll: () => tabs, dispatchEvent: (event: {detail: string}) => rendered.push(event.detail)};+ const style = () => ({transform: "", zIndex: "", removeProperty() { this.transform = ""; }});+ const left = {style: style(), querySelector: () => toolbar};+ const right = {style: style()};+ const mask = {style: {zIndex: "", opacity: ""}};+ let closed = 0;+ let blurred = 0;+ let cellEditorsClosed = 0;+ const moduleExports: {openSidebar?: (side: string) => void} = {};+ const source = readFileSync(resolve(process.cwd(), "src/mobile/util/sidebar.ts"), "utf8");+ const code = transpileModule(source, {compilerOptions: {module: ModuleKind.CommonJS}}).outputText;+ runInNewContext(code, {+ exports: moduleExports,+ document: {getElementById: (id: string) => id === "sidebar" ? left : right},+ window: {siyuan: {zIndex: 10}},+ CustomEvent: class {+ detail: string;+ constructor(_type: string, options: {detail: string}) { this.detail = options.detail; }+ },+ require: (name: string) => {+ if (name === "./keyboardToolbar") {+ return {activeBlur: () => blurred++};+ }+ if (name === "../../protyle/render/av/cellEditor") {+ return {closeAVCellEditor: () => cellEditorsClosed++};+ }+ return {closePanel: () => closed++, showPanelMask: () => mask};+ },+ });+ right.style.transform = "translateX(0px)";+ moduleExports.openSidebar("left");+ assert.deepEqual(rendered, ["bookmark"]);+ assert.equal(left.style.transform, "translateX(0px)");+ assert.equal(right.style.transform, "");+ assert.ok(Number(left.style.zIndex) > Number(mask.style.zIndex));+ assert.equal(mask.style.opacity, "1");+ tabs = [tab("file", false), tab("bookmark", true, true)];+ moduleExports.openSidebar("left");+ assert.deepEqual(rendered, ["bookmark", "file"]);+ tabs = [tab("file", true, true)];+ moduleExports.openSidebar("left");+ assert.equal(closed, 2);+ assert.equal(blurred, 2);+ assert.equal(cellEditorsClosed, 2);+ assert.equal(rendered.length, 2);+});diff --git a/app/src/mobile/util/sidebar.ts b/app/src/mobile/util/sidebar.tsnew file mode 100644index 0000000000..437404873a--- /dev/null+++ b/app/src/mobile/util/sidebar.ts@@ -0,0 +1,59 @@+import {activeBlur} from "./keyboardToolbar";+import {closeAVCellEditor} from "../../protyle/render/av/cellEditor";+import {closePanel, showPanelMask} from "./closePanel";+import type {MobileSidebarSide} from "./touchPanelGesture";++export const getSidebarElement = (side: MobileSidebarSide) => {+ return document.getElementById(side === "left" ? "sidebar" : "sidebarRight");+};++export const getSidebarDock = (sidebarElement: HTMLElement | null) => {+ if (!sidebarElement) {+ return;+ }+ const toolbarElement = sidebarElement.querySelector(".toolbar--border");+ const tabElements = Array.from(toolbarElement?.querySelectorAll<HTMLElement>("[data-type]") || []);+ const activeElement = tabElements.find(item =>+ item.classList.contains("toolbar__icon--active") && !item.classList.contains("fn__none")) ||+ tabElements.find(item => !item.classList.contains("fn__none"));+ const type = activeElement?.dataset.type?.replace(/^sidebar-/, "").replace(/-tab$/, "");+ if (toolbarElement && type) {+ return {toolbarElement, type};+ }+};++export const popSidebar = (side: MobileSidebarSide, render = true) => {+ activeBlur();+ const sidebarElement = getSidebarElement(side);+ if (!sidebarElement) {+ return;+ }+ let dock: ReturnType<typeof getSidebarDock>;+ if (render) {+ dock = getSidebarDock(sidebarElement);+ if (!dock) {+ sidebarElement.style.removeProperty("transform");+ closePanel();+ return;+ }+ }+ closeAVCellEditor();+ const otherSidebar = side === "left" ? "right" : "left";+ getSidebarElement(otherSidebar)?.style.removeProperty("transform");+ sidebarElement.style.transform = "translateX(0px)";+ if (render) {+ dock.toolbarElement.dispatchEvent(new CustomEvent("click", {detail: dock.type}));+ }+};++export const openSidebar = (side: MobileSidebarSide) => {+ if (!getSidebarDock(getSidebarElement(side))) {+ return;+ }+ closePanel();+ const mask = showPanelMask();+ mask.style.zIndex = (++window.siyuan.zIndex).toString();+ mask.style.opacity = "1";+ getSidebarElement(side).style.zIndex = (++window.siyuan.zIndex).toString();+ popSidebar(side);+};diff --git a/app/src/mobile/util/sidebarButtons.ts b/app/src/mobile/util/sidebarButtons.tsnew file mode 100644index 0000000000..98d57b7432--- /dev/null+++ b/app/src/mobile/util/sidebarButtons.ts@@ -0,0 +1,24 @@+import {getMobileSidebarConfig} from "./mobileBarsConfig";+import {getSidebarDock, getSidebarElement, openSidebar} from "./sidebar";+import type {MobileSidebarSide} from "./touchPanelGesture";++const sides: MobileSidebarSide[] = ["left", "right"];+const getButton = (side: MobileSidebarSide) =>+ document.getElementById(side === "left" ? "toolbarSidebarLeft" : "toolbarSidebarRight");++export const updateSidebarButtons = () => {+ const {sidebarButtons} = getMobileSidebarConfig();+ sides.forEach(side => {+ getButton(side)?.classList.toggle("fn__none", !sidebarButtons || !getSidebarDock(getSidebarElement(side)));+ });+};++export const initSidebarButtons = () => {+ sides.forEach(side => {+ const button = getButton(side);+ button.setAttribute("aria-label", side === "left" ?+ window.siyuan.languages.openLeftSidebar : window.siyuan.languages.openRightSidebar);+ button.addEventListener("click", () => openSidebar(side));+ });+ updateSidebarButtons();+};diff --git a/app/src/mobile/util/sidebarSetting.test.ts b/app/src/mobile/util/sidebarSetting.test.tsnew file mode 100644index 0000000000..3ba98e22e1--- /dev/null+++ b/app/src/mobile/util/sidebarSetting.test.ts@@ -0,0 +1,63 @@+import {test} from "node:test";+import * as assert from "node:assert/strict";+import {readFileSync} from "node:fs";+import {resolve} from "node:path";+import {runInNewContext} from "node:vm";+import {ModuleKind, transpileModule} from "typescript";+import {MOBILE_BARS_CONFIG_KEY, resolveMobileSidebarConfig} from "./mobileBarsConfig";++test("sidebar switches retain one entry and preserve unrelated local settings", () => {+ const storage = {[MOBILE_BARS_CONFIG_KEY]: {autoHide: false, sidebarSwipe: true, sidebarButtons: true}};+ const inputs = new Map(["sidebarSwipe", "sidebarButtons"].map(key => [key, {+ checked: false,+ disabled: false,+ change: undefined as (() => void) | undefined,+ addEventListener(_type: string, listener: (event: unknown) => void) {+ this.change = () => listener({target: this});+ },+ }]));+ let saves = 0;+ let updates = 0;+ const moduleExports: {mountSidebarSetting?: (root: unknown) => void} = {};+ const source = readFileSync(resolve(process.cwd(), "src/mobile/util/sidebarSetting.ts"), "utf8");+ const code = transpileModule(source, {compilerOptions: {module: ModuleKind.CommonJS}}).outputText;+ runInNewContext(code, {+ exports: moduleExports,+ window: {siyuan: {storage, config: {readonly: false}, isPublish: false}},+ require: (name: string) => {+ if (name === "./mobileBarsConfig") {+ return {MOBILE_BARS_CONFIG_KEY, getMobileSidebarConfig: () => resolveMobileSidebarConfig(storage[MOBILE_BARS_CONFIG_KEY])};+ }+ if (name === "../../protyle/util/compatibility") {+ return {setStorageVal: () => saves++};+ }+ if (name === "./sidebarButtons") {+ return {updateSidebarButtons: () => updates++};+ }+ return {showMobileBars: () => {}};+ },+ });+ moduleExports.mountSidebarSetting({querySelector: (selector: string) => inputs.get(selector.split('"')[1])});+ const swipe = inputs.get("sidebarSwipe");+ const buttons = inputs.get("sidebarButtons");+ assert.equal(swipe.checked, true);+ assert.equal(buttons.checked, true);+ swipe.checked = false;+ swipe.change();+ assert.equal(buttons.disabled, true);+ assert.equal(swipe.disabled, false);+ assert.equal(storage[MOBILE_BARS_CONFIG_KEY].autoHide, false);+ buttons.checked = false;+ buttons.change();+ assert.equal(buttons.checked, true);+ assert.equal(saves, 1);+ swipe.checked = true;+ swipe.change();+ assert.equal(buttons.disabled, false);+ buttons.checked = false;+ buttons.change();+ assert.equal(swipe.disabled, true);+ assert.equal(swipe.checked, true);+ assert.equal(saves, 3);+ assert.equal(updates, 3);+});diff --git a/app/src/mobile/util/sidebarSetting.ts b/app/src/mobile/util/sidebarSetting.tsnew file mode 100644index 0000000000..9ee6518364--- /dev/null+++ b/app/src/mobile/util/sidebarSetting.ts@@ -0,0 +1,47 @@+import {setStorageVal} from "../../protyle/util/compatibility";+import {escapeHtml} from "../../util/escape";+import {getMobileSidebarConfig, MOBILE_BARS_CONFIG_KEY} from "./mobileBarsConfig";+import {updateSidebarButtons} from "./sidebarButtons";+import {showMobileBars} from "./mobileBars";++const settings = ["sidebarSwipe", "sidebarButtons"] as const;++export const genSidebarSettingHTML = () => settings.map(key => `<label class="b3-label fn__flex config-item">+ <div class="fn__flex-1 config-item__main">+ <div class="config-name">${escapeHtml(key === "sidebarSwipe" ? window.siyuan.languages.mobileSidebarSwipe : window.siyuan.languages.mobileSidebarButtons)}</div>+ <div class="b3-label__text">${escapeHtml(window.siyuan.languages.mobileSidebarAccessTip)}</div>+ </div>+ <input data-sidebar-setting="${key}" type="checkbox" class="b3-switch fn__flex-center">+</label>`).join("");++export const mountSidebarSetting = (root: HTMLElement) => {+ const render = () => {+ const config = getMobileSidebarConfig();+ settings.forEach(key => {+ const input = root.querySelector<HTMLInputElement>(`[data-sidebar-setting="${key}"]`);+ if (!input) {+ return;+ }+ input.checked = config[key];+ input.disabled = window.siyuan.config.readonly || window.siyuan.isPublish ||+ !config[key === "sidebarSwipe" ? "sidebarButtons" : "sidebarSwipe"];+ });+ };+ settings.forEach(key => {+ root.querySelector<HTMLInputElement>(`[data-sidebar-setting="${key}"]`)?.addEventListener("change", event => {+ const current = getMobileSidebarConfig();+ const checked = (event.target as HTMLInputElement).checked;+ if (!checked && !current[key === "sidebarSwipe" ? "sidebarButtons" : "sidebarSwipe"]) {+ render();+ return;+ }+ const config = {...window.siyuan.storage[MOBILE_BARS_CONFIG_KEY], ...current, [key]: checked};+ window.siyuan.storage[MOBILE_BARS_CONFIG_KEY] = config;+ setStorageVal(MOBILE_BARS_CONFIG_KEY, config);+ render();+ updateSidebarButtons();+ showMobileBars();+ });+ });+ render();+};diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.tsindex e5d457ebac..86babeee1e 100644--- a/app/src/mobile/util/touch.ts+++ b/app/src/mobile/util/touch.ts@@ -1,3 +1,5 @@+import {getSidebarDock, getSidebarElement, popSidebar} from "./sidebar";+import {getMobileSidebarConfig} from "./mobileBarsConfig";import {hasClosestBlock,hasClosestByAttribute,@@ -21,7 +23,6 @@ import {stripSemanticMarkersFromRangeText} from "../../protyle/util/inlineElemenimport {getTouchAxis, shouldStartLongPressMultiSelect} from "./touchGesture";import {getMobileBlockSelectionElement} from "./blockSelection";import {updateMultiSelectToolbar} from "./multiSelectToolbar";-import {closeAVCellEditor} from "../../protyle/render/av/cellEditor";import {getOpeningSidebar,getOpenSidebarReleaseAction,@@ -49,10 +50,6 @@ let longPressTimer: number;let longPressBlockElement: HTMLElement;let longPressTouchRange: Range;-const getSidebarElement = (side: MobileSidebarSide) => {- return document.getElementById(side === "left" ? "sidebar" : "sidebarRight");-};-const sideMaskElement = document.querySelector(".side-mask") as HTMLElement;const updateSidebarSwipeState = (activeSide?: MobileSidebarSide) => {@@ -71,45 +68,6 @@ const getTargetSidebar = (target: HTMLElement): MobileSidebarSide | undefined =>}};-const getSidebarDock = (sidebarElement: HTMLElement | null) => {- if (!sidebarElement) {- return;- }- const toolbarElement = sidebarElement.querySelector(".toolbar--border");- const tabElements = Array.from(toolbarElement?.querySelectorAll<HTMLElement>("[data-type]") || []);- const activeElement = tabElements.find(item =>- item.classList.contains("toolbar__icon--active") && !item.classList.contains("fn__none")) ||- tabElements.find(item => !item.classList.contains("fn__none"));- const type = activeElement?.dataset.type?.replace(/^sidebar-/, "").replace(/-tab$/, "");- if (toolbarElement && type) {- return {toolbarElement, type};- }-};--const popSidebar = (side: MobileSidebarSide, render = true) => {- activeBlur();- const sidebarElement = getSidebarElement(side);- if (!sidebarElement) {- return;- }- let dock: ReturnType<typeof getSidebarDock>;- if (render) {- dock = getSidebarDock(sidebarElement);- if (!dock) {- sidebarElement.style.removeProperty("transform");- closePanel();- return;- }- }- closeAVCellEditor();- const otherSidebar = side === "left" ? "right" : "left";- getSidebarElement(otherSidebar)?.style.removeProperty("transform");- sidebarElement.style.transform = "translateX(0px)";- if (render) {- dock.toolbarElement.dispatchEvent(new CustomEvent("click", {detail: dock.type}));- }-};-// 清除长按进入多选的定时器const clearLongPress = () => {if (longPressTimer) {@@ -323,6 +281,9 @@ export const handleTouchEnd = (event: TouchEvent) => {}return;}+ if (!getMobileSidebarConfig().sidebarSwipe) {+ return;+ }if (!scrollEnable || !isXScroll) {closePanel();return;@@ -529,6 +490,9 @@ export const handleTouchMove = (event: TouchEvent) => {if (hasClosestByAttribute(target, "id", "menu", true)) {return;}+ if (!getTargetSidebar(target) && !getMobileSidebarConfig().sidebarSwipe) {+ return;+ }if (hasClosestByClassName(target, "agent-chat__messages", true)) {// 消息内容可沿手势方向横向滚动时,本次手势持续交给内容,抵达边缘后可再次滑动返回。if (scrollBlock || isHorizontalScrollable(target, xDiff)) {