CKEditor5: Throwing error when saving format wiht AI disabled

Created on 1 November 2024, 5 months ago

Problem/Motivation

I currently encounter following error when saving a text format where AI is not enabled via the toolbar item:

AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 894 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).

Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames('settings.plugins.ai_ckeditor_ai', Array) (Line: 930)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames('settings.plugins.ai_ckeditor_ai', Array) (Line: 715)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object) (Line: 207)

Steps to reproduce

Save a text format where AI Toolbar Item is not enabled.

Proposed resolution

I think this happens because the CKEditor5 Plugin handling checks for ai_ckeditor_ai settings in the form because the plugin definition currently doesn't declare that these settings are only available if the toolbar item is enabled.

To fix that we can declare the dependency to the toolbar item being enabled like this:

...
ai_ckeditor_ai:
  drupal:
    label: AI tools
    ...
    conditions:
      toolbarItem: aickeditor

Remaining tasks

  1. Write Coded
  2. Review
  3. Merge

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

1.0

Component

AI CKEditor

Created by

πŸ‡¨πŸ‡­Switzerland das-peter

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024