-
Notifications
You must be signed in to change notification settings - Fork 100
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 onChangeInitializedEditors
callback to CKEditorContext
#514
Conversation
onTrackInitializedEditors
callback to CKEditorContext
onChangeEditorsMap
callback to CKEditorContext
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'm not that good with React, so I will let others do the proper review, but I left some thoughts about the public API.
Hi, Just a question on this implementation so I can confirm closure of #513 when this is merged, If this is the same as the callback from Then I think this won't be useful as the editor is still not actually ready. |
@glynam1 It'll be fired when editor is ready (and after destroying of editor). It's the flat map of fully initialized editors that are present in React tree. |
Nice one, looking forward to the update so! |
LGTM, but the naming is not clear enough. |
onChangeEditorsMap
callback to CKEditorContext
onWatchInitializedEditors
callback to CKEditorContext
@arkflpc I renamed callback to |
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 spotted one thing.
onWatchInitializedEditors
callback to CKEditorContext
onChangeInitializedEditors
callback to CKEditorContext
Suggested merge commit message (convention)
Feature: Add an
onChangeInitializedEditors
callback toCKEditorContext
to allow tracking of newly initialized editors within the JSX React tree. Closes #513Additional information
During the React 19 refactor, it was discovered that
CKEditorContext
must be initialized before rendering the rest of the React tree (due toStrictMode
re-renders onCKEditorContext
). This order is also necessary because the rendering of newer React JSX trees is asynchronous, and it is not guaranteed that allCKEditor
instances will be registered in the context beforeonReady
is called.The issue is that some implementations rely on this behavior. Like this one: #513
While we cannot track the full initialization of the entire tree, we can incrementally track what has been added.
This PR adds:
onChangeInitializedEditors
callback toCKEditorContext
component, that is fired after any initialization or destruction of any editor in the context.contextItemMetadata
property toCKEditor
component that allowsonChangeEditorsMap
to assign proper name to initialized / or destroyed editor.Example
onWatchInitializedEditors
will be called twice in example above:{ editor1: ... }
{ editor1: ..., editor2: ... }
Order of initialization is not guaranteed.
editor2
might be initialized beforeeditor1
.