Project

General

Profile

Actions

Bug #102488

closed

Epic #99669: CKEditor5 Collection

CkEditor on TYPO3 12.4.2 does not allow <i/>-Tag for FontAwesome Glyphs

Added by Gabriel Kaufmann / Typoworx NewMedia 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2023-11-23
Due date:
% Done:

0%

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

Description

I've migrated a TYPO3 Site to TYPO3 12.4.2 and I need to preserve the functionality of FontAwesome Glyphs which are in the RTE-HTML.

Existing (migrated) Glyphs are embedded like this:
<em class="fa-user-headset far"></em>

The new CkEditor-Plugin I'm trying to use inserts this Markup (but I also could switch it to i):
<i class="fa-user-headset far"></i>

What happens:
I've tried to configure CkEditor using YAML to accept that Tag, but nevertheless what I'm trying it's always removed immediately after it has been inserted using either CkEditor-Plugin or manually using HTML-Source editing.

If I'm manually editing this HTML-Markup (using HTML-Source):
<i class="fa-user-headset far">&nbspM</i>

The tag immediately removed (after switching back from Source-Edit to RTE-View).

If I'm manually editing this HTML-Markup (using HTML-Source):
<i class="fa-user-headset far">X</i>

It results into this, whereas the tag isn't removed, but the class attribute is missing.
<i>X</i>

Due to testing to get it working I had this RTE-YAML config settings.
Of course I also switched the RTE-Preset config to use my own sitepackage RTE-Config.

imports:
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }

processing:
  allowTags:
   - i

  allowAttributes
   - class

  HTMLparser_db:
    denyTags = img
    tags:
      i:
        allowedAttribs: ['class']

But all these settings still won't result into a working behaviour. I've been fiddling and researching the internet now for nearly one working day without progress.

Is this a bug or is there missing something in RTE/YAML Configuration?

Actions #1

Updated by Chris Müller 5 months ago

Can you update to the current version (12.4.8)? There were quite some fixes added in this area since 12.4.2. Maybe this is already fixed.

Actions #2

Updated by Chris Müller 5 months ago

  • Status changed from New to Needs Feedback
Actions #3

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 months ago

Chris Müller wrote in #note-1:

Can you update to the current version (12.4.8)? There were quite some fixes added in this area since 12.4.2. Maybe this is already fixed.

Thanks for the hint! After the update it worked.

Actions #4

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 months ago · Edited

Gabriel Kaufmann / Typoworx NewMedia wrote in #note-3:

Thanks for the hint! After the update it worked.

Well there's still some culprit. It worked with <i class="fa fa-user">Some Text</i> which produces non-empty HTML-Tag. But using it like it should be:
<i class="fa fa-user"></i>
or even
<i class="fa fa-user"> </i>

still doesn't work. It's removed again with html-tag that only has class and no inner-text.

This is my current RTE YAML Config. Is there something missing to allow i-tag without inner-text and class?

editor:
  config:
    coreStyles_italic:
      element: 'i'
      overrides: 'span'

processing:
  HTMLparser_db:
    tags:
      i:
        allowedAttribs: ['class']
Actions #5

Updated by Chris Müller 5 months ago

  • Status changed from Needs Feedback to New
Actions #6

Updated by Wittkiel Gruppe 5 months ago

Gabriel Kaufmann / Typoworx NewMedia wrote in #note-4:

Well there's still some culprit. It worked with <i class="fa fa-user">Some Text</i> which produces non-empty HTML-Tag. But using it like it should be:
<i class="fa fa-user"></i>
or even
<i class="fa fa-user"> </i>

still doesn't work. It's removed again with html-tag that only has class and no inner-text.

This is my current RTE YAML Config. Is there something missing to allow i-tag without inner-text and class?

This works for us:

editor:
  config:
    htmlSupport:
      allowEmpty:
        - 'i'
        - 'span'
        - 'em'

https://ckeditor.com/docs/ckeditor5/latest/api/module_html-support_generalhtmlsupportconfig-GeneralHtmlSupportConfig.html#member-allowEmpty

Actions #7

Updated by Chris Müller 5 months ago

  • Parent task set to #99669
Actions #8

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 months ago

@Wittkiel Gruppe you made my day. That's working!

Additionally I removed this code which doesn't seem to be valid for YAML or at least doesn't seem to be required:

processing:
  allowTags:
    - 'i'

  allowAttributes:
    - 'aria-hidden'

  HTMLparser_db:
    tags:
      i:
        allowedAttribs: ['class','aria-hidden']

Actions #9

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 months ago

I think this topic can be closed at this point.

Actions #10

Updated by Christian Kuhn 5 months ago

  • Status changed from New to Closed

closing as requested.

Actions

Also available in: Atom PDF