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: Add shortcut keys for splitting the tab Fix https://github.com/siyuan-note/siyuan/issues/9470
Vanessac7c23cc1ea9a
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex 59f4850057..8faa3c2e8c 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -10,7 +10,7 @@ import {import {newFile} from "../../util/newFile";import {Constants} from "../../constants";import {openSetting} from "../../config";-import {getDockByType, getInstanceById} from "../../layout/util";+import {copyTab, getDockByType, getInstanceById, resizeTabs} from "../../layout/util";import {Tab} from "../../layout/Tab";import {Editor} from "../../editor";import {setEditMode} from "../../protyle/util/setEditMode";@@ -1329,6 +1329,31 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {return;}+ if ((matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event) ||+ matchHotKey(window.siyuan.config.keymap.general.splitMoveR.custom, event) ||+ matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event) ||+ matchHotKey(window.siyuan.config.keymap.general.splitMoveB.custom, event)) && !event.repeat) {+ event.preventDefault();+ const activeTabElement = document.querySelector(".layout__wnd--active .item--focus");+ if (activeTabElement) {+ const tab = getInstanceById(activeTabElement.getAttribute("data-id")) as Tab;+ if (tab) {+ if (matchHotKey(window.siyuan.config.keymap.general.splitLR.custom, event)) {+ tab.parent.split("lr").addTab(copyTab(app, tab));+ } else if (matchHotKey(window.siyuan.config.keymap.general.splitTB.custom, event)) {+ tab.parent.split("tb").addTab(copyTab(app, tab));+ } else if (tab.parent.children.length > 1) {+ const newWnd = tab.parent.split(matchHotKey(window.siyuan.config.keymap.general.splitMoveB.custom, event) ? "tb" : "lr");+ newWnd.headersElement.append(tab.headElement);+ newWnd.headersElement.parentElement.classList.remove("fn__none");+ newWnd.moveTab(tab);+ resizeTabs();+ }+ }+ }+ return;+ }+if (matchHotKey(window.siyuan.config.keymap.general.stickSearch.custom, event)) {if (getSelection().rangeCount > 0) {const range = getSelection().getRangeAt(0);diff --git a/app/src/constants.ts b/app/src/constants.tsindex 3c4a7a4d29..8ac4624242 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -256,6 +256,10 @@ export abstract class Constants {move: {default: "", custom: ""},selectOpen1: {default: "", custom: ""},toggleDock: {default: "", custom: ""},+ splitLR: {default: "", custom: ""},+ splitMoveR: {default: "", custom: ""},+ splitTB: {default: "", custom: ""},+ splitMoveB: {default: "", custom: ""},},editor: {general: {diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.tsindex 852a2c324e..35b35d62ae 100644--- a/app/src/menus/tab.ts+++ b/app/src/menus/tab.ts@@ -119,6 +119,7 @@ const closeMenu = (tab: Tab) => {const splitSubMenu = (app: App, tab: Tab) => {const subMenus: IMenu[] = [{icon: "iconSplitLR",+ accelerator: window.siyuan.config.keymap.general.splitLR.custom,label: window.siyuan.languages.splitLR,click: () => {tab.parent.split("lr").addTab(copyTab(app, tab));@@ -127,6 +128,7 @@ const splitSubMenu = (app: App, tab: Tab) => {if (tab.parent.children.length > 1) {subMenus.push({icon: "iconLayoutRight",+ accelerator: window.siyuan.config.keymap.general.splitMoveR.custom,label: window.siyuan.languages.splitMoveR,click: () => {const newWnd = tab.parent.split("lr");@@ -139,6 +141,7 @@ const splitSubMenu = (app: App, tab: Tab) => {}subMenus.push({icon: "iconSplitTB",+ accelerator: window.siyuan.config.keymap.general.splitTB.custom,label: window.siyuan.languages.splitTB,click: () => {tab.parent.split("tb").addTab(copyTab(app, tab));@@ -148,6 +151,7 @@ const splitSubMenu = (app: App, tab: Tab) => {if (tab.parent.children.length > 1) {subMenus.push({icon: "iconLayoutBottom",+ accelerator: window.siyuan.config.keymap.general.splitMoveB.custom,label: window.siyuan.languages.splitMoveB,click: () => {const newWnd = tab.parent.split("tb");