Issue Bug Closed

#103979Bug in cms-rte-ckeditor: "small" element not usable in Composer-mode

Harald Witt 06/05/24, 05:50 updated 10/15/24, 09:30

Description

I found an error in cms-rte-ckeditor. In Configuration/RTE/Default.yaml and Configuration/RTE/Full.yaml you can find the following lines:

 style:
      definitions:
        - { name: "Lead", element: "p", classes: ['lead'] }
        - { name: "Small", element: "small", classes: [] }

The -Tag does not function. But it will with the following line:

     - { name: "Small", element: "small", classes: [''] }

This will result in a -Tag with an empty class, but it does function at least.

Reviews 2

History 717

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-06-05T11:53:46+00:00" > 06/05/24, 11:53 </span>

    In my installation (Firefox, Chromium, Safari) I can use “small” in the RTE, no matter if I:

    • use ", classes: []"
    • use ", classes: ['']"
    • drop ", classes: []" alltogether

    In all three cases though, a <small class=""> is emitted for me…

    Can you provide some details, is maybe some other extension also changing YAML RTE configuration, or maybe affect it via JS?

  2. Harald Witt commented <span data-processor="relativetime" data-value="2024-06-05T13:25:53+00:00" > 06/05/24, 13:25 </span>

    Garvin Hicking wrote in #note-1:
    > In my installation (Firefox, Chromium, Safari) I can use “small” in the RTE, no matter if I:
    >
    > * use ", classes: []"
    > * use ", classes: ['']"
    > * drop ", classes: []" alltogether
    >
    > In all three cases though, a <small class=""> is emitted for me…
    >
    > Can you provide some details, is maybe some other extension also changing YAML RTE configuration, or maybe affect it via JS?

    Hi Garvin,

    I’m using Windows 10 with Chrome 125.0.6422.142. I also tried Firefox 124.0.2 and MS-Edge 125.0.2535.85. All the latest version.
    But the problem is the same in all 3 browsers:

    • use ", classes: []" does simply not function
    • use ", classes: ['']" functions properly
    • drop ", classes: []" alltogether makes, that the style-dropdown gives up completely (no dropdown possible)

    I have nothing in Backend what would influence the RTE YAML config. And also no additional JavaScript.

    And because I know that it smells like a JS inteference i’ve tried another Typo3 instance …
    I’ts a Typo3 12.4.11 instance, I’ve installed from scratch a few months before. And inside is beside the usual cms-extensions only one lonely EXT. And the latter only contains some TCA definitions – nothing else.
    But the problem is the same. Seems to be OS / Browser dependent.

    Greetings
    Harald
    BTW: You can also contact me in Typo3 Slack, e. g. https://app.slack.com/client/T024TUMLZ/C03AM9R17

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-06-05T15:00:01+00:00" > 06/05/24, 15:00 </span>

    I’ll contact you and check if I could maybe verify this in your installation to see if it’s browser or installation-related.

    (Recent firefox should be 126.0.1 not 124.0.1 though)

  4. Garvin Hicking commented and changed subject Bug in cms-rte-ckeditor Bug in cms-rte-ckeditor: "small" element not usable in Composer-mode status Needs Feedback Accepted <span data-processor="relativetime" data-value="2024-06-06T12:36:43+00:00" > 06/06/24, 12:36 </span>

    Color me surprised:

    • It works in Legacy mode for me in both main + v12.4 (i.e. GIT checkout)
    • It does NOT work in TYPO3 v12.4 composer mode with a completely vanilla installation (no extensions at all)

    Steps to reproduce:

    • Create directory like “t3-vanilla”
    • Have a simple composer.json [1]
    • Create a ddev project (“ddev config” > pick some name, docroot “htdocs”, project type “typo3”
    • ddev composer install
    • ddev restart
    • ddev launch typo3/install.php -> perform installation
    • open backend
    • Create an empty dummy page
    • Create a content element “Regular text”
    • In the bodytext enter any random text, select the text, choose dropdown “Styles” from CKeditor instance, pick “small”
    • No HTML layout will be applied

    If you edit the file `./vendor/typo3/cms-rte-ckeditor/Configuration/RTE/Default.yaml` and change:

    - { name: "Small", element: "small", classes: [] }

    to:

    - { name: "Small", element: "small", classes: [''] }

    it will indeed work when reloading the browser. Removing “, classes: []” will break the dropdown.

    Since “classes: [‘’]” works in both legacy mode and composer mode, I’d argue using that to unbreak composer mode would be fair.

    [1] composer.json

    {
      "name": "debug/t3v12-vanilly",
      "version": "1.0.0",
      "require": {
        "ext-mysqli": "*",
        "ext-pdo": "*",
        "ext-iconv": "*",
        "ext-json": "*",
        "ext-simplexml": "*",
        "ext-openssl": "*",
    
        "typo3/minimal": "^12.0",
    
        "typo3/cms-fluid-styled-content": "^12.3",
        "typo3/cms-info": "^12.3",
        "typo3/cms-recycler": "^12.3",
        "typo3/cms-reports": "^12.3",
        "typo3/cms-rte-ckeditor": "^12.3",
        "typo3/cms-scheduler": "^12.3",
        "typo3/cms-setup": "^12.3",
        "typo3/cms-tstemplate": "^12.3",
        "typo3/cms-belog": "^12.3",
        "typo3/cms-beuser": "^12.3",
        "typo3/cms-adminpanel": "^12.3",
        "typo3/cms-filemetadata": "^12.3",
        "typo3/cms-impexp": "^12.3",
        "typo3/cms-viewpage": "^12.3",
        "typo3/cms-lowlevel": "^12.3",
        "typo3/cms-redirects": "^12.3",
        "typo3/cms-seo": "^12.3",
        "typo3/cms-felogin": "^12.3",
        "typo3/cms-form": "^12.3"
      },
    
      "extra": {
        "typo3/cms": {
          "cms-package-dir": "{$vendor-dir}/typo3/cms",
          "web-dir": "htdocs"
        }
      },
      "config": {
        "allow-plugins": {
          "typo3/cms-composer-installers": true,
          "typo3/class-alias-loader": true
        }
      }
    }
  5. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-06-11T10:07:49+00:00" > 06/11/24, 10:07 </span>

    Small update. The reason it worked in my legacy install tests was because there I had the “bootstrap_package” installed which operated on the RTE configurations.

    So the “classes: []” in fact seems broken everywhere. Sorry for getting off-track here and overcomplicating things with the way I tested it.

  6. Gerrit Code Review pushed patch set 1 for main to change 84679 status Accepted Under Review <span data-processor="relativetime" data-value="2024-06-13T08:21:35+00:00" > 06/13/24, 08:21 </span>

  7. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-08-29T10:00:10+00:00" > 08/29/24, 10:00 </span>

    Applied in changeset commit:1ab46cb3aed8e40c09eb19f7a11720567589c7b1.