Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editor dependency when registering BubbleMenuPlugin #2018

Merged
merged 2 commits into from
Oct 12, 2021
Merged

Add editor dependency when registering BubbleMenuPlugin #2018

merged 2 commits into from
Oct 12, 2021

Conversation

ValentaTomas
Copy link
Contributor

When we are initializing editor via the useEditor hook with dependencies the BubbleMenu component is only registered the first time the editor is initialized.

Adding editor to the dependency array registering/unregistering the BubbleMenuPlugin fixes this. (I tested exactly this code in our project.)

I also added a check that ensures that the menu element referenced via the useRef is defined when registering the plugin - otherwise, there is no point in registering the plugin.

When we are initializing editor via the `useEditor` hook with dependencies the `BubbleMenu` component is only registered the first time the editor is initialized.

Adding editor to the dependency array registering/unregistering the `BubbleMenuPlugin` fixes this. (I tested exactly this code in our project.)

I also added a check that ensures that the menu element referenced via the `useRef` is defined when registering the plugin - otherwise, there is no point in registering the plugin.
@philippkuehn
Copy link
Contributor

Hey, great. Could you make the same change for the FloatingMenu please? Then I’m happy to merge it.

@ValentaTomas
Copy link
Contributor Author

@philippkuehn Of course, here you go.

@philippkuehn
Copy link
Contributor

thanks!

@philippkuehn philippkuehn merged commit e9465ec into ueberdosis:main Oct 12, 2021
andrewlu0 pushed a commit to trybaseplate/tiptap that referenced this pull request Oct 20, 2023
…`FloatingMenuPlugin` (ueberdosis#2018)

* Add `editor` dependency when registering `BubbleMenuPlugin`

When we are initializing editor via the `useEditor` hook with dependencies the `BubbleMenu` component is only registered the first time the editor is initialized.

Adding editor to the dependency array registering/unregistering the `BubbleMenuPlugin` fixes this. (I tested exactly this code in our project.)

I also added a check that ensures that the menu element referenced via the `useRef` is defined when registering the plugin - otherwise, there is no point in registering the plugin.

* Add `editor` dependency when registering `FloatingMenuPlugin`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants