-
-
Notifications
You must be signed in to change notification settings - Fork 675
Description
Is your feature request related to a problem? Please describe.
We'd like to allow users to insert links using a slash menu action, to mimic our previous editor's behavior. On trigger, a popover would be shown, with fields for the label and target.
We already have the form, that we display inside Components.Generic.Popover.* components, and we now need to display it from the slash menu.
Unfortunately, these components can be only be accessed using BlockNote's useComponentsContext hook, which returns undefined until the editor has been initialized fully. But we need it to initialize our components to render the popover, and given this hook doesn't re-trigger once the components are ready, we're stuck.
Just to clarify, maybe using these components wouldn't work anyway from the slash menu due to positioning or visibility problems ; but that's the only solution we could have tried.
Describe the solution you'd like
Have the ability to show a popover when triggering a slash menu item.
Describe alternatives you've considered
Using a different popover library, but this would be problematic as it wouldn't necessary align with the slash menu itself, nor would it have the exact same style and usability as BlockNote's.
We could also add @floating-ui/react to our own project, but that would separate the dependency from BlockNote itself, which is not desirable.
Another solution would be to insert a link, select it and then show the formatting toolbar and trigger the edition button. But this would be a lot of actions for such a simple thing, and it isn't possible yet anyway (inline contents can't be selected easily, the formatting toolbar can't be shown programmatically while keeping the same styling as BlockNote).
Additional context
N/A