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

133069 take changes of curPosAfterReplacing

soumaeda 2 лет назад
Родитель
Сommit
d85d088b9a
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      packages/editor/src/components/CodeMirrorEditor/Toolbar/TextFormatTools.tsx

+ 1 - 3
packages/editor/src/components/CodeMirrorEditor/Toolbar/TextFormatTools.tsx

@@ -53,9 +53,7 @@ export const TextFormatTools = (props: TextFormatToolsType): JSX.Element => {
 
 
       if (insertText) {
       if (insertText) {
         view?.dispatch(insertText);
         view?.dispatch(insertText);
-        if (cursorPos) {
-          curPosAfterReplacing = cursorPos + prefix.length;
-        }
+        curPosAfterReplacing = cursorPos + prefix.length;
         view?.dispatch({ selection: { anchor: curPosAfterReplacing } });
         view?.dispatch({ selection: { anchor: curPosAfterReplacing } });
         view?.focus();
         view?.focus();
       }
       }