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

Merge remote-tracking branch 'origin/master' into feat/growi-bot

Yuki Takei 5 лет назад
Родитель
Сommit
04afe5bb3b

+ 7 - 1
CHANGES.md

@@ -1,10 +1,16 @@
 # CHANGES
 
-## v4.2.16-RC
+## v4.2.17-RC
 
+* Fix: No unsaved alert is displayed without difference the latest markdown and editor value
 * Support: Update libs
     * eslint-config-weseek
 
+## v4.2.16
+
+* Fix: "Only inside the group" causes an error
+    * Introduced by v4.2.15
+
 ## v4.2.15
 
 * Improvement: toastr location for editing

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "growi",
-  "version": "4.2.16-RC",
+  "version": "4.2.17-RC",
   "description": "Team collaboration software using markdown",
   "tags": [
     "wiki",

+ 12 - 2
src/client/js/components/PageEditor.jsx

@@ -101,13 +101,23 @@ class PageEditor extends React.Component {
    * @param {string} value
    */
   onMarkdownChanged(value) {
-    const { pageContainer, editorContainer } = this.props;
+    const { pageContainer } = this.props;
     this.setMarkdownStateWithDebounce(value);
     // only when the first time to edit
     if (!pageContainer.state.revisionId) {
       this.saveDraftWithDebounce();
     }
-    editorContainer.enableUnsavedWarning();
+  }
+
+  // Displays an alert if there is a difference with pageContainer's markdown
+  componentDidUpdate(prevProps, prevState) {
+    const { pageContainer, editorContainer } = this.props;
+
+    if (this.state.markdown !== prevState.markdown) {
+      if (pageContainer.state.markdown !== this.state.markdown) {
+        editorContainer.enableUnsavedWarning();
+      }
+    }
   }
 
   /**

+ 0 - 1
src/client/js/components/SavePageControls/GrantSelector.jsx

@@ -203,7 +203,6 @@ class GrantSelector extends React.Component {
     return (
       <Modal
         className="select-grant-group"
-        container={this}
         isOpen={this.state.isSelectGroupModalShown}
         toggle={this.hideSelectGroupModal}
       >