fix: allow listening to onChange and other events before the underlying editor is initialized#2063
Merged
nperez0111 merged 2 commits intomainfrom Oct 8, 2025
Merged
fix: allow listening to onChange and other events before the underlying editor is initialized#2063nperez0111 merged 2 commits intomainfrom
onChange and other events before the underlying editor is initialized#2063nperez0111 merged 2 commits intomainfrom
Conversation
…ying editor is initialized
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
matthewlipski
approved these changes
Oct 6, 2025
Collaborator
matthewlipski
left a comment
There was a problem hiding this comment.
Nice additions and cleanup!
nperez0111
commented
Oct 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change allows for using
editor.onChangebefore theeditor.tiptapEditoris actually assigned. This allows us to not have to wrap every event we register in extensions (the only time you'd have access to the editor instance without the tiptapEditor being initialized), be forced to be wrapped ineditor.onCreate.Rationale
This simplifies extension code to be the same as what you'd use with a fully constructed editor instance.
Changes
De-coupled the event handling to be done on the EventManager instance by making it into an EventEmitter
Impact
Should be no change
Testing
Added tests to prove that this works, also added tests for the new onMount & onUnMount events that I exposed as part of this
Screenshots/Video
Checklist
Additional Notes