#92943RTE ckeditor does not respect YAML configuration
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
Reviews 6
- main 74473[BUGFIX] Allow allowedAttribs HTMLParser as either string or array
- 13.4 88734[BUGFIX] Allow allowedAttribs HTMLParser as either string or array
- main 85137[BUGFIX] Read RTE options as string and array
- 13.4 88476[BUGFIX] Read RTE options as string and array
- 13.4 88414[TASK] Add tests for RteHtmlParser and HtmlParser YAML coverage
- main 88244[TASK] Add tests for RteHtmlParser and HtmlParser YAML coverage
Related issues 4
- Feature #87314allowedAttribs / allowAttributes usage in config
- Bug #87400CKEditor: assign correct CSS class to tags with entryHTMLparser_db
- Bug #97499Wrong notation for value of allowedAttribs in Processing.yaml
- Task #106189HtmlParser / RTE HTML Parser is missing YAML parse tests and array/string notation testing for fixAttribs