-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(core): onDrop and onPaste only registered when defined #5681 #5684
Conversation
|
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
this.on('drop', ({ event, slice, moved }) => this.options.onDrop(event, slice, moved)) | ||
this.on('paste', ({ event, slice }) => this.options.onPaste(event, slice)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured, that while I was here, I may as well promote these to be actual editor events that follow the same pattern as others. This allows flexibility to register multiple handlers to listen to the same event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nperez0111 This resolves this, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svenadlung it does 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes Overview
This updates the
onDrop
andonPaste
event callbacks to only ever be registered if they exist on the editor instance at creation.It also refactors them to be extensions rather than separate Prosemirror plugins which would causes plugins to be destroyed and recreated immediately
Implementation Approach
Testing Done
Verification Steps
Additional Notes
Checklist
Related Issues