diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php index 1dc3395161a21f420f3bcee57103ca37fe2d370b..1dc71fba01ebcd89838a8088811bf78844ef966c 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/src/Plugin/Filter/FilterHtml.php @@ -41,12 +41,10 @@ class FilterHtml extends FilterBase { */ public function settingsForm(array $form, FormStateInterface $form_state) { $form['allowed_html'] = array( - '#type' => 'textfield', + '#type' => 'textarea', '#title' => $this->t('Allowed HTML tags'), '#default_value' => $this->settings['allowed_html'], - '#maxlength' => 2048, '#description' => $this->t('A list of HTML tags that can be used. By default only the lang and dir attributes are allowed for all HTML tags. Each HTML tag may have attributes which are treated as allowed attribute names for that HTML tag. Each attribute may allow all values, or only allow specific values. Attribute names or values may be written as a prefix and wildcard like jump-*. JavaScript event attributes, JavaScript URLs, and CSS are always stripped.'), - '#size' => 250, '#attached' => array( 'library' => array( 'filter/drupal.filter.filter_html.admin', @@ -70,6 +68,12 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function setConfiguration(array $configuration) { + if (isset($configuration['settings']['allowed_html'])) { + // The javascript in core/modules/filter/filter.filter_html.admin.js + // removes new lines and double spaces so, for consistency when javascript + // is disabled, remove them. + $configuration['settings']['allowed_html'] = preg_replace('/\s+/', ' ', $configuration['settings']['allowed_html']); + } parent::setConfiguration($configuration); // Force restrictions to be calculated again. $this->restrictions = NULL; diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php index e71b57ab45c4280197401462071577fac4150e5f..830cf18d77619ebc0e2041022178d3d5bfea04bc 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -206,13 +206,13 @@ function testFilterAdmin() { $this->assertTrue($full_format->access('use', $this->adminUser), 'Admin user may use Full HTML.'); $this->assertFalse($full_format->access('use', $this->webUser), 'Web user may not use Full HTML.'); - // Add an additional tag. + // Add an additional tag and extra spaces and returns. $edit = array(); - $edit['filters[filter_html][settings][allowed_html]'] = '