client/src/components/SlateEditor.js
changeset 80 b3a02ea6d097
parent 79 772b73e31069
child 102 b0e36664f1f2
--- a/client/src/components/SlateEditor.js	Fri Jun 23 10:16:49 2017 +0200
+++ b/client/src/components/SlateEditor.js	Fri Jun 23 11:16:34 2017 +0200
@@ -426,21 +426,23 @@
     )
   }
 
+  renderToolbarCheckbox = () => {
+    return (
+      <div className="checkbox">
+        <label>
+          <input type="checkbox" checked={this.props.isChecked} onChange={this.onCheckboxChange} /> <kbd>Enter</kbd> = add note
+        </label>
+      </div>
+    )
+  }
+
   renderToolbarButtons = () => {
-    if (!this.props.withButtons) {
-      return (
-        <div />
-      )
-    }
-
     return (
       <div>
-        <div className="checkbox">
-          <label>
-            <input type="checkbox" checked={this.props.isChecked} onChange={this.onCheckboxChange} /> <kbd>Enter</kbd> = add note
-          </label>
-        </div>
-        <Button bsStyle="primary" disabled={this.props.isButtonDisabled} onClick={this.onButtonClick}>Add note</Button>
+        { !this.props.note && this.renderToolbarCheckbox() }
+        <Button bsStyle="primary" disabled={this.props.isButtonDisabled} onClick={this.onButtonClick}>
+        { this.props.note ? 'Save note' : 'Add note' }
+        </Button>
       </div>
     );
   }