-
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
CkeditorContext onReady function called before editors attach to context #513
Comments
Hi! Thanks for report. I'll check this. |
@glynam1 Good catch! It looks like our React integration docs are a bit outdated, and we'll update them. Basically, At this moment import type { CollectionChangeEvent, Editor } from 'ckeditor5';
..
<CKEditorContext
context={ ClassicEditor.Context as any }
contextWatchdog={ ClassicEditor.ContextWatchdog as any }
onReady={ context => {
context.editors.on<CollectionChangeEvent<Editor>>( 'change', ( ev, data ) => {
console.info( data.added, data.removed );
// or
console.info( context.editors );
} );
} }
>
..
</CKEditorContext> |
I'm closing this issue, please reopen it if the problem still occurs. |
@Mati365 does an event emit when the context has reached a steady state? It seems like this is a change of behaviour, as onReady used to fire at the end of startup, whereas with the above snippet, the "end state" is unknown |
Yep, but it does not mean that context has assigned any editor.
Unfortunately, yes. The main reason for the changes was the recurring crashes of the integration in the latest nightly versions of React (stable Next.js was also affected) in
It's known. |
I see, we will need to manage an expected number of events to fire and cross reference that with the callbacks. This changes quite a bit our implementation. May I ask that we call these kinds of changes out in releases in future? This caused quite a bit of time in our team for investigating what has gone wrong and whether it was related to the new install setup |
@glynam1 Thanks for letting us know. Sorry about that. We’ll make sure to highlight these kind of changes in future releases. |
Hi @Mati365 , I see further issues when trying to implement this, it seems that the editors get added to the context before they've initialised any plugins
Whereas
Seems to work fine At runtime pretty much everything off the "new" editor is undefined using the callback from the context Is this expected? |
@glynam1 Expected, but not super intuitive. Consider using: |
This seems to have been introduced in 7.0.0
When using the ckeditor react context demo, attempt to log the editors after onReady is called:
This will log out as 0.
Based on these findings onReady is being called too early, as functionality that relies on this behaviour to populate the list of editors in the context will break.
This essentially breaks our setup and prevents us from upgrading, as bar listening on every onReady callback, and then populating a list based on that, there is no way to populate this
The text was updated successfully, but these errors were encountered: