CKEditor 5 buttons not visible on configuration page for full_html

Created on 26 September 2023, 9 months ago
Updated 20 February 2024, 4 months ago

Problem/Motivation

Instead of the icons I see text references to the icons under "available buttons" and "active toolbar"
screenshot ckeditor

Steps to reproduce

launch config/content/formats/manage/full_html
save configuration
log message: "TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in in_array() (line 659 of /var/www/testes/web/core/modules/ckeditor5/ckeditor5.module)."
I found out that after removing "sourceEditing" and saving, the icons reappear and I can add any icon without having errors. When I add the source icon, it's screwed up again.
It seems similar to issue https://www.drupal.org/project/drupal/issues/3335155 ๐Ÿ’ฌ CKEditor 5 toolbar configuration: no admin UI visible, only JSON in a Closed: duplicate
but I don't understand the solution "bandwidth-optimailisation"

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ’ฌ Support request
Status

Postponed: needs info

Version

11.0 ๐Ÿ”ฅ

Component
CKEditor 5ย  โ†’

Last updated about 14 hours ago

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium jjgw

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @jjgw
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    If there are steps to reproduce this is a bug report.

    That's a TypeError. Does Drupal crash when you save the configuration form?

  • Status changed to Postponed: needs info 9 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    That is most likely caused by a Drupal contrib module. Can you please export your core.extension config and upload it here? Which of your installed modules provide CKEditor 5 plugins?

    Which version of Drupal core are you using?

    P.S.: the screenshot is not visible, I have to accept some weird terms of service (which I won't do). Please upload images here.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium jjgw

    There is no bug involved here, but my database is corrupted. In fact, I had a power failure and I am now experiencing similar problems in other modules, like blocks. To avoid further surprises I am forced to redo my work of the last 3 days. Sorry voor het storen.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

    Should we close this?

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium jjgw

    my configuration:
    Drupal 10.1.4
    Apache 2.4.57 Ubuntu
    PHP 8.2.10
    Mysql 8.0.34.0 Ubuntu 22.04.1

    I did following tests on localhost:
    1ยฐ install drupal with spanish translation
    composer create-project drupal/recommended-project
    2ยฐ check all text formats for basic page
    goto /admin/structure/types/manage/page/fields/node.page.body
    check all text formats and save
    3ยฐ try to modify formats for Full HTML
    goto /admin/config/content/formats
    select full HTML
    click on configure
    4ยฐ result:
    No icons are visible. Instead there are the text references to the icons.

    This time I have no more the error message as mentioned above.

    What's weird:
    I did this test 3 times with the same result.
    I also did the same test with a non translated installation. (English)
    And here the icons for full HTML are visible as expected!!!

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    #6: when the config UI does not render correctly, can you please check your browser's JavaScript console? I bet there is a JavaScript error!

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium jjgw

    On http://es.localhost/admin/config/content/formats/manage/basic_html?desti...
    that's the clean spanish site without any content and contrib modules
    I have no js errors but 2 (same) warnings:
    [Deprecation] The keyword 'push-button' specified to an 'appearance' property is not standardized. It will be removed in the future.
    I added all the available buttons, except the source button, to the active toolbar without getting js errors.
    When I added the source button and saved the configuration, the buttons dissapear and are replaced by text, and I get 6 js errors + the 2 warnings.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Please upload the screenshots here. That link will stop working at some point. And it already doesn't allow me to view the screenshots! ๐Ÿ˜…

    [Deprecation] The keyword 'push-button' specified to an 'appearance' property is not standardized. It will be removed in the future.

    This appears to be a warning from your browser about some CSS. It's not a JS error, fortunately ๐Ÿ˜Š

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium jjgw

    I thought uploading on this forum was not possible. It took me a while to find the right button.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Those errors imply drupal.js never loaded. ๐Ÿคฏ

    That's definitely not related to CKEditor 5.

    Without steps to reproduce, there's absolutely nothing I can do to help you, @jjgw ๐Ÿ˜ž

  • ๐Ÿ‡ช๐Ÿ‡ธSpain slajo

    Same error on a Drupal 10.1.6 default installation profile. Site default language Spanish.
    I couldn`t reproduce this problem on a english (en) or portugรชs (pt-pt) sites.
    When you try to change the format text editor to none you have this error stack:

    TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in in_array() (line 659 of core/modules/ckeditor5/ckeditor5.module).
    ckeditor5_editor_presave(Object)
    call_user_func_array(Object, Array) (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'ckeditor5') (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('editor_presave', Object) (Line: 416)
    Drupal\Core\Extension\ModuleHandler->invokeAll('editor_presave', Array) (Line: 341)
    Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('presave', Object) (Line: 529)
    Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 483)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 257)
    Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
    Drupal\Core\Entity\EntityBase->save() (Line: 609)
    Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 255)
    editor_form_filter_admin_format_submit(Array, Object)
    call_user_func_array('editor_form_filter_admin_format_submit', Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    If you add other languaje to the site (e.g english) you can change to that new language and edit de ckeditor ckeditor5-toolbar-configuration fieldset with no error.

    The error only apear if de sourceEditing plugin is enabled.
    No errors or warnings on Xdebug when loading de format edit page.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
    TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in in_array() (line 659 of core/modules/ckeditor5/ckeditor5.module).
    ckeditor5_editor_presave(Object)
    

    is referring to this line in 10.1.6:

    if (in_array('codeBlock', $settings['toolbar']['items'], TRUE) && !isset($settings['plugins']['ckeditor5_codeBlock'])) {
    

    It should not be possible for $settings['toolbar']['items'] to be an array.

    Can you please provide a config export of your editor config entity, in all of the 3 languages you mentioned? ๐Ÿ™

  • ๐Ÿ‡ช๐Ÿ‡ธSpain slajo

    Here are my basic_html editor config files in tree diferent cases

    • es: This is the config in a modified site. The editor works fine if you remove de sourceEditing value from de settings.toolbar.items list. If you add this value you have a JS error in de front (you see the tokens instead the buttons) and when try to change the editor to "none" you have the back error.
    • es default: The same case as above but I export the config from a clean default instalation
    • en default: No errors ๐Ÿคฏ
  • ๐Ÿ‡ช๐Ÿ‡ธSpain slajo

    In comment#15 es default case when sourceEditing plugin is added a JS error trowed (before saving the config, only dragging the plugin to enable it):

    Uncaught TypeError: Cannot set properties of undefined (setting 'value')
    at Drupal.verticalTab.focus (vertical-tabs.js?v=10.1.6:199:65)
    at vertical-tabs.js?v=10.1.6:117:42
    at Array.forEach ()
    at Object.attach (vertical-tabs.js?v=10.1.6:64:68)
    at drupal.js?v=10.1.6:166:24
    at Array.forEach ()
    at Drupal.attachBehaviors (drupal.js?v=10.1.6:162:34)
    at HTMLDivElement. (ajax.js?v=10.1.6:1362:20)
    at Function.each (jquery.min.js?v=3.7.0:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.0:2:1594)

    Everything works well in the en default case.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain jmohino

    After upgrading to Drupal 10.2.2 I have the same problem when using css/js aggregation

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium Wim Leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Please provide exact steps to reproduce on a fresh Drupal site.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain jmohino

    In my case, after installing Gin โ†’ as an administration theme, the problem has been solved

Production build 0.69.0 2024