Connot configure CKEditor5

Created on 7 February 2023, about 2 years ago

Problem/Motivation

I updated a site to Drupal 10. But after the upgrade, I am unable to configure CKEditor5 as the editor for any text format. I select it in the dropdown list (None, CKEditor5), and when I do so, the editing display does not appear to select the editing icons. If I click OK, I get a message that I must configure the editor, and when I do, CKEditor5 is unselected again, and I am back to the starting point.

Location 	https://mysite/admin/config/content/formats/manage/basic_html?_wrapper_format=drupal_ajax&ajax_form=1
Referrer 	https://mysite/admin/config/content/formats/manage/basic_html
Message 	TypeError: Drupal\ckeditor5\CKEditor5StylesheetsMessage::checkForStylesheetsEquivalent(): Argument #1 ($theme_info) must be of type array, null given, called in /srv/www/htdocs/ssl2/sn/web/core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php on line 79 in Drupal\ckeditor5\CKEditor5StylesheetsMessage->checkForStylesheetsEquivalent() (line 109 of /srv/www/htdocs/ssl2/sn/web/core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php).
Severity 	Error

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.0

Component
CKEditor 5 

Last updated 1 day ago

Created by

🇺🇸United States tjtj

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tjtj
  • Status changed to Postponed: needs info about 2 years ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Woah, that sounds very bad!

    If you can provide steps to reproduce, we can write tests that reproduce it and get this fixed 😊

  • As far as I can tell, this error is caused by failing to check for null values on line 79 of CKEditor5StylesheetsMessage.php.

    The whole block reads as such:

        // Collect information on which themes/base themes have ckeditor_stylesheets
        // configuration, but do not have corresponding ckeditor5-stylesheets
        // configuration.
        $ckeditor_stylesheets_use = [];
        foreach ($themes as $theme_info) {
            $this->checkForStylesheetsEquivalent($theme_info, $ckeditor_stylesheets_use);
        }

    The problem is that in this case $themes has an object in it that's null. I haven't looked into why this might be or what causes it because it doesn't seem to be causing errors elsewhere (yet). In my case, it was a 2-long array with one theme and one null.

    Issue was fixed by checking for null values.

        // Collect information on which themes/base themes have ckeditor_stylesheets
        // configuration, but do not have corresponding ckeditor5-stylesheets
        // configuration.
        $ckeditor_stylesheets_use = [];
        foreach ($themes as $theme_info) {
            if (!empty($theme_info)) {
                    $this->checkForStylesheetsEquivalent($theme_info, $ckeditor_stylesheets_use);
            }
        }
  • Status changed to Active almost 2 years ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Thanks! That should allow a test to be written! 🤓

    Any chance you're interested in doing so? :D

  • 🇬🇧United Kingdom jacobupal Leeds

    While this is being worked on, is there a way to fix this in my theme?

  • 🇦🇺Australia peterx

    Installed Drupal 10.2.1 today. Claro as admin theme. Tried to set Ckeditor 5 for Full HTML. Could not. Had the message You have to configure Ckeditor 5. I noticed the message about fixing it using Claro. As an experiment, I used Olivero. That let me set Ckeditor 5 in Full HTML. I then switched back to Claro as the admin theme.

    I then tried to create an article but Ckeditor would not appear for Full HTML using either Claro or Olivero.

    I successfully added Ckeditor 5 to Basic HTML and the editor appeared in create Article.
    I successfully added Ckeditor 5 to Restricted HTML and the editor appeared in create Article.

    I successfully added Ckeditor 5 to Full HTML but the editor did not appear in create Article. I tested several add/delete/add cycles with Claro and Olivero but could not make Ckeditor work with Full HTML.

    This might help with diagnostics and testing.

    I also tested with a third party theme for the site but not admin. When I add Ckeditor 5 to Basic or Full or Restricted, there is a message about the theme having a style sheet for Ckeditor but not Ckeditor 5.

    "The 0 Point theme has ckeditor_stylesheets configured without a corresponding ckeditor5-stylesheets configuration. See the change record for details."

    Using Firefox console during create Article, I get the following message for Basic, restricted, and Full.
    Uncaught TypeError: node is null
    checkMutation http://example.com/node/add/article line 612 > eval:92

    The line is:
    node.nodeType === Node.ELEMENT_NODE &&
    node.nodeName === 'SCRIPT' &&
    node.dataset &&
    node.dataset.bigPipeReplacementForPlaceholderWithId &&
    typeof drupalSettings.bigPipePlaceholderIds[
    node.dataset.bigPipeReplacementForPlaceholderWithId
    ] !== 'undefined',
    );

    When I switch to Full, I get this additional error:
    CKEditorError: plugincollection-soft-required {"missingPlugin":"LinkEditing","requiredBy":"EntityEmbedLinkUi"}
    Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#erro...

  • 🇺🇸United States ChrisGrewe

    If it helps anyone else, I found that setting the default admin theme to a specific theme rather than "default" gets you around this problem. The error arises when it loops through an array of themes expecting arrays of info, but none exists for "default".

  • 🇨🇭Switzerland ytsurk Switzerland

    When you have that javascript error mentioned here: CKEditorError: plugincollection-soft-required {"missingPlugin":"LinkEditing","requiredBy":"EntityEmbedLinkUi"}
    then enable the link Module and add a the link plugin to the CKEditor's toolbar,
    see 🐛 CKEditor 5 plugin only works when the "Link" plugin is enabled Needs review

Production build 0.71.5 2024