fix(编辑能力): 修复文字编辑查找快捷键
build.yaml / build (push) Successful in 47s

This commit is contained in:
xiaoqidun committed 2026-10-29 16:25:24 +08:00
1 parent 1a25472b43
commit 545b697310
2 files changed
+4 -6

No files matched your search

+3 -6
View File
@@ -2041,11 +2041,7 @@ function handleKeyDown(event) {
}
if (key === "F3") {
event.preventDefault();
if (state.searchMatches.length) {
selectSearchMatch(event.shiftKey ? Math.max(0, state.searchIndex) - 1 : state.searchIndex + 1);
} else {
focusSearch();
}
focusSearch(event.shiftKey ? -1 : 1);
return;
}
if (key === "Escape" && !event.shiftKey && !el.searchPanel.hidden && (el.pageListPanel.contains(target) || el.viewerPanel.contains(target))) {
@@ -11065,13 +11061,14 @@ function copySelection(event) {
event.preventDefault();
}
async function focusSearch() {
async function focusSearch(direction = 0) {
if (canvasEditor.input || canvasEditor.crop || canvasEditor.nudge || canvasEditor.nudgeCommit) {
const tab = documentTab(), content = documentContentKey(state);
const current = () => isForegroundDocument(tab) && content === documentContentKey(state);
if (!await canvasEditor.commitNudge() || !current() || !await canvasEditor.commitText() || !current()
|| !await canvasEditor.commitCrop() || !current() || document.body.hasAttribute("data-busy") || formDialogOpen()) return;
}
if (direction && state.searchMatches.length) return selectSearchMatch((direction < 0 ? Math.max(0, state.searchIndex) : state.searchIndex) + direction);
if (!state.showPages) {
toggleSidebar("pages");
}
+1
View File
@@ -1960,6 +1960,7 @@ export class CanvasEditor {
}
});
input.addEventListener("keydown", (event) => {
if (event.key === "F3" && !event.ctrlKey && !event.metaKey && !event.altKey) return;
if ((event.ctrlKey || event.metaKey) && !event.altKey && (["s", "w", "tab"].includes(event.key.toLowerCase())
|| !event.shiftKey && ["f", "o", "p"].includes(event.key.toLowerCase()))) return;
event.stopPropagation();