Răsfoiți Sursa

135395 define selection and focus cursor

soumaeda 2 ani în urmă
părinte
comite
3362e796ce

+ 2 - 1
apps/app/src/components/PageEditor/MarkdownTableUtilForEditor.ts

@@ -101,7 +101,7 @@ export const getMarkdownTableFromLine = (markdown: string, bol: number, eol: num
    * return boolean value whether the cursor position is end of line
    */
 export const isEndOfLine = (editor: EditorView): boolean => {
-  return (curPos(editor) === editor.state.doc.lineAt(curPos(editor)).number);
+  return curPos(editor) === editor.state.doc.lineAt(curPos(editor)).to;
 };
 
 /**
@@ -153,6 +153,7 @@ export const replaceFocusedMarkdownTableWithEditor = (editor: EditorView, table:
   editor.dispatch({
     selection: { anchor: editor.state.doc.lineAt(curPos(editor)).to },
   });
+  editor.focus();
 };
 
 /**