Tinymce 后续的 value 更新没有设置进去

This commit is contained in:
2betop 2020-06-16 15:14:59 +08:00
parent 5aa1373c89
commit a1969777a6

View File

@ -126,6 +126,17 @@ export default class TinymceEditor extends React.Component<TinymceEditorProps> {
tinymce.init(this.config);
}
componentDidUpdate(prevProps: TinymceEditorProps) {
const props = this.props;
if (
props.model !== prevProps.model &&
props.model !== this.currentContent
) {
this.editor?.setContent(props.model || '');
}
}
componentWillUnmount() {
tinymce.remove(this.editor);
}