소스 검색

Merge pull request #10900 from growilabs/fix/180211-disable-bracket-matching-ime-rendering-bu

fix(editor): Disable bracketMatching to prevent IME composition rendering corruption
Yuki Takei 2 주 전
부모
커밋
b76b146150
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      packages/editor/src/client/services/use-codemirror-editor/use-codemirror-editor.ts

+ 9 - 0
packages/editor/src/client/services/use-codemirror-editor/use-codemirror-editor.ts

@@ -1,4 +1,5 @@
 import { useMemo } from 'react';
+import { bracketMatching } from '@codemirror/language';
 import type { EditorState } from '@codemirror/state';
 import type { EditorView } from '@codemirror/view';
 import { type UseCodeMirror, useCodeMirror } from '@uiw/react-codemirror';
@@ -60,7 +61,15 @@ export const useCodeMirrorEditor = (
             dropCursor: false,
             highlightActiveLine: false,
             highlightActiveLineGutter: false,
+            // Disable default bracketMatching and re-add with afterCursor: false
+            // to prevent a rendering bug where text visually disappears after IME
+            // composition inside brackets on non-Safari browsers (e.g. Chrome).
+            // When afterCursor is true (default), bracketMatching decorates brackets
+            // ahead of the cursor immediately after composition ends, which corrupts
+            // CodeMirror's DOM reconciliation.
+            bracketMatching: false,
           },
+          extensions: [bracketMatching({ afterCursor: false })],
           // ------- End -------
         },
         props ?? {},