Make the CKEditor GeneralHtmlSupport allow list configurable (#5897) - #5900
Open
Lucsaan wants to merge 2 commits into
Open
Make the CKEditor GeneralHtmlSupport allow list configurable (#5897)#5900Lucsaan wants to merge 2 commits into
Lucsaan wants to merge 2 commits into
Conversation
The htmlSupport allow list was hardcoded in Core.UI.RichTextEditor.js (span, cite, style, table). Everything else loses attributes, classes and inline styles that no active editor feature handles — for example a border style on an image is silently stripped, with no way to change that from the outside. Move the element list to the new SysConfig settings Frontend::RichText::HtmlSupportAllowedElements and CustomerFrontend::RichText::HtmlSupportAllowedElements (default keeps the current behavior) and pass it to the editor via the RichText JS data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5897
Summary
The
htmlSupport(GeneralHtmlSupport) allow list of the RichText editor was hardcoded inCore.UI.RichTextEditor.js(span,cite,style,table). Attributes, classes and inline styles on any other element that no active editor feature handles are silently stripped — e.g. aborderstyle on an image does not survive a round-trip, a regression compared to CKEditor 4, and there is no configuration to change it.This change moves the element list to SysConfig:
Frontend::RichText::HtmlSupportAllowedElements(agent interface)CustomerFrontend::RichText::HtmlSupportAllowedElements(customer interface)Both default to
span, cite, style, table, so standard installations keep exactly today's filtering.Layout.pmpasses the list through the existingRichTextJS data;Core.UI.RichTextEditor.jsbuilds the allow array from it (with the previous values as fallback when the setting is absent).Example
An administrator who wants image styles to survive (e.g. borders) adds
imgto the list — no code change needed.Backport
The same problem exists on
rel-11_0; a backport PR againstrel-11_0follows.