diff -r 772b73e31069 -r b3a02ea6d097 client/src/components/Note.js --- a/client/src/components/Note.js Fri Jun 23 10:16:49 2017 +0200 +++ b/client/src/components/Note.js Fri Jun 23 11:16:34 2017 +0200 @@ -12,9 +12,10 @@ edit: false } - toggleEditMode = () => { + enterEditMode = () => { const { edit } = this.state; - this.setState({ edit: !edit }) + if (edit) return; + this.setState({ edit: true }) } onClickDelete = (e) => { @@ -24,19 +25,30 @@ this.props.notesActions.deleteNote(this.props.note); } + onClickButton = (e) => { + + const plain = this.refs.editor.asPlain(); + const raw = this.refs.editor.asRaw(); + const html = this.refs.editor.asHtml(); + const categories = this.refs.editor.asCategories(); + + this.props.notesActions.updateNote(this.props.note, { + plain, + raw, + html, + categories + }); + + this.setState({ edit: false }) + } + renderNoteContent() { if (this.state.edit) { return (
+ onButtonClick={ this.onClickButton } + note={ this.props.note } />
) } @@ -48,7 +60,7 @@ render() { return ( -
+
{ formatTimestamp(this.props.note.startedAt) } { formatTimestamp(this.props.note.finishedAt) } { this.renderNoteContent() }