diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index 7452f9a65edfbe1522b25adccf9bfe30c02f07a9..c58f4452c61aa3ecdb7e05ae82b8a0d31dceedd2 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -93,36 +93,36 @@ class AnnotationCreation extends Component { } /** */ - openChooseColor(e) { + handleCloseLineWeight(e) { this.setState({ - colorPopoverOpen: true, - currentColorType: e.currentTarget.value, - popoverAnchorEl: e.currentTarget, + lineWeightPopoverOpen: false, + popoverLineWeightAnchorEl: null, }); } /** */ - openChooseLineWeight(e) { + handleLineWeightSelect(e) { this.setState({ - lineWeightPopoverOpen: true, - popoverLineWeightAnchorEl: e.currentTarget, + lineWeightPopoverOpen: false, + popoverLineWeightAnchorEl: null, + strokeWidth: e.currentTarget.value, }); } /** */ - handleLineWeightSelect(e) { + openChooseColor(e) { this.setState({ - lineWeightPopoverOpen: false, - popoverLineWeightAnchorEl: null, - strokeWidth: e.currentTarget.value, + colorPopoverOpen: true, + currentColorType: e.currentTarget.value, + popoverAnchorEl: e.currentTarget, }); } /** */ - handleCloseLineWeight(e) { + openChooseLineWeight(e) { this.setState({ - lineWeightPopoverOpen: false, - popoverLineWeightAnchorEl: null, + lineWeightPopoverOpen: true, + popoverLineWeightAnchorEl: e.currentTarget, }); } diff --git a/src/TextEditor.js b/src/TextEditor.js index 48bdab8e863c4677af742ac6b6d9ff43af9f2272..536ba33b5bfb1236f44d200ec84e4190a3a8bd74 100644 --- a/src/TextEditor.js +++ b/src/TextEditor.js @@ -22,21 +22,6 @@ class TextEditor extends Component { this.handleFormating = this.handleFormating.bind(this); } - /** */ - onChange(editorState) { - const { updateAnnotationBody } = this.props; - this.setState({ editorState }); - if (updateAnnotationBody) { - const options = { - inlineStyles: { - BOLD: { element: 'b' }, - ITALIC: { element: 'i' }, - }, - }; - updateAnnotationBody(stateToHTML(editorState.getCurrentContent(), options).toString()); - } - } - /** */ handleFormating(e, newFormat) { const { editorState } = this.state; @@ -53,6 +38,21 @@ class TextEditor extends Component { return 'not-handled'; } + /** */ + onChange(editorState) { + const { updateAnnotationBody } = this.props; + this.setState({ editorState }); + if (updateAnnotationBody) { + const options = { + inlineStyles: { + BOLD: { element: 'b' }, + ITALIC: { element: 'i' }, + }, + }; + updateAnnotationBody(stateToHTML(editorState.getCurrentContent(), options).toString()); + } + } + /** */ render() { const { classes } = this.props;