<CKEditor
id="CKEditor1"
config={{
height: 300,
extraPlugins: 'multiimg,word2html,html5video',
}}
readOnly={disabled}
onChange={this.onChangeContent}
/>
onChangeContent = (html, selection) => {
const {getFieldValue, setFieldsValue} = this.props.form;
const oldHtml = getFieldValue('content');
if (html.replace(/ /g, ' ').replace(/ /g, ' ') === oldHtml) {
return;
}
if (html.includes(' ') || html.includes(' ')) {
const bookmarks = selection.createBookmarks2(true);
setTimeout(()=>{
setFieldsValue({content: html.replace(/ /g, ' ').replace(/ /g, ' ')}, () => {
selection.selectBookmarks(bookmarks);
});
}, 100)
} else {
setFieldsValue({content: html});
}
};