in app/addons/documents/doc-editor/components/DocEditorScreen.js [101:112]
UNSAFE_componentWillUpdate(nextProps) {
// Update the editor whenever a file is uploaded, a doc is cloned, or a new doc is loaded
if (this.props.numFilesUploaded !== nextProps.numFilesUploaded ||
this.props.doc && this.props.doc.hasChanged() ||
(this.props.doc && nextProps.doc && this.props.doc.id !== nextProps.doc.id)) {
const editor = this.getEditor();
if (editor && nextProps.doc) {
this.getEditor().setValue(JSON.stringify(nextProps.doc.attributes, null, ' '));
}
this.onSaveComplete();
}
}