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

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

@@ -48,7 +48,7 @@ export const TextFormatTools = (props: TextFormatToolsType): JSX.Element => {
         view?.state.selection.main.to,
         view?.state.selection.main.to,
       );
       );
       const cursorPos = view?.state.selection.main.head;
       const cursorPos = view?.state.selection.main.head;
-      let curPosAfterReplacing: number | undefined;
+      let curPosAfterReplacing = {};
       const insertText = view?.state.replaceSelection(prefix + selection + suffix);
       const insertText = view?.state.replaceSelection(prefix + selection + suffix);
 
 
       if (insertText) {
       if (insertText) {
@@ -56,7 +56,7 @@ export const TextFormatTools = (props: TextFormatToolsType): JSX.Element => {
         if (cursorPos) {
         if (cursorPos) {
           curPosAfterReplacing = cursorPos + prefix.length;
           curPosAfterReplacing = cursorPos + prefix.length;
         }
         }
-        view?.dispatch({ selection: { anchor: curPosAfterReplacing } });
+        view?.dispatch({ selection: { anchor: curPosAfterReplacing as number } });
         view?.focus();
         view?.focus();
       }
       }
     };
     };