Editing source using the CKEditor Source mode does not fire change event

Created on 16 April 2022, over 2 years ago
Updated 5 September 2024, 3 months ago

Problem/Motivation

The Editor module tracks when an editor has modified a field, and reverts the value of a field when its editor has not made any changes. When editing HTML source in CKEditor, the "change" event is not fired and the field is not flagged as having been changed, which will cause the field to be reverted in some conditions.

Steps to reproduce

  1. Edit a node with a body field that uses CKEditor.
  2. Press "Source" in the CKEditor instance, without making any other changes.
  3. Change the source to anything you like.
  4. Use the code inspector to inspect the accompanying, hidden textarea (its name will be "body[0][value]").
  5. The "data-editor-value-is-changed" attribute should be "true", but is not.
  6. Click "Source" again.
  7. Inspect the textarea again. The "data-editor-value-is-changed" is now correctly set to "true".

Proposed resolution

Using a solution similar to what is outlined at https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#even..., add code to behave similarly to the change event handler.

Remaining tasks

Develop and test.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

n/a

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States justin2pin

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.

Production build 0.71.5 2024