Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/8931

Vanessacb1f00b0bec9
diff --git a/app/src/boot/globalShortcut.ts b/app/src/boot/globalShortcut.ts
index 89de5d8a4a..1434e565a8 100644
--- a/app/src/boot/globalShortcut.ts
+++ b/app/src/boot/globalShortcut.ts
@@ -1480,11 +1480,7 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
hasClosestByClassName(target, "protyle", true)) {
return false;
}
- if (!matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event) &&
- !matchHotKey(window.siyuan.config.keymap.editor.general.expand.custom, event) &&
- !event.key.startsWith("Arrow") && event.key !== "Enter") {
- return false;
- }
+
let activePanelElement = document.querySelector(".layout__tab--active");
if (!activePanelElement) {
Array.from(document.querySelectorAll(".layout__wnd--active .layout-tab-container > div")).find(item => {
@@ -1500,6 +1496,28 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
if (activePanelElement.className.indexOf("sy__") === -1) {
return false;
}
+
+ let matchCommand = false;
+ app.plugins.find(item => {
+ item.commands.find(command => {
+ if (command.dockCallback && matchHotKey(command.customHotkey, event)) {
+ matchCommand = true;
+ command.dockCallback(activePanelElement as HTMLElement);
+ return true;
+ }
+ });
+ if (matchCommand) {
+ return true;
+ }
+ });
+ if (matchCommand) {
+ return true;
+ }
+ if (!matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event) &&
+ !matchHotKey(window.siyuan.config.keymap.editor.general.expand.custom, event) &&
+ !event.key.startsWith("Arrow") && event.key !== "Enter") {
+ return false;
+ }
if (!event.repeat && matchHotKey(window.siyuan.config.keymap.editor.general.collapse.custom, event)) {
const collapseElement = activePanelElement.querySelector('.block__icon[data-type="collapse"]');
if (collapseElement) {
@@ -1521,23 +1539,6 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {
activePanelElement.classList.contains("sy__graph")) {
return false;
}
-
- let matchCommand = false;
- app.plugins.find(item => {
- item.commands.find(command => {
- if (command.dockCallback && matchHotKey(command.customHotkey, event)) {
- matchCommand = true;
- command.dockCallback(activePanelElement as HTMLElement);
- return true;
- }
- });
- if (matchCommand) {
- return true;
- }
- });
- if (matchCommand) {
- return true;
- }
const model = (getInstanceById(activePanelElement.getAttribute("data-id"), window.siyuan.layout.layout) as Tab)?.model;
if (!model) {
return false;