Search code examples
ckeditortypo3rtetypo3-8.7.x

Add dataProcessor to ckeditor yaml configuration in TYPO3


I'm wondering how to add a rule to the dataProcessor like it was possible in the old htmlarea.

In my case I want to add a fixed class to the "ul"-tag.

I tried something like that (tried to adapt the js configuration from ckeditor)

editor:
   config:
      format_p:
        - { element : 'p', attributes : { 'class' : 'ul' }}

...but it does not work.


Solution

  • I did it now via TypoScript like this:

    ### Set default class for ul from rte
    lib.parseFunc_RTE {
        externalBlocks := addToList(ul)
        externalBlocks {
            ul.stripNL = 1
            ul.callRecursive = 1
            ul.callRecursive.tagStdWrap.HTMLparser = 1
            ul.callRecursive.tagStdWrap.HTMLparser.tags.ul {
                fixAttrib.class.default = ul
            }
        }
    }
    

    It does basically what I want, BUT still I think this is not optimal. The class is not stored in the DataBase, so if you need to export the content for some reason you will loose this class. And you can not style it in the BE RTE-field (at least not without providing some extra hack css)

    So I'm still interested if there is a proper way of doing it in the ckeditor-config.