wangeditor 两个editor失焦解决办法
一个editor编辑,一个editor展示,一编辑就失焦
<Editor defaultConfig={editorConfig} value={html} onCreated={setEditor} onChange={editor => { console.log('onchangs'); setHtml(editor.getHtml()); }} mode="default" style={{ height: '500px' }} /> <Editor defaultConfig={{ readOnly: true }} value={html} mode="default" style={{ height: '500px' }} />
复制
解决办法:
const [editor, setEditor] = useState<IDomEditor | null >(null); useEffect(() => { if (editor) { editor.moveReverse(1); editor.move(1); } }, [html]);
复制