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

Revert "134432 read table in editor"

This reverts commit a0985fa8e15873417ee55b94a1a6215fc3ada871.
soumaeda 2 лет назад
Родитель
Сommit
1454dc9ff7

+ 1 - 1
apps/app/src/components/PageEditor/HandsontableModal.tsx

@@ -102,7 +102,7 @@ export const HandsontableModal = (): JSX.Element => {
   const debouncedHandleWindowExpandedChange = debounce(100, handleWindowExpandedChange);
 
   const handleModalOpen = () => {
-    const initTableInstance = table == null ? defaultMarkdownTable : table;
+    const initTableInstance = table == null ? defaultMarkdownTable : table.clone();
     setMarkdownTable(table ?? defaultMarkdownTable);
     setMarkdownTableOnInit(initTableInstance);
     debouncedHandleWindowExpandedChange();

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

@@ -92,7 +92,7 @@ class MarkdownTableUtil {
       return null;
     }
 
-    const strFromBotToEot = editor.state.sliceDoc(this.getBot(editor), this.getEot(editor));
+    const strFromBotToEot = editor.getDoc().getRange(this.getBot(editor), this.getEot(editor));
     return MarkdownTable.fromMarkdownString(strFromBotToEot);
   }