seirerman
seirerman

Reputation: 23

TYPO3 12 and CKEditor 5 - Remove unwanted attributes and styles from <td>

Copy text from a heavily formatted MS Word document into a CKEditor field, and most of the tags and attributes are removed upon saving the content element. This is what I want, but some attributes still remain.

One example from a MS Word document containing a table with background colors, customized padding etc. leads to this in TYPO3:

<td style="background-color:yellow;border-bottom:1.0pt solid windowtext;border-left-style:none;border-right:1.0pt solid windowtext;border-top-style:none;height:31.2pt;padding:0cm;width:73.65pt;">

I want the whole style attribute (maybe keep the width) gone in TYPO3, but my config seems to be ignored:

editor:
  config:
    htmlSupport:
      allow:
        - { name: 'p', attributes: false, classes: false, styles: false }
        - { name: 'span', attributes: ['title','lang', 'dir'], classes: false, styles: false }
        - { name: 'abbr', attributes: ['title'], classes: false, styles: false }
        - { name: 'table', attributes: false, classes: true, styles: false }
        - { name: 'th', attributes: ['scope'], classes: true, styles: { 'width': true } }
        - { name: 'td', attributes: ['width'], classes: true, styles: { 'width': true } }

Style attributes are removed from <p> tags, but not from <td>. The "remove format" button doesn't remove the styles, either. Neither does this:

...
        - { name: 'td', attributes: ['width'], classes: true, styles: false }

Any idea how to do this in TYPO3 12? Maybe with additional TypoScript?

Upvotes: 1

Views: 7

Answers (0)

Related Questions