فهرست منبع

135395 define selection and focus cursor

soumaeda 2 سال پیش
والد
کامیت
3362e796ce
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      apps/app/src/components/PageEditor/MarkdownTableUtilForEditor.ts

+ 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
    * return boolean value whether the cursor position is end of line
    */
    */
 export const isEndOfLine = (editor: EditorView): boolean => {
 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({
   editor.dispatch({
     selection: { anchor: editor.state.doc.lineAt(curPos(editor)).to },
     selection: { anchor: editor.state.doc.lineAt(curPos(editor)).to },
   });
   });
+  editor.focus();
 };
 };
 
 
 /**
 /**