EditorJS 总是渲染两个编辑器

问题描述

我正在尝试使用 EditorJS 的编辑器。一切正常,除了当我第一次加载页面时,它会在开始时初始化两个编辑器,并在每次我重新加载页面时不断添加新的编辑器。但它们都在 <div id='editorjs' /> div 内。有什么我遗漏的吗?

// 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>
    )
}

Two editors

这是dom的截图,加载页面后立即添加了两个编辑器。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)