Added onChanged callback to Editor

This commit is contained in:
Rainer Simon 2022-09-03 19:38:15 +02:00
parent 763b7999b9
commit 2ee94add58
1 changed files with 10 additions and 6 deletions

View File

@ -126,12 +126,16 @@ export default class Editor extends Component {
!this.props.annotation?.isEqual(this.state.currentAnnotation); !this.props.annotation?.isEqual(this.state.currentAnnotation);
/** Shorthand **/ /** Shorthand **/
updateCurrentAnnotation = (diff, saveImmediately) => this.setState({ updateCurrentAnnotation = (diff, saveImmediately) => {
currentAnnotation: this.state.currentAnnotation.clone(diff) this.setState({
}, () => { currentAnnotation: this.state.currentAnnotation.clone(diff)
if (saveImmediately) }, () => {
this.onOk(); if (saveImmediately)
}) this.onOk();
else
this.props.onChanged && this.props.onChanged();
})
}
onAppendBody = (body, saveImmediately) => this.updateCurrentAnnotation({ onAppendBody = (body, saveImmediately) => this.updateCurrentAnnotation({
body: [ body: [