BlockNote
BlockNote copied to clipboard
Support for excluding any block
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: https://github.com/TypeCellOS/BlockNote/issues/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
See this example: https://www.blocknotejs.org/examples/basic/removing-default-blocks