Просмотр исходного кода

fix IME cursor position issue by EditContext

Yuki Takei 1 год назад
Родитель
Сommit
b0f4b414b7

+ 1 - 3
packages/editor/package.json

@@ -24,9 +24,7 @@
     "react-dom": "^18.2.0"
   },
   "// comments for devDependencies": {
-    "string-width": "5.0.0 or above exports only ESM.",
-    "@codemirror/*": "Fix version of @codemirror/state < 6.4.0 due to fix the issue of https://github.com/weseek/growi/pull/9267 and https://github.com/weseek/growi/pull/9043",
-    "@codemirror/merge": "Fixed version at 6.0.0 due to errors caused by dependent packages"
+    "string-width": "5.0.0 or above exports only ESM."
   },
   "devDependencies": {
     "@codemirror/autocomplete": "^6.18.4",

+ 7 - 0
packages/editor/src/client/components-internal/CodeMirrorEditor/CodeMirrorEditor.tsx

@@ -23,6 +23,13 @@ import { Toolbar } from './Toolbar';
 
 import style from './CodeMirrorEditor.module.scss';
 
+
+// Fix IME cursor position issue by EditContext
+// ref: https://github.com/weseek/growi/pull/9267
+// ref: https://discuss.codemirror.net/t/issue-with-google-japanese-ime-cursor-position-in-v6/8810/3
+(EditorView as unknown as { EDIT_CONTEXT: boolean }).EDIT_CONTEXT = false;
+
+
 const CodeMirrorEditorContainer = forwardRef<HTMLDivElement, DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>(
   (props, ref) => {
     const { className = '', ...rest } = props;