最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: Text.isText is not a function - Stack Overflow

programmeradmin0浏览0评论

I'm following a slate tutorial on

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

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 }
    )
  },
Share Improve this question asked Jul 4, 2020 at 16:13 gurpartapgurpartap 4654 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 26

Try importing Text

import { Text } from 'slate';

发布评论

评论列表(0)

  1. 暂无评论