Problem/Motivation

When installing Real-time SEO module onto Drupal with CKEditor5 enabled. We can't see the changes realtime. We have to save the page and analyze the key words after the page is saved.

Steps to reproduce

  1. Install Drupal (9 or 10)
  2. Ensure CKEditor5 is enabled
  3. Ensure Yoast SEO is enabled
  4. Add new content
  5. Add a text to the CKEditor5 field
  6. Add keyword for analysis on Yoast SEO see that keyword are not recognized.

Proposed resolution

CKEditor by default updates the hidden textarea only on form submit.

What I've seen is that the js reads from the hidden textfield area. Real-Time SEO has a javascript file that updates the textarea but only works with CKEditor4. It checks and uses CKEDITOR object.

The proposed resolution is to use Drupal.CKEditor5Instances to do the same thing.

The problem is that CKEditor5 is attached after the page is loaded. And this is being discussed here: https://www.drupal.org/project/drupal/issues/3319358

Comments

igoragatti created an issue. See original summary.

igoragatti’s picture

I've created a patch as a solution.

But the patch from the related issue must be applied so that this patch can work.

sanjayk’s picture

I am also facing same issue and patch not getting apply through command.
I have implemented manually but didn't success. got stuck at line "ckeditor5.create".
worked for you?

szato’s picture

@sanjayk,
they changed the event in core. You should use

$(document).on("editor:attached", function (event, el) {

lbesenyei’s picture

I have updated the patch based on the event name change.