Yuki Takei 3 лет назад
Родитель
Сommit
33eea79c99
1 измененных файлов с 15 добавлено и 15 удалено
  1. 15 15
      packages/app/src/components/PageEditor.tsx

+ 15 - 15
packages/app/src/components/PageEditor.tsx

@@ -124,7 +124,7 @@ const PageEditor = (props: Props): JSX.Element => {
       editorContainer.disableUnsavedWarning();
 
       // eslint-disable-next-line no-unused-vars
-      const { page, tags } = await pageContainer.save(markdown, editorMode, optionsToSave);
+      const { tags } = await pageContainer.save(markdown, editorMode, optionsToSave);
       logger.debug('success to save');
 
       pageContainer.showSuccessToastr();
@@ -300,20 +300,6 @@ const PageEditor = (props: Props): JSX.Element => {
     appContainer.registerComponentInstance('PageEditor', pageEditorInstance);
   }, [appContainer, markdown]);
 
-  // set handler to update editor value
-  useEffect(() => {
-    const handler = (markdown) => {
-      if (editorRef.current != null) {
-        editorRef.current.setValue(markdown);
-      }
-    };
-    window.globalEmitter.on('updateEditorValue', handler);
-
-    return function cleanup() {
-      window.globalEmitter.removeListener('updateEditorValue', handler);
-    };
-  }, []);
-
   // set handler to set caret line
   useEffect(() => {
     const handler = (line) => {
@@ -338,6 +324,20 @@ const PageEditor = (props: Props): JSX.Element => {
     }
   }, [editorMode]);
 
+  // set handler to update editor value
+  useEffect(() => {
+    const handler = (markdown) => {
+      if (editorRef.current != null) {
+        editorRef.current.setValue(markdown);
+      }
+    };
+    window.globalEmitter.on('updateEditorValue', handler);
+
+    return function cleanup() {
+      window.globalEmitter.removeListener('updateEditorValue', handler);
+    };
+  }, []);
+
   // Displays an alert if there is a difference with pageContainer's markdown
   useEffect(() => {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion