8

我正在关注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 }
    )
  },
4

1 回答 1

17

Try importing Text

import { Text } from 'slate';

于 2020-07-04T16:41:00.993 回答