From 41f3bf669b193299896d304be65c6f109403337a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 28 Apr 2025 17:16:00 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14708 --- app/pnpm-lock.yaml | 6 ------ app/src/protyle/render/av/keydown.ts | 7 ++++--- app/src/protyle/render/av/openMenuPanel.ts | 2 -- app/src/protyle/wysiwyg/keydown.ts | 4 +++- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 239708196..07e96ee95 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -451,42 +451,36 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm-musl@2.5.1': resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [musl] '@parcel/watcher-linux-arm64-glibc@2.5.1': resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.5.1': resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.5.1': resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.5.1': resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-win32-arm64@2.5.1': resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==} diff --git a/app/src/protyle/render/av/keydown.ts b/app/src/protyle/render/av/keydown.ts index 9499cee92..5d0fa8b48 100644 --- a/app/src/protyle/render/av/keydown.ts +++ b/app/src/protyle/render/av/keydown.ts @@ -232,13 +232,14 @@ export const bindAVPanelKeydown = (event: KeyboardEvent) => { } })); } + return true; } } else if (event.key === "Escape") { avPanelElement.dispatchEvent(new CustomEvent("click", {detail: "close"})); - } else { - upDownHint(menuElement, event, "b3-menu__item--current", menuElement.firstElementChild); + return true; + } else if (upDownHint(menuElement, event, "b3-menu__item--current", menuElement.firstElementChild)){ + return true; } - return true; } } return false; diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 446f2dec7..0482b340c 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -139,7 +139,6 @@ export const openMenuPanel = (options: { cellElements: options.cellElements, blockElement: options.blockElement }); - (avPanelElement.querySelector(".b3-menu__item") as HTMLButtonElement).focus(); setTimeout(() => { setPosition(menuElement, cellRect.left, cellRect.bottom, cellRect.height); }, Constants.TIMEOUT_LOAD); // 等待加载 @@ -152,7 +151,6 @@ export const openMenuPanel = (options: { }); } else if (options.type === "rollup") { bindRollupData({protyle: options.protyle, data, menuElement}); - (avPanelElement.querySelector(".b3-menu__item") as HTMLButtonElement).focus(); } if (["select", "date", "relation", "rollup"].includes(options.type)) { const inputElement = menuElement.querySelector("input"); diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index ba70fa5e2..48019da46 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -117,7 +117,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { event.preventDefault(); return; } - + if (document.querySelector(".av__panel")) { + return; + } if (avKeydown(event, nodeElement, protyle)) { return; }