ckeditor / ckeditor5-react

Official CKEditor 5 React component.
https://ckeditor.com/ckeditor-5
Other
424 stars 99 forks source link

onChangeInitializedEditors isn't fired during startup #552

Open glynam1 opened 2 days ago

glynam1 commented 2 days ago

I have a component like

      <>
          <CKEditorContext
            context={DecoupledEditor.Context}
            contextWatchdog={DecoupledEditor.ContextWatchdog}
            config={contextConfig}
            onReady={(context: any, watchdog: any) => {
              console.log(context)
            } }
            onChangeInitializedEditors={ editors => {
              console.log( editors );
            }}
            onError={(error: any, details: any) => {
              console.log(error)
              console.log(details);
            }}
          >
            {document.sections.map((section) => (
              <SectionedContentEditor
                key={`sectionEditor${section.position}`}
                section={section}
                handleAutoSave={handleAutoSave}
              />
            ))}
          </CKEditorContext>
      </>

and child

<CKEditor
          editor={DecoupledEditor}
          config={config}
          contextItemMetadata={{
            name: `Section${section.position}`,
          }}
          onError={(error: any, details: any) => {
            console.log(error)
            console.log(details);
          }}
        />

When using Ckeditor v43.3.0 and ckeditor-react v9.1.0 (or even latest)

This event does not fire. I have tried debugging it and the callback is set up but then the callback from the editor never seems to be fired.

Any insight?

glynam1 commented 1 day ago

To add to this, I've added onReady to the child CKeditor instance, and that callback fires.

Mati365 commented 1 day ago

@glynam1 Hi! Can you prepare minimal stackblitz demo with your setup? 🙏 It will help me with debugging this. I checked this today with ClassicEditor and it was working correctly, so it may be related to specific configuration.