Skip to content

Commit be33e5d

Browse files
committed
Update YamlEditor.tsx
1 parent b30e53b commit be33e5d

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/components/YamlEditor/YamlEditor.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,6 @@ export const YamlEditor = (props: YamlEditorProps) => {
6464
return () => dispose();
6565
}, [schema]);
6666

67-
// Capture Space at the window level before document-level handlers and stop propagation if inside editor
68-
useEffect(() => {
69-
const isInsideWrapper = (target: EventTarget | null): boolean => {
70-
if (!wrapperRef.current || !(target instanceof Node)) return false;
71-
return wrapperRef.current.contains(target);
72-
};
73-
74-
const handler = (e: KeyboardEvent) => {
75-
// Normalize different browsers: e.key can be ' ' or 'Spacebar'. Prefer code when available.
76-
const isSpace = e.code === 'Space' || e.key === ' ' || e.key === 'Spacebar';
77-
if (!isSpace) return;
78-
if (isInsideWrapper(e.target)) {
79-
// allow default so Monaco inserts a space, but stop propagation to prevent global handlers
80-
e.stopPropagation();
81-
}
82-
};
83-
84-
window.addEventListener('keydown', handler, true);
85-
window.addEventListener('keyup', handler, true);
86-
return () => {
87-
window.removeEventListener('keydown', handler, true);
88-
window.removeEventListener('keyup', handler, true);
89-
};
90-
}, []);
91-
9267
const enforcedOptions: monaco.editor.IStandaloneEditorConstructionOptions = useMemo(
9368
() => ({
9469
...(options as monaco.editor.IStandaloneEditorConstructionOptions),

0 commit comments

Comments
 (0)