TYPO3 9.5.4 CKEditor RTE deletes style attributes

Deadly 提交于 2021-01-28 18:44:08

问题


I updated a TYPO3 website from 7->8->9. Now the problem is that the RTE CKEditor keeps deleting style attributes and even styles.

So and old Element with content:

<div class="mobilr">
<table height="655" width="972" style="vertical-align: middle; background-color: rgb(255, 255, 255); border-style: solid; border-color: rgb(187, 187, 187);" class="centertable">
<tbody>
<tr style="vertical-align: middle;">
<td>
<p>&nbsp;</p>
....

is loaded in the editor as:

<table class="centertable" style="height:655px; width:972px">   
<tbody>     
    <tr>    
        <td>        
    <p>&nbsp;</p>
...

So when you save you loose your style information. I tried the following TypoScript:

RTE.default.proc.allowedClasses = centertable, mobilr
RTE.default.proc.allowTags = table, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, div, p, br, span, ul, ol, li, strong, em, b, i, u, sub, sup, a, img, hr, abbr, acronym, cente
RTE.default.proc.keepPDIVattribs := addToList(style)
RTE.default.proc.entryHTMLparser_db.tags.p.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.td.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.tr.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.table.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.div.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.h1.allowedAttribs = class, align, style
RTE.default.proc.entryHTMLparser_db.tags.h2.allowedAttribs = class, align, style

This sadly has no effect. I placed the code in my setup and on the page. Is there a way to completely shut down the entryHTMLparser or another idea to solve this without using TS?

Thank you in advance for your help.


回答1:


That could be the configuration in the .yaml files; I see in the

EXT:rte_ckeditor/Configuration/RTE/Processing.yaml:

processing:
    allowAttributes: [class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop]

You can provide your own configuration following for example this guide; I'd try with

processing:
    allowAttributes: [class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop, style]


来源:https://stackoverflow.com/questions/55741464/typo3-9-5-4-ckeditor-rte-deletes-style-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!