banyudu / kedao

React 编辑器,从 braft-editor 修改而来,基于 draft-js 实现
https://kedao.vercel.app
MIT License
7 stars 2 forks source link

重构:删除 callbackEditor,改成 ref 实现 #22

Closed banyudu closed 2 years ago

banyudu commented 2 years ago

现在的代码中有较多的 callbackEditor提供给外部使用,如

  const handleDroppedFiles = (selectionState, files) => {
    if (
      editorPropsRef.current.handleDroppedFiles?.(selectionState, files, callbackEditor) ===
        'handled'
    ) {
      return 'handled'
    }

    return handleFiles(files)
  }

这段代码中,将 callbackEditor 传递给了外部 props 函数:handleDroppedFiles

直接删除的话会破坏现有 API,因此也放在 1.x 版本中删除此参数。

在 0.x 版本中,可以先加入如下的能力: