An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/11133
Vanessa4108dce01805
diff --git a/app/src/boot/globalEvent/command/global.ts b/app/src/boot/globalEvent/command/global.tsindex f6da27f47a..d87c4fafab 100644--- a/app/src/boot/globalEvent/command/global.ts+++ b/app/src/boot/globalEvent/command/global.ts@@ -17,6 +17,7 @@ import {getInstanceById} from "../../../layout/util";import {closeTabByType, getActiveTab, getDockByType, switchTabByIndex} from "../../../layout/tabUtil";import {openSetting} from "../../../config";import {Tab} from "../../../layout/Tab";+import {Files} from "../../../layout/dock/Files";/// #endifimport {App} from "../../../index";import {Constants} from "../../../constants";@@ -24,6 +25,33 @@ import {setReadOnly} from "../../../config/util/setReadOnly";import {lockScreen} from "../../../dialog/processSystem";import {newFile} from "../../../util/newFile";import {openCard} from "../../../card/openCard";+import {syncGuide} from "../../../sync/syncGuide";++const selectOpenTab = () => {+ /// #if MOBILE+ if (window.siyuan.mobile.editor?.protyle) {+ openDock("file");+ window.siyuan.mobile.files.selectItem(window.siyuan.mobile.editor.protyle.notebookId, window.siyuan.mobile.editor.protyle.path);+ }+ /// #else+ const dockFile = getDockByType("file");+ if (!dockFile) {+ return false;+ }+ const files = dockFile.data.file as Files;+ const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") ||+ document.querySelector("ul.layout-tab-bar > .item--focus");+ if (element) {+ const tab = getInstanceById(element.getAttribute("data-id")) as Tab;+ if (tab && tab.model instanceof Editor) {+ tab.model.editor.protyle.wysiwyg.element.blur();+ tab.model.editor.protyle.title.editElement.blur();+ files.selectItem(tab.model.editor.protyle.notebookId, tab.model.editor.protyle.path);+ }+ }+ dockFile.toggleModel("file", true);+ /// #endif+}export const globalCommand = (command: string, app: App) => {/// #if MOBILE@@ -261,6 +289,12 @@ export const globalCommand = (command: string, app: App) => {case "riffCard":openCard(app);return true;+ case "selectOpen1":+ selectOpenTab();+ return true;+ case "syncNow":+ syncGuide(app);+ return true;}return false;diff --git a/app/src/boot/globalEvent/command/panel.ts b/app/src/boot/globalEvent/command/panel.tsindex 3443ff1689..868d1cf4f8 100644--- a/app/src/boot/globalEvent/command/panel.ts+++ b/app/src/boot/globalEvent/command/panel.ts@@ -50,22 +50,17 @@ export const commandPanel = (app: App) => {let keys;/// #if MOBILEkeys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks",- "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch",- "lockScreen", "mainMenu", "move", "newFile", "recentDocs", "replace", "riffCard", "search",-- "selectOpen1",- "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",- "toggleDock", "toggleWin"];+ "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch", "lockScreen", "mainMenu", "move",+ "newFile", "recentDocs", "replace", "riffCard", "search", "selectOpen1", "syncNow"];/// #elsekeys = ["addToDatabase", "fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks","graphView", "globalGraph", "closeAll", "closeLeft", "closeOthers", "closeRight", "closeTab","closeUnmodified", "config", "dataHistory", "editReadonly", "enter", "enterBack", "globalSearch", "goBack","goForward", "goToEditTabNext", "goToEditTabPrev", "goToTab1", "goToTab2", "goToTab3", "goToTab4","goToTab5", "goToTab6", "goToTab7", "goToTab8", "goToTab9", "goToTabNext", "goToTabPrev", "lockScreen",- "mainMenu", "move", "newFile", "recentDocs", "replace", "riffCard", "search",+ "mainMenu", "move", "newFile", "recentDocs", "replace", "riffCard", "search", "selectOpen1", "syncNow",- "selectOpen1",- "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "syncNow", "tabToWindow",+ "splitLR", "splitMoveB", "splitMoveR", "splitTB", "stickSearch", "tabToWindow","toggleDock", "toggleWin"];/// #endifdiff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex 6dcc452571..9455a4eea8 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -74,6 +74,7 @@ import {commandPanel, execByCommand} from "./command/panel";import {filterHotkey} from "./commonHotkey";import {setReadOnly} from "../../config/util/setReadOnly";import {copyPNGByLink} from "../../menus/util";+import {globalCommand} from "./command/global";const switchDialogEvent = (app: App, event: MouseEvent) => {event.preventDefault();@@ -526,17 +527,7 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {if (matchHotKey(window.siyuan.config.keymap.general.selectOpen1.custom, event)) {event.preventDefault();- const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") ||- document.querySelector("ul.layout-tab-bar > .item--focus");- if (element) {- const tab = getInstanceById(element.getAttribute("data-id")) as Tab;- if (tab && tab.model instanceof Editor) {- tab.model.editor.protyle.wysiwyg.element.blur();- tab.model.editor.protyle.title.editElement.blur();- files.selectItem(tab.model.editor.protyle.notebookId, tab.model.editor.protyle.path);- }- }- dockFile.toggleModel("file", true);+ globalCommand("selectOpen1", app);return;}