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

change some function following to migration

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

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

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