Ver Fonte

add as number

soumaeda há 2 anos atrás
pai
commit
042d04e7ed

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