BlockNote
BlockNote copied to clipboard
Emoji Option in Suggestion Menu does not disappear when emojiPicker prop is false
Describe the bug
Not sure if this is a bug or some misconfiguration on my part. Just discovered this library yesterday so haven't had the time to go too deep, but when setting the emojiPicker prop as false, the emoji picker option in the selection menu does not disappear.
<BlockNoteView editor={editor} emojiPicker={false} />
What I see in the ui:
I noticed in getDefaultSlashMenuItems.ts that there was different logic that the other items to populate the emoji picker in that menu.
items.push({
onItemClick: () => editor.openSelectionMenu(":"),
key: "emoji",
...editor.dictionary.slash_menu.emoji,
});
The other items in that file have a separate check on the schema, this is where I wasn't sure if this was intentional or a bug as a saw that the emojiPicker was being triggered off a prop instead of the schema.
if (checkDefaultBlockTypeInSchema("file", editor)
To Reproduce
- Use v0.15.5
- render
<BlockNoteView editor={editor} emojiPicker={false} />; - Open Suggestion menu and still see Emoji Option present.
Misc
- Node version: 22.6.0
- Package manager: npm
- Browser: chrome, edge, safari
Yeah you're absolutely right, this is indeed a bug. It's a more annoying fix than it initially seems as even with emojiPicker={false}, the emoji picker plugin is still active (just the UI element is disabled). This is useful for when someone wants to replace the UI element but also means that the emoji slash menu item has no way of knowing if there is actually an emoji picker being rendered or not.
As a workaround you can just filter the emoji slash menu item manually with getDefaultReactSlashMenuItems(editor).filter((item) => item.title !== "Emoji")
Thanks! I appreciate the workaround.