简体   繁体   中英

TypeError: Text.isText is not a function

I'm following a slate tutorial on https://docs.slatejs.org/walkthroughs/04-applying-custom-formatting

There is a function call Text.isText(n), I keep getting 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 }
    )
  },

Try importing Text

import { Text } from 'slate';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM