diff --git a/core/modules/ckeditor5/src/HTMLRestrictions.php b/core/modules/ckeditor5/src/HTMLRestrictions.php
index 34a2680f52..d6987cbd91 100644
--- a/core/modules/ckeditor5/src/HTMLRestrictions.php
+++ b/core/modules/ckeditor5/src/HTMLRestrictions.php
@@ -807,16 +807,16 @@ public function toGeneralHtmlSupportConfig(): array {
if (is_array($value)) {
$value = array_keys($value);
}
- if ($name === 'class') {
- $to_allow['classes'] = array_keys($value);
- continue;
- }
// Drupal never allows style attributes due to security concerns.
// @see \Drupal\Component\Utility\Xss
if ($name === 'style') {
continue;
}
assert($value === TRUE || Inspector::assertAllStrings($value));
+ if ($name === 'class') {
+ $to_allow['classes'] = $value;
+ continue;
+ }
$to_allow['attributes'][$name] = is_array($value)
? ['regexp' => ['pattern' => '/^(' . implode('|', $value) . ')$/']]
: $value;