core/modules/ckeditor5/src/HTMLRestrictions.php | 6 ++++++ .../ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/modules/ckeditor5/src/HTMLRestrictions.php b/core/modules/ckeditor5/src/HTMLRestrictions.php index d6987cbd91..daeb1a4812 100644 --- a/core/modules/ckeditor5/src/HTMLRestrictions.php +++ b/core/modules/ckeditor5/src/HTMLRestrictions.php @@ -817,6 +817,12 @@ public function toGeneralHtmlSupportConfig(): array { $to_allow['classes'] = $value; continue; } + // If a single attribute value is allowed, it must be TRUE (see the + // assertion above). Otherwise, it must be an array of strings (see + // the assertion above), which lists all allowed attribute values. To + // be able to configure GHS to a range of values, we need to use a + // regular expression. + // @todo Expand to support partial wildcards in https://www.drupal.org/project/drupal/issues/3260853. $to_allow['attributes'][$name] = is_array($value) ? ['regexp' => ['pattern' => '/^(' . implode('|', $value) . ')$/']] : $value; diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php index 17435b2292..d9a057fcb6 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/SourceEditingTest.php @@ -26,7 +26,7 @@ class SourceEditingTest extends CKEditor5TestBase { protected $adminUser; /** - * A host entity with a body field to embed images in. + * A host entity with a body field whose text to edit with CKEditor 5. * * @var \Drupal\node\NodeInterface */ @@ -44,7 +44,7 @@ class SourceEditingTest extends CKEditor5TestBase { /** * {@inheritdoc} */ - protected $defaultTheme = 'classy'; + protected $defaultTheme = 'stark'; /** * {@inheritdoc} @@ -100,7 +100,7 @@ function (ConstraintViolation $v) { 'bypass node access', ]); - // Create a sample host entity to embed images in. + // Create a sample host entity to test CKEditor 5. $this->host = $this->createNode([ 'type' => 'page', 'title' => 'Animals with strange names',