fix monaco
This commit is contained in:
@@ -68,6 +68,22 @@ export const ConfigNode = memo(function ConfigNode({ id, data }: Props) {
|
|||||||
const handleEditorMount = useCallback((editor: any, monaco: any) => {
|
const handleEditorMount = useCallback((editor: any, monaco: any) => {
|
||||||
editorRef.current = editor
|
editorRef.current = editor
|
||||||
monacoRef.current = monaco
|
monacoRef.current = monaco
|
||||||
|
|
||||||
|
// Prevent React Flow and other global handlers from interfering with typing
|
||||||
|
try {
|
||||||
|
editor.onKeyDown((e: any) => {
|
||||||
|
if (e?.browserEvent) {
|
||||||
|
e.browserEvent.stopPropagation()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
editor.onMouseDown((e: any) => {
|
||||||
|
if (e?.event) {
|
||||||
|
e.event.stopPropagation()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
// ignore if Monaco internals change
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const insertIncludeFromNode = useCallback(
|
const insertIncludeFromNode = useCallback(
|
||||||
@@ -162,7 +178,7 @@ export const ConfigNode = memo(function ConfigNode({ id, data }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div style={{ height: 180 }} className="w-full">
|
<div style={{ height: 180 }} className="w-full nodrag nopan">
|
||||||
<Editor
|
<Editor
|
||||||
height="100%"
|
height="100%"
|
||||||
defaultLanguage="yaml"
|
defaultLanguage="yaml"
|
||||||
@@ -177,8 +193,6 @@ export const ConfigNode = memo(function ConfigNode({ id, data }: Props) {
|
|||||||
glyphMargin: false,
|
glyphMargin: false,
|
||||||
renderLineHighlight: 'none',
|
renderLineHighlight: 'none',
|
||||||
lineDecorationsWidth: 2,
|
lineDecorationsWidth: 2,
|
||||||
lineNumbersMinChars: 2,
|
|
||||||
scrollBeyondLastLine: false,
|
|
||||||
padding: { top: 0, bottom: 4 },
|
padding: { top: 0, bottom: 4 },
|
||||||
lineNumbers: 'on',
|
lineNumbers: 'on',
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user