BlockNote
BlockNote copied to clipboard
Error due to block insertion via Side Menu - Slash Menu open in a block that doesn't contain inline content
Bug
To Reproduce
- Add a custom block without InlineContent
- Click the + in its Side Menu and select the default text block (e,g, Heading). The editor crashes with the error - Slash Menu open in a block that doesn't contain inline content.
Reproduced in https://www.blocknotejs.org/examples/alert-block (if you remove InlineContent in it). Other custom blocks are added under the current block without problems
Hmm I'm seeing a different bug, the slash menu opens fine but a new block below isn't created - did you both remove the InlineContent
component from render
, and change containsInlineContent
to false
?
Here is the full code for Alert.tsx https://www.blocknotejs.org/examples/alert-block File: sample.txt
It's still reproducing
Just slightly correct the condition in const blockIsEmpty = block.content!.length === 0; to const blockIsEmpty = block.content && block.content!.length === 0;
Ah yeah, I see the issue now. The bug actually goes deeper - for some reason the text cursor position doesn't update internally when the slash menu opens, only after you start typing. Thanks for reporting this, will fix👍
Ah yeah, I see the issue now. The bug actually goes deeper - for some reason the text cursor position doesn't update internally when the slash menu opens, only after you start typing. Thanks for reporting this, will fix👍
Would this also cause the behaviour of having your cursor active in a block above, and then if you scroll to add a block somewhere else the slash menu tries to scroll back to where your cursor was last active?
EDIT: No, this seems to be from the floating-ui library settings. Disregard here, but I haven't quite fixed it yet.
Seems like both of these issues are fixed now, can't reproduce them on 0.13.4 - gonna close this issue