Skip to content

Commit

Permalink
Added onChanged callback to Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimon committed Sep 3, 2022
1 parent 763b799 commit 2ee94ad
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/editor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,16 @@ export default class Editor extends Component {
!this.props.annotation?.isEqual(this.state.currentAnnotation);

/** Shorthand **/
updateCurrentAnnotation = (diff, saveImmediately) => this.setState({
currentAnnotation: this.state.currentAnnotation.clone(diff)
}, () => {
if (saveImmediately)
this.onOk();
})
updateCurrentAnnotation = (diff, saveImmediately) => {
this.setState({
currentAnnotation: this.state.currentAnnotation.clone(diff)
}, () => {
if (saveImmediately)
this.onOk();
else
this.props.onChanged && this.props.onChanged();
})
}

onAppendBody = (body, saveImmediately) => this.updateCurrentAnnotation({
body: [
Expand Down

0 comments on commit 2ee94ad

Please sign in to comment.