Review 13.4 Merged

88480[BUGFIX] Update CKEditor model in source edit view on input

Benjamin Franzke CR +2 V +2 Easy +24 −5 updated 03/04/25, 18:48

Commit message

This patch fixes a bug where changes made in "Source" editing mode
would not be checked during FormEngine validation, mistakenly allowing
to save records when an RTE field is marked as 'required'.

Our CKEditor integration allows to edit the editor document's source
code by default by toggling the "Source" button in the UI. Originally,
the editor model is updated once either the document is saved or the
user disables source editing again.

This has the disadvantage that FormEngine cannot intercept any changes
in an early state, e.g. marking a field as "changed". If source editing
gets enabled, an event listener for the `input` event is now registered
on the textarea that is rendered by source editing, which we have to
pick by ourselves as it is considered private API. The custom event
handler updates the editor model on every input. Since this might cause
performance bottlenecks, the update is debounced every few milliseconds.

Since we deal with private API which might break in future CKEditor
updates, an error is explicitly thrown if the textarea cannot be found.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 1

Files 2

Review log 34

  1. Benjamin Franzke commented on patch set 1 03/04/25, 14:42

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 03/04/25, 14:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75106

  3. Benjamin Franzke voted on patch set 1 CR +2 V +2 03/04/25, 18:48

  4. Benjamin Franzke merged patch set 2 03/04/25, 18:48