Issue Feature Under Review

#107421Allow configuration/usage of multiple richtext editor implementations

Andreas Nedbal 09/10/25, 09:17 updated 11/13/26, 12:57

Description

No description.

Reviews 1

Files 5

History 1050

Show 525 earlier messages
  1. Gerrit Code Review pushed patch set 6 for main to change 90612 status In Progress Under Review <span data-processor="relativetime" data-value="2025-09-10T09:18:39+00:00" > 09/10/25, 09:18 </span>

  2. Andreas Nedbal commented <span data-processor="relativetime" data-value="2025-09-10T09:59:05+00:00" > 09/10/25, 09:59 </span>

    Okay, the basics for this change are somewhat done. Further testing and a full-on feature RST are missing as of yet, but that’s because I’m not 100% satisfied myself yet with what I currently built. So, feedback appreciated.

    This change allows configuring multiple richtext editors side-by-side, instead of one just taking over the reigns completely. This comes in line with us making rte_ckeditor independent of the Core as well (it’s still a sysext but it can be removed without side-effects now).

    Anyway, my main gripe with my implementation is configuration:

    As of writing this comment, multi-RTE configuration works like this:

    • You can either set $GLOBALS['TYPO3_CONF_VARS']['RTE']['defaultEditor'] to your globally preferred editor.
    • In TCA type text you can set ...['config']['richtextEditor'] to the preferred editor of that field.
    • In PageTS you can set RTE.default.richtextEditor
      • …additionally, RTE.config.tt_content.bodytext.richtextEditor for field-specific adjustments as well

    What about presets?

    • If no richtextEditor is configured, we have a graceful fallback to the old behavior and per deprecation strategy we keep $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets'] for v14 anyway.
    • If richtextEditor is configured…
      • The same configuration path in a TCA text element works (...['config']['richtextConfiguration']), because it’s in tandem with the other setting. (while writing this I realized this probably won’t work this way)
      • In PageTS, per-editor presets are set in RTE.default.{{ editor }}.preset or RTE.config.tt_content.bodytext.{{ editor }}.preset
        • With ckeditor5 as an implemented example, the paths are RTE.default.ckeditor5.preset or RTE.config.tt_content.bodytext.ckeditor5.preset respectively
      • Globally configured presets in $GLOBALS['TYPO3_CONF_VARS']['RTE'][$editor]['Presets']
        • As above, with ckeditor5: $GLOBALS['TYPO3_CONF_VARS']['RTE']['ckeditor5']['Presets']

    To define/pick the fitting rendering per configured editor, I did the following:

    I moved RichTextNodeResolver back into EXT:core. It now checks for $GLOBALS['TYPO3_CONF_VARS']['RTE']['defaultEditor'] or ...['config']['richtextEditor'] being set, otherwise it falls back to ckeditor5 for now.

    Once that is set, it tries to pull the FQCN from $GLOBALS['TYPO3_CONF_VARS']['RTE'][$editor]['Element'] to return to FormEngine for building the node.

    In case the default fallback is happening and rte_ckeditor happens to not be installed, the user is greeted with a No richtext element configured for editor "ckeditor5" exception.

    Anyway, to my own gripes that I would like an opinion on:
    • The per-editor configuration structure. I was not sure if it makes sense to introduce a subkey into (basically all) places that holds the different editor implementations, an as RTE.* usually only contains preset-related configuration I thought it’d be okay to make per-editor keys directly inside it. I also picked this approached and not say RTE.presets.{{ editor }}.{{ presetName }} because the logic would then involve a lot of “is whatever is inside presets an array or a string?” and I honestly dislike that more than introducing a new top-level key.
    • Element registration. I’m not sure what’s the stance on adding new things to TYPO3_CONF_VARS, especially things like this. I personally dabbled with the idea of adding service provider stuff and adding an attribute like #[AsRichtextEditor(editor: 'ckeditor5')] which you could slap on the fitting FormEngine element, but that feels somewhat overkill. But I’m open to implementing this anyway if people prefer this.

    You can check out the current implementation in the attached patch which is already a WIP on Gerrit. As mentioned above, feedback is appreciated!

  3. Andreas Nedbal commented and changed attached Screenshot 2025-09-10 at 16.57.14.png attached Screenshot 2025-09-10 at 16.57.26.png attached Screenshot 2025-09-10 at 16.57.43.png <span data-processor="relativetime" data-value="2025-09-10T14:58:30+00:00" > 09/10/25, 14:58 </span>

    Made some sketches of the flow of data of the current, prototype and next implementation of this changeset.

  4. Andreas Nedbal commented and changed attached Screenshot 2025-09-19 at 19.29.52.png attached Screenshot 2025-09-19 at 19.35.28.png <span data-processor="relativetime" data-value="2025-09-19T17:42:49+00:00" > 09/19/25, 17:42 </span>

    Did some more work on this:

    Configuration loading kind of became an issue. We envisioned an idea that RichtextEditorBuilders would solely be responsible to load configuration in whatever way they fancy, and thus we can remove configuration handling in that regard from the core (configuration handling here being “load the YAML preset”). HOWEVER, I remembered that processing configuration is also part of that, and it does make sense that processing can be adjusted per-editor as well. And, in regards of loading order, the processing information is required before the FormEngine element is rendered, at the RteHtmlParser step (that’s roughly somewhere between TCA processing and rendering FormEngine).

    So, to handle this, I extended the RichtextEditorBuilderInterface with a getConfiguration method, which handles resolving of the configuration. This is then used instead of the (now removed) getConfigurationFromPreset method in the Richtext class.

    I’m not too sure about this approach, maybe we should split off processing configuration somehow, and make at least that standardized? I’d need feedback on that.

    ——

    Additionally, I implemented a FallbackEditorBuilder. If a non-registered RTE is requested, or none is configured, this fallback editor is returned, which simply renders a textarea. Above the textarea is a warning notice explaining why it is shown (either one of the earlier reasons). So now, no default configuration is set/required and no exception occurs either. (example screenshots are attached to the comment)

  5. Andreas Nedbal commented <span data-processor="relativetime" data-value="2025-10-01T09:07:48+00:00" > 10/01/25, 09:07 </span>

    I think I’m mostly done with the registry/builder and general element stuff, works as it should and has a sensible fallback.

    While integrating another RTE into TYPO3 I noticed some other things though that should be worked on:

    • BrowseLinksController is currently “RTE-specific” by design and resides in rte_ckeditor as well. The only thing it really does in terms of being RTE-specific is loading a JS-file that sends the finalized link back to CKEditor. We should move that into Backend as well, so it’s a general implementation and pull the required JS file via the RTE registry.
    • On note of that specific JS file, that should also be generalized so that implementation is way simpler and you only need to provide two methods to finalize and remove a link.
  1. Andreas Nedbal commented <span data-processor="relativetime" data-value="2026-01-28T09:37:30+00:00" > 01/28/26, 09:37 </span>

    @ghi Moving this conversation here because it’s more concept than implementation:

    > As a reader I wonder, how is RTEProc with HTML input/output processing affected? As this is often defined within the processing YAML of ckeditor.
    >
    > I assume the specific implementations would then need to take care of transforming/creating TSconfig for orocessing based on their own systems? If so, a paragraph about that would help

    This is the part that I struggled with the most conceptually. Previously this all was in one file (or in PageTS).

    Now that we technically handling off configuration loading to the implementer, I’m not 100% satisfied with this. If they just keep things “as-is” and follow the “”“standard”“” of adding a processing key to the root of their configuration, things work just fine…but that’s also quite strict for an otherwise “do-as-you-like” system.

    I thought about adding a getProcessingConfiguration(string presetName) method to the builder interface, which could for CKEditor just resolve the default configuration and pull the processing key out of it. But here I’m also concerned about increasing the complexity through this. (or rather perceived complexity for an implementer)

  2. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-01-28T10:59:07+00:00" > 01/28/26, 10:59 </span>

    > I thought about adding a getProcessingConfiguration(string presetName) method to the builder interface, which could for CKEditor just resolve the default configuration and pull the processing key out of it. But here I’m also concerned about increasing the complexity through this. (or rather perceived complexity for an implementer)

    How about:

    getProcessingConfigurationFromYaml(string $fileNameOfRteFile = ‘EXT:rte_ckeditor/Configuration/RTE/Processing.yaml’)

    getProcessingConfigurationFromArray(array $someArray)

    Then implementations could choose if they “just parse existing YAML” (they will have the challenge of offering custom configuration values that will need to point to these files). But they could also choose to completely deliver the “processing” configuration as a PHP array, and choose whatever configuration they want for it.

    Another way of course is to mention to RTE implementations that they will need to point their users toward using PageTS for definining processing. That on the other hand kind of busts all documentation about the YAML processing. So… I would argue we should try to “reuse” people’s existing YAML and hint alternate RTE implementations to “pretty please” re-use the “processing” configuration YAML directives.

    Does that make sense to you?

  3. Andreas Nedbal commented <span data-processor="relativetime" data-value="2026-02-05T15:50:30+00:00" > 02/05/26, 15:50 </span>

    If you want to test the current (review-ready) progress using TipTap, you can now do so.

    You can utilize the test-distribution inside the TYPO3 Core development setup, following these steps:
    • Setup a TYPO3 development environment (https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/)
    • Check out my patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/90612 in it
    • Set up the TYPO3 test distribution in Build/composer/
      • Clone typo3-tiptap into the packages subfolder and check out the branch 90612_editor_configuration
      • Copy the composer.dist.json to composer.json
      • Run ./Build/Scripts/runTests.sh -s composerTestDistribution -b docker
      • Add "in2code/typo3-tiptap": "dev”@ to the required packages
      • Run composer update in Build/composer (either in DDEV, Docker, locally, whereever your setup is)
      • Set the web root of your web server to Build/composer/public and restart it
      • If you already have a running TYPO3 instance from core development, just copy your config from typo3conf/config to Build/composer/config

    Log in and verify the extension is installed, now every RTE should be TipTap.

    Recommended steps: