我正在尝试使用 EditorJS 的编辑器。一切工作正常,除了当我第一次加载页面时,它会在开始时初始化两个编辑器,并在每次重新加载页面时不断附加新编辑器。但它们都在里面<div id='editorjs' />
分区我有什么遗漏的吗?
// react etc. imports
import EditorJS from '@editorjs/editorjs'
const EditorComponent = (props) => {
const [input, setInput] = useState({})
const currentuser = useSelector((state) => state.currentuser)
const editor = new EditorJS({
holderId: 'editorjs',
autofocus: true,
})
const postNews = () => {
// POSTING SUTFF
}
return (
<Grid>
<Grid templateRows='auto min-content' gap={6}>
<div id='editorjs' />
<Button onClick={postNews}>Post news</Button>
</Grid>
</Grid>
)
}
这是 dom 的屏幕截图,其中加载页面后立即添加了两个编辑器。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)