core/modules/ckeditor/ckeditor.module | 1 + .../filter/src/Plugin/Filter/FilterAlign.php | 7 +++- .../Drupal/FunctionalTests/Theme/ClassyTest.php | 6 +-- core/themes/classy/classy.info.yml | 3 ++ core/themes/classy/classy.theme | 17 -------- core/themes/classy/css/components/filter.align.css | 2 +- core/themes/classy/src/ProcessedText.php | 49 ---------------------- 7 files changed, 13 insertions(+), 72 deletions(-) diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index b05df2e3cc..fb7fd83658 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -72,6 +72,7 @@ function ckeditor_ckeditor_css_alter(array &$css, Editor $editor) { // editor uses the filter_align filter. This is used by the included // CKEditor DrupalImage plugin, the media module's DrupalMedia plugin, by // blockquote elements, et. al. + // @see core/modules/filter/filter.libraries.yml if ($filters->has('filter_align') && $filters->get('filter_align')->status) { $css[] = drupal_get_path('module', 'filter') . '/css/filter.align.css'; } diff --git a/core/modules/filter/src/Plugin/Filter/FilterAlign.php b/core/modules/filter/src/Plugin/Filter/FilterAlign.php index a3739ab824..7b384b9d33 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterAlign.php +++ b/core/modules/filter/src/Plugin/Filter/FilterAlign.php @@ -40,7 +40,12 @@ public function process($text, $langcode) { $node->setAttribute('class', implode(' ', $classes)); } } - $result->setProcessedText(Html::serialize($dom)); + $result->setProcessedText(Html::serialize($dom)) + ->addAttachments([ + 'library' => [ + 'filter/align', + ], + ]); } return $result; diff --git a/core/tests/Drupal/FunctionalTests/Theme/ClassyTest.php b/core/tests/Drupal/FunctionalTests/Theme/ClassyTest.php index 00601137d1..eb8447609e 100644 --- a/core/tests/Drupal/FunctionalTests/Theme/ClassyTest.php +++ b/core/tests/Drupal/FunctionalTests/Theme/ClassyTest.php @@ -37,9 +37,7 @@ public function testRegressionMissingMessagesCss() { } /** - * Tests that classy/align library is added conditionally. - * - * @see \Drupal\classy\ProcessedText::preRender(). + * Tests that the classy/align library override of filter/align is loaded. */ public function testFilterAlignCss() { $this->container @@ -57,7 +55,7 @@ public function testFilterAlignCss() { 'type' => 'blog', 'title' => "Compassion: that's the one things no machine ever had.", 'body' => [ - 'value' => 'Highly illogical.', + 'value' => '
Highly illogical.', 'format' => 'test_format', ], ]); diff --git a/core/themes/classy/classy.info.yml b/core/themes/classy/classy.info.yml index 161b539475..0954e4250c 100644 --- a/core/themes/classy/classy.info.yml +++ b/core/themes/classy/classy.info.yml @@ -26,5 +26,8 @@ libraries-extend: media/media_embed_ckeditor_theme: - classy/media_embed_ckeditor_theme +libraries-override: + filter/align: classy/align + ckeditor_stylesheets: - css/components/media-embed-error.css diff --git a/core/themes/classy/classy.theme b/core/themes/classy/classy.theme deleted file mode 100644 index 8595946de8..0000000000 --- a/core/themes/classy/classy.theme +++ /dev/null @@ -1,17 +0,0 @@ -filters('filter_align'); - if ($filter_align && $filter_align->status) { - $element['#attached']['library'][] = 'classy/align'; - } - - return $element; - } - - /** - * {@inheritdoc} - */ - public static function trustedCallbacks() { - return ['preRender']; - } - -}