We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c452f15 commit 2a00c09Copy full SHA for 2a00c09
src/handlers/keyboard.js
@@ -64,14 +64,20 @@ export default function keyboardHandler(e) {
64
if (!ctrlKey && !shiftKey && !altKey && !metaKey) return;
65
if (["Control", "Alt", "Meta", "Shift"].includes(key)) return;
66
67
+ const target = editorManager?.editor?.contentDOM;
68
+ if (!target) return;
69
+
70
+ // Physical keyboard events already reaching CodeMirror should not be
71
+ // re-dispatched from the document listener.
72
+ if ($target === target || (target.contains?.($target) ?? false)) return;
73
74
const event = KeyboardEvent("keydown", {
75
key,
76
ctrlKey,
77
shiftKey,
78
altKey,
79
metaKey,
80
});
- const target = editorManager?.editor?.contentDOM;
81
target?.dispatchEvent?.(event);
82
}
83
0 commit comments