类型错误:Text.isText 不是函数

gup*_*tap 6 javascript reactjs slatejs react-slate

我正在关注https://docs.slatejs.org/walkthroughs/04-applying-custom-formatting上的石板教程

有一个函数调用 Text.isText(n),我不断收到 Type:Error Text.isText is not a function

toggleBoldMark(editor) {
    const isActive = CustomEditor.isBoldMarkActive(editor)
    Transforms.setNodes(
      editor,
      { bold: isActive ? null : true },
      { match: n => Text.isText(n), split: true }
    )
  },
Run Code Online (Sandbox Code Playgroud)

Rod*_*ing 11

尝试导入文本

import { Text } from 'slate';

  • 他们的文档就像瑞士奶酪 (2认同)