Review main Merged

92812[FEATURE] Support RTE in form editor

Josua Vogel CR +2 V +2 Expert +2369 −89 updated 02/21/26, 10:04

Commit message

This change adds support for rich text editing in the TYPO3 form
editor backend. Form elements can now use CKEditor 5 for text
editing with configurable presets.

New Services:
- RichTextConfigurationService: Resolves CKEditor configuration
  from global TYPO3 RTE presets and prepares the configuration for
  the form editor context. Handles HTML transformation for
  persistence and RTE display using RteHtmlParser.
- FormEditorEnrichmentService: Enriches form editor definitions
  with RTE options at runtime for textarea editors.

RTE Presets:
Two new RTE presets are introduced specifically for form elements:
- form-label: Minimal formatting for labels (bold, italic, link)
- form-content: Extended formatting for content fields including
  lists (bulleted and numbered)

Processing Configuration:
Dedicated processing configurations ensure proper HTML handling:
- ProcessingLabel.yaml: Allows only essential inline tags
  (a, br, i, strong) for label fields
- ProcessingContent.yaml: Extended tag allowlist including
  list elements (ul, ol, li, p) for content fields

The TextareaEditor inspector component has been enhanced to
dynamically wrap textarea elements with the CKEditor 5 web
component when enableRichtext is set to true. It properly handles
the TYPO3 link browser integration and synchronizes content
changes back to the form model.

Security (multi-layer sanitization):

1. Backend (Form Editor save):
   - RteHtmlParser::transformTextForPersistence() sanitizes content
     using the htmlSanitize.build from the RTE preset configuration
   - FormDefinitionConversionService::sanitizeHtml() provides
     additional sanitization using the preset-specific sanitizer

2. Backend (Form Editor load / ArrayFormFactory):
   - sanitizeHtml() ensures all form definitions are sanitized,
     including those from external YAML files that were never
     processed through the form editor

3. Frontend (form rendering):
   - f:sanitize.html() ViewHelper provides defense-in-depth
     sanitization before output

Custom sanitizer builders are supported via the RTE preset
configuration. See the feature documentation for details on
frontend customization options.

Configuration options for TextareaEditor:
- enableRichtext: Enable/disable rich text editing for a textarea
- richtextConfiguration: Specify RTE preset name (form-label,
  form-content, default, minimal, full, or custom)

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
    • Sven Liebert +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
    • Sven Liebert +1
    • core-ci +1 CI

Issues 4

Files 39

Show 19 more files

Review log 4058

