Problem/Motivation
When editing an existing embedded content widget via the toolbar "Edit" button and changing only the plugin configuration (e.g. updating a text field value), the CKEditor 5 preview does not update to reflect the new values. The widget continues to display the old/stale preview.
This occurs because the editing downcast converter in editing.js only listens for changes to the dataPluginId model attribute. When a user edits an embedded content widget without changing the plugin type (i.e. the same plugin is selected), only the dataPluginConfig attribute changes. Since there is no listener for dataPluginConfig attribute changes, the preview re-render is never triggered.
The behaviour is intermittent — occasionally the preview does update, which happens when CKEditor's model differ treats the operation as a full element removal + insertion rather than an in-place attribute update. This makes the bug particularly confusing for content editors.
Steps to reproduce
- Create a node with a CKEditor 5 text field that has the Embedded Content plugin enabled.
- Insert an embedded content widget (e.g. a promo block with a text field).
- Save the node.
- Edit the node again.
- Click the embedded content widget to select it, then click the "Edit" toolbar button (pencil icon).
- In the dialog, change a plugin configuration value (e.g. update a text field) without changing the plugin type.
- Click "Save" in the dialog.
- Observe that the CKEditor 5 preview still displays the old values.
Expected behaviour
After saving the dialog with updated plugin configuration values, the CKEditor 5 preview should immediately re-render to reflect the new values.
Actual behaviour
The preview remains stale, showing the previous configuration values. The updated values are only visible after saving the node and reloading the edit form, or in rare cases where CKEditor internally removes and re-inserts the element.
Proposed resolution
Add an attribute-to-element converter for the dataPluginConfig model attribute in editing.js, so that changes to plugin configuration (not just plugin ID) trigger a preview re-render.
Specifically, register an additional editor.conversion.for('editingDowncast').attributeToElement() converter that listens for changes to dataPluginConfig and triggers the same preview update logic that currently exists for dataPluginId.
Remaining tasks
- Confirm fix does not introduce duplicate re-renders when both attributes change simultaneously.
- Add test coverage for editing an embedded content widget without changing the plugin type.
- Review whether other model attributes (e.g.
dataPluginUuid) also need downcast listeners.
Issue fork embedded_content-3589092
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments