Bug #99738
closedEpic #99669: CKEditor5 Collection
Story #101905: CKEditor4 to CKEditor5 Migration Issues
CKEditor 5 in TYPO3 12: New Data-Attribute is removed when the content element is saved
100%
Description
In TYPO3 12 we rebuild the CKEditor Plugin in LUX. That plugin simply adds 3 data-attributes to a link tag.
In TYPO3 11 we use this settings in CKEditor.yaml:
editor: config: extraAllowedContent: 'a[data-*];'
and in addition this Page TSConfig:
RTE.default.proc.entryHTMLparser_db.tags { a.allowedAttribs := addToList(data-lux-email4link-sendemail,data-lux-email4link-text,data-lux-email4link-title,data-lux-linklistener) }
Are there any breaking changes here? Any hints?
Update: When toggling the HTML-view in CKEditor, the data-attributes are still existing - that's why I think the new problem is TYPO3 related.
Updated by Chris Müller over 1 year ago
- Category set to RTE (rtehtmlarea + ckeditor)
Updated by Wittkiel Gruppe over 1 year ago
- Related to Epic #99669: CKEditor5 Collection added
Updated by Sybille Peters about 1 year ago
Hint is that in ckeditor5 elements / attributes have to be explicitly allowed via plugins (see ckeditor5 documentation). Ckeditor5 was used since TYPO3 v12.
- https://ckeditor.com/docs/ckeditor5/latest/framework/index.html
- https://ckeditor.com/docs/ckeditor5/latest/framework/architecture/editing-engine.html
- https://ckeditor.com/docs/ckeditor5/latest/framework/deep-dive/conversion/downcast.html
Perhaps there are other ways to solve this but you can look at existing implementation in typo3-link.ts or look at patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/80035.
Update: When toggling the HTML-view in CKEditor, the data-attributes are still existing - that's why I think the new problem is TYPO3 related.
My observation was the opposite - when toggling between Source mode and not, some attributes are removed. However the behaviour is sometimes quite weird, see also #101205
I hope this helps.
Updated by Andreas Nedbal about 1 year ago
Sybille Peters wrote in #note-5:
Hint is that in ckeditor5 elements / attributes have to be explicitly allowed via plugins (see ckeditor5 documentation). Ckeditor5 was used since TYPO3 v12.
- https://ckeditor.com/docs/ckeditor5/latest/framework/index.html
- https://ckeditor.com/docs/ckeditor5/latest/framework/architecture/editing-engine.html
- https://ckeditor.com/docs/ckeditor5/latest/framework/deep-dive/conversion/downcast.html
Perhaps there are other ways to solve this but you can look at existing implementation in typo3-link.ts or look at patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/80035.
Update: When toggling the HTML-view in CKEditor, the data-attributes are still existing - that's why I think the new problem is TYPO3 related.
My observation was the opposite - when toggling between Source mode and not, some attributes are removed. However the behaviour is sometimes quite weird, see also #101205
I hope this helps.
Thank you for your suggestions Sybille, but sadly these do not apply here.
We already have all relevant up/downcasts defined for all attributes, so they are transformed properly. As mentioned above, when switching to the source view, they are visible on the HTML elements (which means the casts work) but they don't appear to be saved to the backend, which means that extraAllowedAttributes
and similar does not seem to apply.
Updated by Benjamin Franzke 11 months ago
We already have all relevant up/downcasts defined for all attributes
While I agree, that we got an issue here – extraAllowedContent
should be properly migrated to config.htmlSupport
for generic attributes to be allowed via GHS (General HTML Support Plugin)
…But you actually got some typos and issues in the lux-plugin which cause the mentioned issues of missing persistence:
I sent you a PR to fix those: https://github.com/in2code-de/lux/pull/43
With that you'll see that data attributes are preserved, the issue was that data attributes were not preserved between CKEditor5 view and data model.
Note that with upcoming config.htmlSupport
support (see #100861), all data attributes would be written to a new attribute named htmlA
encoded into a attributes
subproperty.So even if extraAllowedContent
is fixed, you should apply the mentioned PR, in order for your plugin to be able to use your custom model attributes, as they' will over htmlA
when properly configured as done in the PR.
Updated by Alex Kellner 11 months ago
Thx for your work. I just merged your PR in LUX and released it with version 34.0.2.
Updated by Benjamin Franzke 11 months ago
- Parent task changed from #99669 to #101905
Updated by Gerrit Code Review 11 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81316
Updated by Gerrit Code Review 11 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81338
Updated by Anonymous 11 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4f99a8d15715404fea7304788e7a75e0061169a1.
Updated by Chris Müller 10 months ago
- Related to Task #102126: Document usage of "htmlSupport" option in EXT:rte_ckeditor added