itizawa 5 anni fa
parent
commit
0dc954e0b2
1 ha cambiato i file con 4 aggiunte e 5 eliminazioni
  1. 4 5
      src/client/js/components/PageEditor.jsx

+ 4 - 5
src/client/js/components/PageEditor.jsx

@@ -102,17 +102,16 @@ class PageEditor extends React.Component {
    * @param {string} value
    */
   onMarkdownChanged(value) {
-    const { editorMode } = this.props.navigationContainer.state;
-
     const { pageContainer, editorContainer } = this.props;
+    const { revisionId } = pageContainer.state;
     this.setMarkdownStateWithDebounce(value);
+
     // only when the first time to edit
-    if (!pageContainer.state.revisionId) {
+    if (!revisionId) {
       this.saveDraftWithDebounce();
     }
 
-    // If it's updated in the view mode, it is considered to have already been saved and no alert is displayed.
-    if (editorMode !== 'view') {
+    if (pageContainer.state.markdown !== value) {
       editorContainer.enableUnsavedWarning();
     }
   }