Issue #2521906 by mErilainen, LewisNyman, Bojhan, eliza411, ivanstegic, lunk_rat, nickrosencrans, stpaultim, Mark LaCroix, webchick: Add default configuration to support h2-h6 level headings

8.0.x
Alex Pott 2015-08-14 13:24:02 +01:00
parent db390cded0
commit 9deeb7e926
6 changed files with 16 additions and 10 deletions

View File

@ -54,7 +54,7 @@ class CKEditorTest extends KernelTestBase {
'filter_html' => array(
'status' => 1,
'settings' => array(
'allowed_html' => '<h4> <h5> <h6> <p> <br> <strong> <a>',
'allowed_html' => '<h2> <h3> <h4> <h5> <h6> <p> <br> <strong> <a>',
)
),
),
@ -113,7 +113,7 @@ class CKEditorTest extends KernelTestBase {
$editor->save();
$expected_config['toolbar'][0]['items'][] = 'Strike';
$expected_config['toolbar'][0]['items'][] = 'Format';
$expected_config['format_tags'] = 'p;h4;h5;h6';
$expected_config['format_tags'] = 'p;h2;h3;h4;h5;h6';
$expected_config['extraPlugins'] .= ',llama_contextual,llama_contextual_and_button';
$expected_config['drupalExternalPlugins']['llama_contextual'] = file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual.js');
$expected_config['drupalExternalPlugins']['llama_contextual_and_button'] = file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js');
@ -129,7 +129,7 @@ class CKEditorTest extends KernelTestBase {
$expected_config['allowedContent']['pre'] = array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE);
$expected_config['allowedContent']['h3'] = array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE);
$expected_config['format_tags'] = 'p;h3;h4;h5;h6;pre';
$expected_config['format_tags'] = 'p;h2;h3;h4;h5;h6;pre';
$this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.');
// Disable the filter_html filter: allow *all *tags.
@ -289,7 +289,7 @@ class CKEditorTest extends KernelTestBase {
$settings = $editor->getSettings();
$settings['toolbar']['rows'][0][0]['items'][] = 'Format';
$editor->setSettings($settings);
$expected['format_tags'] = 'p;h4;h5;h6';
$expected['format_tags'] = 'p;h2;h3;h4;h5;h6';
$this->assertEqual($expected, $internal_plugin->getConfig($editor), '"Internal" plugin configuration built correctly for customized toolbar.');
}
@ -430,6 +430,8 @@ class CKEditorTest extends KernelTestBase {
protected function getDefaultAllowedContentConfig() {
return array(
'h2' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
'h3' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
'h4' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
'h5' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),
'h6' => array('attributes' => TRUE, 'styles' => FALSE, 'classes' => TRUE),

View File

@ -96,7 +96,7 @@ class EditorSecurityTest extends WebTestBase {
'filter_html' => array(
'status' => 1,
'settings' => array(
'allowed_html' => '<h4> <h5> <h6> <p> <br> <strong> <a>',
'allowed_html' => '<h2> <h3> <h4> <h5> <h6> <p> <br> <strong> <a>',
)
),
),
@ -111,7 +111,7 @@ class EditorSecurityTest extends WebTestBase {
'filter_html' => array(
'status' => 1,
'settings' => array(
'allowed_html' => '<h4> <h5> <h6> <p> <br> <strong> <a>',
'allowed_html' => '<h2> <h3> <h4> <h5> <h6> <p> <br> <strong> <a>',
)
),
),
@ -131,7 +131,7 @@ class EditorSecurityTest extends WebTestBase {
'filter_html' => array(
'status' => 1,
'settings' => array(
'allowed_html' => '<h4> <h5> <h6> <p> <br> <strong> <a> <embed>',
'allowed_html' => '<h2> <h3> <h4> <h5> <h6> <p> <br> <strong> <a> <embed>',
)
),
),

View File

@ -20,7 +20,7 @@ use Drupal\filter\Plugin\FilterBase;
* title = @Translation("Limit allowed HTML tags"),
* type = Drupal\filter\Plugin\FilterInterface::TYPE_HTML_RESTRICTOR,
* settings = {
* "allowed_html" = "<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6>",
* "allowed_html" = "<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <h5> <h6>",
* "filter_html_help" = TRUE,
* "filter_html_nofollow" = FALSE
* },

View File

@ -24,6 +24,10 @@ settings:
items:
- Blockquote
- DrupalImage
-
name: 'Block Formatting'
items:
- Format
-
name: Tools
items:

View File

@ -11,7 +11,7 @@ filters:
status: true
weight: -10
settings:
allowed_html: '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6> <p> <br> <span> <img>'
allowed_html: '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <h5> <h6> <p> <br> <span> <img>'
filter_html_help: false
filter_html_nofollow: false
filter_align:

View File

@ -11,7 +11,7 @@ filters:
status: true
weight: -10
settings:
allowed_html: '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6>'
allowed_html: '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <h5> <h6>'
filter_html_help: true
filter_html_nofollow: false
filter_autop: