Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/12989

Vc93b0f6ace0e
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index e4fc1a9a3b..6c27c3931e 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -1371,6 +1371,11 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return;
}
+ // 闪卡长按 Esc 光标定位到闪卡按钮上 https://github.com/siyuan-note/siyuan/issues/12989
+ if (document.activeElement && hasClosestByClassName(document.activeElement, "card__action")) {
+ return;
+ }
+
if (window.siyuan.dialogs.length > 0) {
window.siyuan.dialogs[window.siyuan.dialogs.length - 1].destroy();
return;
@@ -1404,10 +1409,6 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return;
}
- // 闪卡长按 Esc 光标定位到闪卡按钮上 https://github.com/siyuan-note/siyuan/issues/12989
- if (document.activeElement && hasClosestByClassName(document.activeElement, "card__action")) {
- return;
- }
// 光标在文档树等面板中,按 Esc 回到编辑器中 https://github.com/siyuan-note/siyuan/issues/4289
if (getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0);
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 55a1070c06..db980eea6b 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1180,7 +1180,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// https://github.com/siyuan-note/siyuan/issues/12989
const cardElement = hasClosestByClassName(range.startContainer, "card__main", true);
if (cardElement && document.activeElement && document.activeElement.classList.contains("protyle-wysiwyg")) {
- (cardElement.querySelector(".card__action:not(.fn__none) button") as HTMLElement).focus();
+ (cardElement.querySelector(".card__action:not(.fn__none) button:not([disabled])") as HTMLElement).focus();
hideElements(["select"], protyle);
}
} else {