Show 2233 earlier messages
  1. Josua Vogel uploaded patch set 1 02/12/26, 09:57

  2. core-ci voted on patch set 1 V -1 02/12/26, 10:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95700

  3. Josua Vogel uploaded patch set 2 V -1 02/12/26, 17:21

  4. core-ci voted on patch set 2 V +1 02/12/26, 17:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95760

  5. Josua Vogel commented on patch set 3 V +1 02/12/26, 18:21

    Published edit on patch set 2.
  6. core-ci voted on patch set 3 V -1 02/12/26, 18:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95763

  7. Josua Vogel uploaded patch set 4 V -1 02/12/26, 19:12

  8. core-ci voted on patch set 4 V +1 02/12/26, 19:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95766

  9. Georg Ringer commented on patch set 4 02/12/26, 21:08

    this is sooo cool! just a nitpicking. the label "a field for unformatted text" is now not true anymore and what if rte_ckeditor is not installed?
  10. Garvin Hicking commented on patch set 4 02/12/26, 21:12

    We'll need to keep this in line with https://review.typo3.org/c/Packages/TYPO3.CMS/+/90612 @andy@pixelde.su (you both probably now, just for the sake of completion)
  11. Josua Vogel commented on patch set 4 02/13/26, 06:40

    Reply

    Thanks Garvin, a quick glance: Andreas' implementation should eliminate some code here :) If this is to be merged, I would subsequently build the form part at Andreas' patch or create a follow-up.
  12. Josua Vogel uploaded patch set 5 V +1 02/13/26, 07:12

  13. Josua Vogel commented on patch set 5 02/13/26, 07:14

    Reply

    Updated the label and added a check to determine whether rte_ckeditor is installed. If not, it falls back to a plain textarea.
  14. Georg Ringer commented on patch set 5 02/13/26, 07:15

    Database.xlf:1162

    read-only? not sure if this is valid, either "rich text content" or just "text content"
  15. Josua Vogel commented on patch set 6 02/13/26, 07:16

    Published edit on patch set 5.
  16. Josua Vogel commented on patch set 6 02/13/26, 07:17

    Database.xlf:1162 Reply

    Done
  17. core-ci voted on patch set 5 V +1 02/13/26, 07:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95802

  18. core-ci voted on patch set 6 V +1 02/13/26, 07:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95803

  19. Guido Schmechel commented on patch set 6 V +1 02/14/26, 10:25

    The static text has been successfully tested html in the backend. But shouldn't we add more to the tests? For example, two new classes are being added here.
  20. Josua Vogel commented on patch set 6 02/14/26, 10:38

    Reply

    Absolutely! I will add some tests soon
  21. Josua Vogel uploaded patch set 7 V +1 02/15/26, 14:37

  22. Josua Vogel marked it work in progress 02/15/26, 14:45

  23. core-ci voted on patch set 7 V -1 02/15/26, 14:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95930

  24. Josua Vogel uploaded patch set 8 V -1 02/15/26, 15:01

  25. Josua Vogel uploaded patch set 9 02/15/26, 15:04

  26. core-ci voted on patch set 9 V -1 02/15/26, 15:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95932

  27. Josua Vogel uploaded patch set 10 V -1 02/15/26, 15:29

  28. Josua Vogel marked it ready for review 02/15/26, 15:30

  29. Josua Vogel commented on patch set 10 02/15/26, 15:32

    Reply

    I have added some tests.
  30. core-ci voted on patch set 8 V -1 02/15/26, 15:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95931

  31. core-ci voted on patch set 10 V +1 02/15/26, 15:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95933

  32. Josua Vogel uploaded patch set 11 V +1 02/15/26, 16:19

  33. core-ci voted on patch set 11 V +1 02/15/26, 16:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95934

  1. Josua Vogel uploaded patch set 12 V +1 02/16/26, 11:50

  2. core-ci voted on patch set 12 V +1 02/16/26, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95962

  3. Andreas Nedbal commented on patch set 12 CR +1 V +1 02/16/26, 14:08

    Looks good to me. Can't 100% verify the actual usage as I have barely any experience with EXT:form but what I've seen and tested looks fine!
  4. Garvin Hicking commented on patch set 12 02/17/26, 13:45

    ArrayFormFactory.php:59

    How to define a custom builder?

    Checkbox.fluid.html:23

    So I have a bit of a concern here regarding the processing: 1.) If I read this right, editors will by default now be able to enter any kind of HTML. The output is solely passed through the sanitize.html and transform.html functionality, so probably now HTML can occur at places that integrators / theme builders might not have accounted for. I wonder if this should thus be gated at some place that an integrator has a say over, and a place to at least opt out easily (without the need to edit every single form) 2.) I believe (untested) you can tamper with the CKEditor inside the browser. You can convert the input textarea to a plain textarea and then insert any kind of HTML, which will later be shown (unless it is javascript), because the Default Sanitizer Builder allows a lot of tags. Usually the frontend based rendering for CKEditor via RTE.processing and the HtmlParser stuff for input/output processing takes care of this in content elements, but that's not given here. So I wonder if we can inject HTML tags outside of the scope that CKEditor would allow, and break frontend rendering. Thoughts?
  5. Josua Vogel commented on patch set 12 02/17/26, 16:52

    ArrayFormFactory.php:59 Reply

    This is not possible in the current implementation. I am considering how this can be configured.

    Checkbox.fluid.html:23 Reply

    1) In principle, this only affects the checkbox form element and static text. An integrator could simply use their own template and adjust the checkbox definition so that enableRichtext: false is set. It is not necessary to edit every form. 2) I have to try this 😊 Maybe a Custom Sanitizer would prevent "unwanted" tags?
  6. Garvin Hicking commented on patch set 12 02/17/26, 17:39

    Checkbox.fluid.html:23 Reply

    About 2: we'd probably need to define a sanitizer builder then, and offering a very reduced one. Plus be able for integrators to easily use their own to remedy this problem woth missing RTE processing. That would however be a different approach to how "everyplace else" does it. Then again, ext:form is known for its extrawurst. Maybe the default form sanitizer could only allow strong/em/a href (matching the very restricted default RTE preset) for some sense of "editors cannot break this easily with block-level elements suddenly".
  7. Josua Vogel uploaded patch set 13 CR +1 V +1 02/18/26, 15:32

  8. core-ci voted on patch set 13 V +1 02/18/26, 16:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96162

  9. Josua Vogel uploaded patch set 14 V +1 02/18/26, 16:59

  10. Josua Vogel marked it work in progress 02/18/26, 16:59

  11. core-ci voted on patch set 14 V +1 02/18/26, 17:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96178

  12. Josua Vogel uploaded patch set 15 V +1 02/19/26, 10:42

  13. core-ci voted on patch set 15 V -1 02/19/26, 10:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96232

  14. Josua Vogel uploaded patch set 16 V -1 02/19/26, 12:02

  15. Josua Vogel commented on patch set 16 02/19/26, 12:04

    This change is ready for review.

    Checkbox.fluid.html:23 Reply

    I added an approach that reads the processing configuration and uses the RteHtmlParser between FormEditor and Persistence.
  16. core-ci voted on patch set 16 V +1 02/19/26, 12:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96240

  17. Josua Vogel uploaded patch set 17 V +1 02/19/26, 13:18

  18. Josua Vogel commented on patch set 17 02/19/26, 13:19

    ArrayFormFactory.php:59 Reply

    Now you can set a custom sanitizer via the processing config of the preset. I added to the feature rst how to use a custom sanitizer build.
  19. core-ci voted on patch set 17 V +1 02/19/26, 13:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96243

  20. Josua Vogel uploaded patch set 18 V +1 02/20/26, 17:29

  21. core-ci voted on patch set 18 V +1 02/20/26, 17:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96391

  22. Garvin Hicking commented on patch set 18 CR +1 V +1 02/20/26, 20:17

    Massive kudos. I've tested this now in every facet I could imagine and I think your effort for the extra processing/builder mile is well worth it. I must admit it is a bit of a burden maintenance-wise, but then again it adheres to the rest of our sanitizer/processing workflow and encapsulates that in a good service class. The editorial impact of finally being able to add links and formatting to checkboxes is something that I've often heard was crucially missing. So I have to get off my soapbox now and want to emphasize all the effort you put into it. Thank you!

    ArrayFormFactory.php:59 Reply

    Done

    Checkbox.fluid.html:23 Reply

    Done
  23. Sven Liebert voted on patch set 18 CR +1 V +1 02/20/26, 23:09

  24. Georg Ringer voted on patch set 18 CR +2 V +2 02/21/26, 10:04

  25. Georg Ringer merged patch set 19 02/21/26, 10:04