Problem/Motivation
The release of Drupal 10.2.5 has introduced a regression in (but not limited to) Site Studio's implementation of CKEditor 5 that results in user input being lost if they type too fast.
- A user types into Standard install profile's "Article" node type's "body" field
- Uses the Drupal.editors.ckeditor5.onChange event to pull the value of the editor using ckInstance.getData() and store that in a JSON blob.
- Since this change https://git.drupalcode.org/project/drupal/-/commit/5540b5f84a6ae7899df01... if a user types multiple characters in quick succession, only the first character they type is registered in the on change event and all subsequent inputs are lost.
- I think the issue is due to the use of the immediate variable on the debounce call.
Steps to reproduce
If you paste this snippet into the JS console on a node page with a CKEditor instance and then type into the editor quickly vs slowly, you can see the issue. When typing quickly the onChange event is fired after the first user input but not fired again after the user types their last input.
Drupal.editors.ckeditor5.onChange(document.getElementById('edit-body-0-value'), () => {
const ckInstance = Drupal.CKEditor5Instances.values().next().value;
console.log(ckInstance.getData())
});
I've attached a video showing the above steps to test demonstrating the issue.