TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.

Home Page:https://www.blocknotejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for excluding any block

i-am-chitti opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently, defaultBlockSpecs has heading, paragraph, bulletListItem, numberedListItem, image and table. So, when a editor is rendered, one can choose any of these blocks. But it would be great to provide ability to exclude some of the default blocks. For example, exclude the image block. A user should not be able to use an image block.

Describe the solution you'd like
Haven't thought. Let's discuss and deduce a solution.

Describe alternatives you've considered
Tried the schema with excluded image block in defaultBlockSpecs but it didn't work.

Additional context
None

I thought your listed alternative should work. We'll check this out and add a related example.

Related: #401

I'm using lodash's omit to remove checkListItem block from my definition:

const schema = BlockNoteSchema.create({
  blockSpecs: {
    ...omit(defaultBlockSpecs, ["checkListItem"]),
    ...moreTypes
  }
})

This prevents check list blocks from being included. You could achieve the same thing w/o omit