Project

General

Profile

Actions

Bug #99738

closed

Epic #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

Added by Alex Kellner about 1 year ago. Updated 7 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2023-01-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Stabilization Sprint

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #102126: Document usage of "htmlSupport" option in EXT:rte_ckeditorClosedChris Müller2023-10-09

Actions
Actions #1

Updated by Chris Müller about 1 year ago

  • Category set to RTE (rtehtmlarea + ckeditor)
Actions #2

Updated by Alex Kellner about 1 year ago

  • Description updated (diff)
Actions #3

Updated by Wittkiel Gruppe about 1 year ago

Actions #4

Updated by Benni Mack 11 months ago

  • Sprint Focus set to Stabilization Sprint
Actions #5

Updated by Sybille Peters 9 months ago

Hint is that in ckeditor5 elements / attributes have to be explicitly allowed via plugins (see ckeditor5 documentation). Ckeditor5 was used since TYPO3 v12.

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.

Actions #6

Updated by Andreas Nedbal 9 months 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.

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.

Actions #7

Updated by Benjamin Franzke 8 months ago

  • Parent task set to #99669
Actions #8

Updated by Benjamin Franzke 7 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.

Actions #9

Updated by Benjamin Franzke 7 months ago

  • Status changed from New to Accepted
Actions #10

Updated by Alex Kellner 7 months ago

Thx for your work. I just merged your PR in LUX and released it with version 34.0.2.

Actions #11

Updated by Benjamin Franzke 7 months ago

  • Parent task changed from #99669 to #101905
Actions #12

Updated by Gerrit Code Review 7 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

Actions #13

Updated by Gerrit Code Review 7 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

Actions #14

Updated by Gerrit Code Review 7 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

Actions #15

Updated by Gerrit Code Review 7 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

Actions #16

Updated by Gerrit Code Review 7 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

Actions #17

Updated by Gerrit Code Review 7 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

Actions #18

Updated by Gerrit Code Review 7 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

Actions #19

Updated by Anonymous 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #20

Updated by Chris Müller 7 months ago

  • Related to Task #102126: Document usage of "htmlSupport" option in EXT:rte_ckeditor added
Actions

Also available in: Atom PDF