Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294496

Stop generating align-* classes for preview in DrupalMedia CKEditor plugin

$
0
0

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 what FilterAlign does via data-align and FilterCaption via data-caption. This

The current code hardcodes only behavior for data-align. Yes, I know this plugin has special behavior for data-caption. There's no other way for that one. But data-align was implemented generically, and at least some other data-somethings 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

Release notes snippet


Viewing all articles
Browse latest Browse all 294496

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>