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

Revert "change some function following to migration"

This reverts commit 355caa5541738f64f34ee0927dd1fcbf6c4a32f5.
soumaeda 2 лет назад
Родитель
Сommit
13f4f2f0ee
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      apps/app/src/components/PageEditor/MarkdownTableUtil.js

+ 6 - 6
apps/app/src/components/PageEditor/MarkdownTableUtil.js

@@ -71,16 +71,16 @@ class MarkdownTableUtil {
    * return strings from BOT(beginning of table) to the cursor position
    * return strings from BOT(beginning of table) to the cursor position
    */
    */
   getStrFromBot(editor) {
   getStrFromBot(editor) {
-    const curPos = editor.state.selection.main.head;
-    return editor.state.sliceDoc(this.getBot(editor), curPos);
+    const curPos = editor.getCursor();
+    return editor.getDoc().getRange(this.getBot(editor), curPos);
   }
   }
 
 
   /**
   /**
    * return strings from the cursor position to EOT(end of table)
    * return strings from the cursor position to EOT(end of table)
    */
    */
   getStrToEot(editor) {
   getStrToEot(editor) {
-    const curPos = editor.state.selection.main.head;
-    return editor.state.sliceDoc(curPos, this.getEot(editor));
+    const curPos = editor.getCursor();
+    return editor.getDoc().getRange(curPos, this.getEot(editor));
   }
   }
 
 
   /**
   /**
@@ -105,8 +105,8 @@ class MarkdownTableUtil {
    * return boolean value whether the cursor position is end of line
    * return boolean value whether the cursor position is end of line
    */
    */
   isEndOfLine(editor) {
   isEndOfLine(editor) {
-    const curPos = editor.state.selection.main.head;
-    return (curPos === editor.state.doc.line(curPos.line + 1).length);
+    const curPos = editor.getCursor();
+    return (curPos.ch === editor.getDoc().getLine(curPos.line).length);
   }
   }
 
 
   /**
   /**