Skip to content
Snippets Groups Projects
Commit 9b1ef298 authored by Garvin Hicking's avatar Garvin Hicking
Browse files

[BUGFIX] Allow to use CKEditor style definitions with an empty class

The CKEditor default YAML configuration for the Full and Default
presets contained code like:

```
- { name: 'Orange title H2', element: 'h2', classes: [],
    styles: { color: 'orange', background: 'blue' } }
- { name: 'Orange title H3', element: 'h3', classes: [],
    styles: { color: 'orange', background: 'blue' } }
- { name: 'Quote / Citation', element: 'blockquote', classes: [],  }
- { name: 'Code block', element: 'code', classes: [],  }
- { name: 'Yellow marker', element: 'span', classes: [],
    styles: { background-color: 'yellow' } }
```

and

```
- { name: "Lead", element: "p", classes: ['lead'] }
- { name: "Small", element: "small", classes: [] }
- { name: "Muted", element: "span", classes: ['text-muted'] }
```

CKEditor 5 expects the "classes" attribute to contain an array of
strings (or just a string) and not an empty array. Otherwise
choosing such a style  will have no effect in the CKEditor instance.

The CKEditor5Migrator class has been enhanced to convert these
empty or absent arrays to a `['']` definition on the fly. This allows
integrators to continue using their hard-earned CKEditor
YAML configurations without further change.

The default YAML presets have been changed to omit the classes
attribute, as that's what the intention of the configuration is.
While this is a proprietary TYPO3 modification, we need this
because of limited CKEditor5 functionality regarding classes handling.
Also, the no longer valid "styles:" definitions have been removed.

Resolves: #103979
Resolves: #103499
Releases: main, 12.4
Change-Id: Iad6f1a25c071ac70b51db2a3344b7c3bcd9f9687
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84679


Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent 878625ad
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment