Explorar o código

change timing watching editor mode

yusuketk %!s(int64=7) %!d(string=hai) anos
pai
achega
6b5edef43d
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/client/js/components/Page/TagLabel.jsx

+ 4 - 2
src/client/js/components/Page/TagLabel.jsx

@@ -15,6 +15,7 @@ class TagLabel extends React.Component {
       currentPageTags: [],
       newPageTags: [],
       isOpenModal: false,
+      isEditorMode: null,
     };
 
     this.addNewTag = this.addNewTag.bind(this);
@@ -44,13 +45,14 @@ class TagLabel extends React.Component {
   }
 
   handleShowModal() {
+    const isEditorMode = this.props.crowi.getCrowiForJquery().getCurrentEditorMode();
+    this.setState({ isEditorMode });
     this.setState({ isOpenModal: true });
   }
 
   async handleSubmit() {
-    const editorMode = this.props.crowi.getCrowiForJquery().getCurrentEditorMode();
 
-    if (editorMode) { // set tag on draft on edit
+    if (this.state.isEditorMode) { // set tag on draft on edit
       this.props.sendTagData(this.state.newPageTags);
     }
     else { // update tags without saving the page on view