-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
refactor(extension/bubble-menu): add debounce to bubble menu updates #3385
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Pretty nice! I was thinking of maybe changing the name of the option. |
Good point @svenadlung - I updated this accordingly. The new option is now |
I'm curious as to why the debounce is only run if My use case is that when cursor is on a link, regardless of there being a selection or not, I want to show a bubble menu that has options like unlink or edit link etc. This is partially working. When I click on the link it still runs the A possible solution that I can see is to always run the debounce regardless of validSelection and if I want a much smaller debounce I can set the updateDelay to 1. (Still keeping updateDelay 0 as a way to turn off the debounce should be fine). But ultimately I'm curious what the thought process was to only allow the debounce when text was selected and not just always run it if it is turned on |
After looking into it all today I figured out what's happening. More details on my setup. I'm using Vue 3 and using the useEditor composition from @tiptap/vue-3. The instance of Editor I get back from that is build on top of the Editor instance from @tiptap/core. One big difference though is that it returns a "reactiveState" object when trying to get editor.state. This object however only updates when the 'transaction' event is emitted, which happens after the bubble menu has its update function called. the The work around I found is to import the function
|
…eberdosis#3385) * refactor(extension/bubble-menu): add debounce to bubble menu updates * fix: change default duration in react bubble menu demo
This pull requests implements a debounce to the BubbleMenu plugin which allows developers to control how the bubble menu is shown.
It includes the
debounce
function from lodash which is imported directly without importing the whole lodash package which should keep the bundle size low.See #1493
Closes #1493
Closes #1313