From 552c8afcc073c9a3a97fb38854d17dc509d0b8d2 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 19 Jul 2022 13:49:54 +0200 Subject: [PATCH] Fix search & replace (Cmd-f/ctrl-f) --- packages/web/editor.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/web/editor.tsx b/packages/web/editor.tsx index 1bb33b1..6d6d8d9 100644 --- a/packages/web/editor.tsx +++ b/packages/web/editor.tsx @@ -163,7 +163,14 @@ export class Editor { // Make keyboard shortcuts work even when the editor is in read only mode or not focused window.addEventListener("keydown", (ev) => { if (!this.editorView?.hasFocus) { - console.log("Window-level keyboard event", ev); + // console.log( + // "Window-level keyboard event", + // ev + // ); + if ((ev.target as any).classList.contains("cm-textfield")) { + // Search & replace feature, ignore this + return; + } if (runScopeHandlers(this.editorView!, ev, "editor")) { ev.preventDefault(); }