Problem/Motivation
See #2994696-214: Render embedded media items in CKEditor, patch review point 2:
🤔 In #25, this used to be more abstract:
// Allow entity_embed.editor.css to respond to changes (for example in alignment). this.element.setAttributes(this.data.attributes);
It was more abstract for a reason: custom and contrib modules may layer additional behavior, styling or semantics on top of existing HTML elements by adding more
data-
attributes. For example,data-highlight
,data-editor-comments
,data-invert-colors
,data-mirror
,data-geolocation
, and so on. That's exactly whatFilterAlign
does viadata-align
andFilterCaption
viadata-caption
. ThisThe current code hardcodes only behavior for
data-align
. Yes, I know this plugin has special behavior fordata-caption
. There's no other way for that one. Butdata-align
was implemented generically, and at least some otherdata-something
s could achieve the same.In my opinion, this is a regression compared to earlier patch iterations. But I won't block the patch over this.
In #216 of that issue, we brought that back, to not break that use case. But that means the align-*
classes are no longer absolutely necessary, they're just the equivalent of syntactic sugar.
Proposed resolution
Remove the align-*
classes, i.e. remove this code:
if (this.data.attributes.hasOwnProperty('data-align')) {
this.element
.getParent()
.addClass('align-' + this.data.attributes['data-align']);
}
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD