Bug #92943
openRTE ckeditor does not respect YAML configuration
0%
Description
Hello Core-Team,
the rte_ckeditor does not respect my YAML configuration. In following some examples.
The default value of bloclElementList is a comma separated list of HTML tags: "DIV,TABLE,BLOCKQUOTE,PRE,UL,OL,H1,H2,H3,H4,H5,H6,ADDRESS,DL,DD,HEADER,SECTION,FOOTER,NAV,ARTICLE,ASIDE"
I override these tags inside of YAML:
processing: blockElementList: - table - blockquote - ul - ol - h3 - h4 - h5
As we have YAML, these values will be converted into an array and will be processed by core that way:
$tags = array_unique(GeneralUtility::trimExplode(',', $tag, true));
Which results into $tags with a value of: [0 => "1"]
In case of "allowTagsOutside" it is working correct, as you check against "allowTagsOutside.":
// Override tags which are allowed outside of <p> tags if (isset($this->procOptions['allowTagsOutside'])) { if (!isset($this->procOptions['allowTagsOutside.'])) { $this->allowedTagsOutsideOfParagraphs = GeneralUtility::trimExplode(',', strtolower($this->procOptions['allowTagsOutside']), true); } else { $this->allowedTagsOutsideOfParagraphs = (array)$this->procOptions['allowTagsOutside.']; } }
In case of "allowAttribute" you only allow array. There is no check on string and no trimExplode on ",":
// Define which attributes are allowed on <p> tags if (isset($this->procOptions['allowAttributes.'])) { $this->allowedAttributesForParagraphTags = $this->procOptions['allowAttributes.']; }
Ok, another example
processing: HTMLparser_db: tags: p: fixAttrib: style: list: - 'text-align: left;' - 'text-align: right;'
This will be converted to an array, too. But this will break "range" and "list" processing as they expect a string value:
if ((string)$keepTags[$key]['fixAttrib'][$atName]['range'] !== '') { $keepTags[$key]['fixAttrib'][$atName]['range'] = GeneralUtility::trimExplode(',', $keepTags[$key]['fixAttrib'][$atName]['range']); } if ((string)$keepTags[$key]['fixAttrib'][$atName]['list'] !== '') { $keepTags[$key]['fixAttrib'][$atName]['list'] = GeneralUtility::trimExplode(',', $keepTags[$key]['fixAttrib'][$atName]['list']); }
Either all values must be compatible with string AND array, or we should deliver a new example of TYPO3s default YAML files where all properties are declared as string only.
Stefan
Updated by Stefan Froemken almost 4 years ago
Same problem with "denyTags":
$denyTags = GeneralUtility::trimExplode(',', $this->procOptions['denyTags'] ?? '', true);
But in case of "allowTags" it works as you convert it back to comma separated list:
if (isset($this->procOptions['allowTags.']) && is_array($this->procOptions['allowTags.'])) { $keepTags = implode(',', $this->procOptions['allowTags.']); } else { $keepTags = $this->procOptions['allowTags'] ?? ''; } $keepTags = array_flip(GeneralUtility::trimExplode(',', $this->defaultAllowedTagsList . ',' . strtolower($keepTags), true));
Updated by Benni Mack almost 3 years ago
- Related to Bug #87400: CKEditor: assign correct CSS class to tags with entryHTMLparser_db added
Updated by Benni Mack almost 3 years ago
- Related to Feature #87314: allowedAttribs / allowAttributes usage in config added
Updated by Eric Harrer over 2 years ago
- Related to Bug #97499: Wrong notation for value of allowedAttribs in Processing.yaml added
Updated by Stefan Froemken 5 months ago ยท Edited
I have created my own Preset:
imports: - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" } processing: blockElementList: - table - blockquote - ul - ol - h3 - h4 - h5
and activated it as new default (page TSconfig):
RTE.default.preset = sf
Just opening an content element with RTE results instant in following error:
Cannot assign int to property TYPO3\CMS\Core\Html\RteHtmlParser::$blockElementList of type string
convertPlainArrayToTypoScriptArray will result in
proc.blockElementList = 1 proc.blockElementList. = [ 0 => table, 1 => blockquote, 2 => ul, 3 => ol, 4 => h3, 5 => h4, 6 => h5, ]
As "1" is INT it will fail while assigning this value to class property "blockElementList" which is defined as string
Updated by Gerrit Code Review 5 months ago
- Status changed from New 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/+/85137
Updated by Gerrit Code Review 5 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/+/85137
Updated by Gerrit Code Review 5 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/+/85137
Updated by Gerrit Code Review about 1 month 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/+/85137
Updated by Gerrit Code Review 28 days 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/+/85137