This commit is contained in:
Zef Hemel
2023-07-02 14:10:03 +02:00
parent 75aa3171ff
commit a116b7aadd
2 changed files with 7 additions and 5 deletions
+7 -4
View File
@@ -99,10 +99,13 @@ export function MiniEditor(
useEffect(() => {
if (editorViewRef.current) {
editorViewRef.current.setState(buildEditorState());
editorViewRef.current.dispatch({
selection: { anchor: text.length },
});
const currentEditorText = editorViewRef.current.state.sliceDoc();
if (currentEditorText !== text) {
editorViewRef.current.setState(buildEditorState());
editorViewRef.current.dispatch({
selection: { anchor: text.length },
});
}
}
}, [text, vimMode]);