function SmartDefaultSettingsTest::provider
Same name in other branches
- 10 core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Kernel\SmartDefaultSettingsTest::provider()
- 11.x core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Kernel\SmartDefaultSettingsTest::provider()
Data provider.
Return value
\Generator Test scenarios.
File
-
core/
modules/ ckeditor5/ tests/ src/ Kernel/ SmartDefaultSettingsTest.php, line 598
Class
- SmartDefaultSettingsTest
- @covers \Drupal\ckeditor5\SmartDefaultSettings::computeSmartDefaultSettings() @group ckeditor5 @internal
Namespace
Drupal\Tests\ckeditor5\KernelCode
public function provider() {
$basic_html_test_case = [
'format_id' => 'basic_html',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
// Items based on toolbar items from prior config.
'bold',
'italic',
'|',
'link',
'|',
'bulletedList',
'numberedList',
'|',
'blockQuote',
'drupalInsertImage',
'|',
'heading',
'|',
'sourceEditing',
// Items added based on "allowed tags" config.
'|',
// The 'code' button added because <code> is allowed.
'code',
],
],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
],
],
'ckeditor5_imageResize' => [
'allow_resize' => TRUE,
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<cite>',
'<dl>',
'<dt>',
'<dd>',
'<span>',
'<a hreflang>',
'<blockquote cite>',
'<ul type>',
'<ol type>',
'<h2 id>',
'<h3 id>',
'<h4 id>',
'<h5 id>',
'<h6 id>',
],
],
],
],
'expected_superset' => '',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [],
];
(yield "basic_html can be switched to CKEditor 5 without problems (3 upgrade messages)" => NestedArray::mergeDeep($basic_html_test_case, [
'expected_db_logs' => [
'status' => [
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
],
]));
(yield "basic_html with filter_caption removed => disallows <img data-caption> => supported through sourceEditing (3 upgrade messages)" => NestedArray::mergeDeep($basic_html_test_case, [
'filters_to_drop' => [
'filter_caption' => FALSE,
],
'expected_ckeditor5_settings' => [
'plugins' => [
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<img data-caption>',
],
],
],
],
'expected_db_logs' => [
'status' => [
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-caption>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-caption>. Additional details are available in your logs.',
],
],
]));
(yield "basic_html with filter_align removed => disallows <img data-align> => supported through sourceEditing (3 upgrade messages) " => NestedArray::mergeDeep($basic_html_test_case, [
'filters_to_drop' => [
'filter_align' => FALSE,
],
'expected_ckeditor5_settings' => [
'plugins' => [
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<img data-align>',
],
],
],
],
'expected_db_logs' => [
'status' => [
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-align>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-align>. Additional details are available in your logs.',
],
],
]));
(yield "basic_html_without_image_uploads can be switched to CKEditor 5 without problems, <img data-entity-type data-entity-uuid> support is retained via sourceEditing" => [
'format_id' => 'basic_html_without_image_uploads',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => $basic_html_test_case['expected_ckeditor5_settings']['toolbar'],
'plugins' => [
'ckeditor5_heading' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_heading'],
'ckeditor5_imageResize' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_imageResize'],
'ckeditor5_list' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_list'],
'ckeditor5_sourceEditing' => [
'allowed_tags' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_sourceEditing']['allowed_tags'], [
'<img data-entity-type data-entity-uuid>',
]),
],
],
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (without image uploads)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (without image uploads)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (without image uploads)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-entity-type data-entity-uuid>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-entity-type data-entity-uuid>. Additional details are available in your logs.',
],
],
]);
(yield "basic_html_without_h4_h6 can be switched to CKEditor 5 without problems, heading configuration computed automatically" => [
'format_id' => 'basic_html_without_h4_h6',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => $basic_html_test_case['expected_ckeditor5_settings']['toolbar'],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading2',
'heading3',
'heading5',
],
],
'ckeditor5_imageResize' => [
'allow_resize' => TRUE,
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => array_values(array_diff($basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_sourceEditing']['allowed_tags'], [
'<h4 id>',
'<h6 id>',
])),
],
],
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (without H4 and H6)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (without H4 and H6)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (without H4 and H6)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h5 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h5 id>. Additional details are available in your logs.',
],
],
]);
(yield "basic_html_with_h1 can be switched to CKEditor 5 without problems, heading configuration computed automatically" => [
'format_id' => 'basic_html_with_h1',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => $basic_html_test_case['expected_ckeditor5_settings']['toolbar'],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading1',
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
],
],
'ckeditor5_imageResize' => [
'allow_resize' => TRUE,
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_sourceEditing']['allowed_tags'],
],
],
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (with <h1>)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (with <h1>)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (with <h1>)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
],
]);
(yield "basic_html_without_headings can be switched to CKEditor 5 without problems, heading configuration computed automatically" => [
'format_id' => 'basic_html_without_headings',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge(array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 0, 10), array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 12)),
],
'plugins' => [
'ckeditor5_imageResize' => [
'allow_resize' => TRUE,
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => array_values(array_diff($basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_sourceEditing']['allowed_tags'], [
'<h2 id>',
'<h3 id>',
'<h4 id>',
'<h5 id>',
'<h6 id>',
])),
],
],
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (without H*)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (without H*)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (without H*)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type>. Additional details are available in your logs.',
],
],
]);
(yield "basic_html_with_pre can be switched to CKEditor 5 without problems, heading configuration computed automatically" => [
'format_id' => 'basic_html_with_pre',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], [
'codeBlock',
]),
],
'plugins' => $basic_html_test_case['expected_ckeditor5_settings']['plugins'],
],
'expected_superset' => '<code class="language-*">',
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (with <pre>)</em> text format: <em class="placeholder">Code (for tags: <code>) Code Block (for tags: <pre>)</em>. The text format must be saved to make these changes active.',
str_replace('Basic HTML', 'Basic HTML (with <pre>)', $basic_html_test_case['expected_db_logs']['status'][1]),
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (with <pre>)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code, Code Block</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
'warning' => [
'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following: This attribute: <em class="placeholder"> class (for <code>)</em>; Additional details are available in your logs.',
],
],
]);
(yield "basic_html_with_alignable_p can be switched to CKEditor 5 without problems, align buttons added automatically" => [
'format_id' => 'basic_html_with_alignable_p',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], [
'alignment',
]),
],
'plugins' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins'], [
'ckeditor5_alignment' => [
'enabled_alignments' => [
'center',
'justify',
],
],
]),
],
'expected_superset' => implode(' ', [
// Note that aligning left and right is being added, on top of what the
// original format allowed: center and justify.
// Note that aligning left/center/right/justify is possible on *all*
// allowed CKEditor 5 `$block` text container tags.
// @todo When https://www.drupal.org/project/drupal/issues/3259367
// lands, none of the tags below should appear.
'<h2 class="text-align-center text-align-justify">',
'<h3 class="text-align-center text-align-justify">',
'<h4 class="text-align-center text-align-justify">',
'<h5 class="text-align-center text-align-justify">',
'<h6 class="text-align-center text-align-justify">',
]),
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (with alignable paragraph support)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (with alignable paragraph support)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'The CKEditor 5 migration process enabled the following plugins to support specific attributes that are allowed by the <em class="placeholder">Basic HTML (with alignable paragraph support)</em> text format: <em class="placeholder">Alignment ( for tag: <p> to support: class with value(s): text-align-center, text-align-justify)</em>.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (with alignable paragraph support)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code, Alignment</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
'warning' => [
'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following: This attribute: <em class="placeholder"> class (for <h2>, <h3>, <h4>, <h5>, <h6>)</em>; Additional details are available in your logs.',
],
],
]);
(yield "basic_html with media_embed added (3 upgrade messages)" => [
'format_id' => 'basic_html_with_media_embed',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge(array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 0, 10), [
'drupalMedia',
], array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 10)),
],
'plugins' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins'], [
'media_media' => [
'allow_view_mode_override' => FALSE,
],
]),
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (with Media Embed support)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (with Media Embed support)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (with Media Embed support)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
],
]);
(yield "basic_html with media_embed added with data-view-mode allowed but no view modes configured (3 upgrade messages, 1 violation)" => [
'format_id' => 'basic_html_with_media_embed_view_mode_enabled_no_view_modes_configured',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge(array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 0, 10), [
'drupalMedia',
], array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 10)),
],
'plugins' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins'], [
'media_media' => [
'allow_view_mode_override' => TRUE,
],
]),
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">(with Media Embed support, view mode enabled but no view modes configured)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">(with Media Embed support, view mode enabled but no view modes configured)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">(with Media Embed support, view mode enabled but no view modes configured)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
]),
'expected_post_filter_drop_fundamental_compatibility_violations' => [],
'expected_post_update_text_editor_violations' => [
'' => 'The CKEditor 5 "<em class="placeholder">Media</em>" plugin\'s "<em class="placeholder">Allow the user to override the default view mode</em>" setting should be in sync with the "<em class="placeholder">Embed media</em>" filter\'s "<em class="placeholder">View modes selectable in the "Edit media" dialog</em>" setting: when checked, two or more view modes must be allowed by the filter.',
],
]);
(yield "basic_html with media_embed added with data-view-mode allowed and 2 view modes configured (3 upgrade messages)" => [
'format_id' => 'basic_html_with_media_embed_view_mode_enabled_two_view_modes_configured',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => array_merge(array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 0, 10), [
'drupalMedia',
], array_slice($basic_html_test_case['expected_ckeditor5_settings']['toolbar']['items'], 10)),
],
'plugins' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins'], [
'media_media' => [
'allow_view_mode_override' => TRUE,
],
]),
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">(with Media Embed support, view mode enabled and two view modes configured )</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">(with Media Embed support, view mode enabled and two view modes configured )</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">(with Media Embed support, view mode enabled and two view modes configured )</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => array_merge_recursive($basic_html_test_case['expected_messages'], [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
]),
'expected_post_filter_drop_fundamental_compatibility_violations' => [],
'expected_post_update_text_editor_violations' => [],
]);
(yield "basic_html_with_any_data_attr can be switched to CKEditor 5 without problems (3 upgrade messages)" => [
'format_id' => 'basic_html_with_any_data_attr',
'filters_to_drop' => $basic_html_test_case['filters_to_drop'],
'expected_ckeditor5_settings' => [
'toolbar' => $basic_html_test_case['expected_ckeditor5_settings']['toolbar'],
'plugins' => [
'ckeditor5_heading' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_heading'],
'ckeditor5_imageResize' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_imageResize'],
'ckeditor5_list' => $basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_list'],
'ckeditor5_sourceEditing' => [
'allowed_tags' => array_merge($basic_html_test_case['expected_ckeditor5_settings']['plugins']['ckeditor5_sourceEditing']['allowed_tags'], [
'<img data-*>',
]),
],
] + $basic_html_test_case['expected_ckeditor5_settings']['plugins'],
],
'expected_superset' => $basic_html_test_case['expected_superset'],
'expected_fundamental_compatibility_violations' => $basic_html_test_case['expected_fundamental_compatibility_violations'],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Basic HTML (with any data-* attribute on images)</em> text format: <em class="placeholder">Code (for tags: <code>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Basic HTML (with any data-* attribute on images)</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd> <span>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Basic HTML (with any data-* attribute on images)</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-*>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Code</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <span> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img data-*>. Additional details are available in your logs.',
],
],
]);
(yield "restricted_html can be switched to CKEditor 5 after dropping the two markup-creating filters (3 upgrade messages)" => [
'format_id' => 'restricted_html',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
// Items originating from CKEditor5::getDefaultSettings().
'heading',
'bold',
'italic',
// Items added based on "allowed tags" config.
'|',
// Because '<a>' is in allowed_html.
'link',
// Because '<blockquote cite>' is in allowed_html.
'blockQuote',
// Because '<code>' is in allowed_html.
'code',
// Because '<ul>' is in allowed_html.
'bulletedList',
// Because '<ol>' is in allowed_html.
'numberedList',
// Because additional tags need to be allowed to achieve a superset.
'sourceEditing',
],
],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
],
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<cite>',
'<dl>',
'<dt>',
'<dd>',
'<a hreflang>',
'<blockquote cite>',
'<ul type>',
'<ol type>',
'<h2 id>',
'<h3 id>',
'<h4 id>',
'<h5 id>',
'<h6 id>',
],
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
],
],
'expected_superset' => '<br> <p>',
'expected_fundamental_compatibility_violations' => [
'' => 'CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "<em class="placeholder">Limit allowed HTML tags and correct faulty HTML</em>" (<em class="placeholder">filter_html</em>) filter.',
],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Restricted HTML</em> text format: <em class="placeholder">Link (for tags: <a>) Block quote (for tags: <blockquote>) Code (for tags: <code>) List (for tags: <ul><ol><li>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Restricted HTML</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Restricted HTML</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
'warning' => [
'As part of migrating the <em class="placeholder">Restricted HTML</em> text format to CKEditor 5, the following tag(s) were added to <em>Limit allowed HTML tags and correct faulty HTML</em>, because they are needed to provide fundamental CKEditor 5 functionality : <br> <p>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Link, Block quote, Code, List</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <a hreflang> <blockquote cite> <ul type> <ol type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
'warning' => [
'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following: The <br>, <p> tags were added because they are <a target="_blank" href="/admin/help/ckeditor5#required-tags">required by CKEditor 5</a>. The tags <em class="placeholder"><h2>, <h3>, <h4>, <h5>, <h6>, <*>, <cite>, <dl>, <dt>, <dd>, <a>, <blockquote>, <ul>, <ol>, <strong>, <em>, <code>, <li></em>; These attributes: <em class="placeholder"> id (for <h2>, <h3>, <h4>, <h5>, <h6>), dir (for <*>), lang (for <*>), hreflang (for <a>), href (for <a>), cite (for <blockquote>), type (for <ul>, <ol>), start (for <ol>)</em>; Additional details are available in your logs.',
],
],
'expected_post_filter_drop_fundamental_compatibility_violations' => [],
]);
(yield "full_html can be switched to CKEditor 5 (no upgrade messages)" => [
'format_id' => 'full_html',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
'bold',
'italic',
'strikethrough',
'superscript',
'subscript',
'removeFormat',
'|',
'link',
'|',
'bulletedList',
'numberedList',
'|',
'blockQuote',
'drupalInsertImage',
'insertTable',
'horizontalLine',
'|',
'heading',
'codeBlock',
'|',
'sourceEditing',
],
],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
],
],
'ckeditor5_imageResize' => [
'allow_resize' => TRUE,
],
'ckeditor5_list' => [
'reversed' => TRUE,
'startIndex' => TRUE,
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => [],
],
],
],
'expected_superset' => '',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [],
'expected_messages' => [],
]);
(yield "filter_only__filter_html can be switched to CKEditor 5 without problems (3 upgrade messages)" => [
'format_id' => 'filter_only__filter_html',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
// Default toolbar items.
'heading',
'bold',
'italic',
'|',
// Items added based on filter_html's "allowed tags" config.
'link',
'blockQuote',
'code',
'bulletedList',
'numberedList',
'sourceEditing',
],
],
'plugins' => [
'ckeditor5_heading' => [
'enabled_headings' => [
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
],
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<cite>',
'<dl>',
'<dt>',
'<dd>',
'<a hreflang>',
'<blockquote cite>',
'<ul type>',
'<ol type="1 A I">',
'<h2 id="jump-*">',
'<h3 id>',
'<h4 id>',
'<h5 id>',
'<h6 id>',
],
],
'ckeditor5_list' => [
'reversed' => FALSE,
'startIndex' => TRUE,
],
],
],
'expected_superset' => '<br> <p>',
'expected_fundamental_compatibility_violations' => [
'' => 'CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "<em class="placeholder">Limit allowed HTML tags and correct faulty HTML</em>" (<em class="placeholder">filter_html</em>) filter.',
],
'expected_db_logs' => [
'status' => [
'The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the <em class="placeholder">Only the "filter_html" filter and its default settings</em> text format: <em class="placeholder">Link (for tags: <a>) Block quote (for tags: <blockquote>) Code (for tags: <code>) List (for tags: <ul><ol><li>)</em>. The text format must be saved to make these changes active.',
'The following tags were permitted by the <em class="placeholder">Only the "filter_html" filter and its default settings</em> text format\'s filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <cite> <dl> <dt> <dd>. The text format must be saved to make these changes active.',
'As part of migrating to CKEditor 5, it was found that the <em class="placeholder">Only the "filter_html" filter and its default settings</em> text format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol type="1 A I"> <h2 id="jump-*"> <h3 id> <h4 id> <h5 id> <h6 id>. The text format must be saved to make these changes active.',
],
'warning' => [
'As part of migrating the <em class="placeholder">Only the "filter_html" filter and its default settings</em> text format to CKEditor 5, the following tag(s) were added to <em>Limit allowed HTML tags and correct faulty HTML</em>, because they are needed to provide fundamental CKEditor 5 functionality : <br> <p>. The text format must be saved to make these changes active.',
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Enabled these plugins: (<em class="placeholder">Link, Block quote, Code, List</em>). Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <cite> <dl> <dt> <dd> <a hreflang> <blockquote cite> <ul type> <ol type="1 A I"> <h2 id="jump-*"> <h3 id> <h4 id> <h5 id> <h6 id>. Additional details are available in your logs.',
],
'warning' => [
'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following: The <br>, <p> tags were added because they are <a target="_blank" href="/admin/help/ckeditor5#required-tags">required by CKEditor 5</a>. The tags <em class="placeholder"><h2>, <h3>, <h4>, <h5>, <h6>, <*>, <cite>, <dl>, <dt>, <dd>, <a>, <blockquote>, <ul>, <ol>, <strong>, <em>, <code>, <li></em>; These attributes: <em class="placeholder"> id (for <h2>, <h3>, <h4>, <h5>, <h6>), dir (for <*>), lang (for <*>), hreflang (for <a>), href (for <a>), cite (for <blockquote>), type (for <ul>, <ol>), start (for <ol>)</em>; Additional details are available in your logs.',
],
],
]);
(yield "cke4_plugins_with_settings can be switched to CKEditor 5 without problems, settings are upgraded too" => [
'format_id' => 'cke4_plugins_with_settings',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
'textPartLanguage',
'style',
'blockQuote',
],
],
'plugins' => [
'ckeditor5_language' => [
'language_list' => 'all',
],
'ckeditor5_style' => [
'styles' => [
[
'label' => 'Callout',
'element' => '<p class="callout">',
],
[
'label' => 'Interesting & highlighted quote',
'element' => '<blockquote class="interesting highlighted">',
],
[
'label' => 'Famous',
'element' => '<blockquote class="famous">',
],
],
],
],
],
'expected_superset' => '',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [
'warning' => [
'The CKEditor 4 button <em class="placeholder">Llama</em> does not have a known upgrade path. If it allowed editing markup, then you can do so now through the Source Editing functionality.',
'The <em class="placeholder">llama_contextual_and_button</em> plugin settings do not have a known upgrade path.',
],
],
'expected_messages' => [
'warning' => [
'The CKEditor 4 button <em class="placeholder">Llama</em> does not have a known upgrade path. If it allowed editing markup, then you can do so now through the Source Editing functionality.',
'The <em class="placeholder">llama_contextual_and_button</em> plugin settings do not have a known upgrade path.',
],
],
]);
(yield "cke4_stylescombo_span can be switched to CKEditor 5 without problems, only <span> in Source Editing" => [
'format_id' => 'cke4_stylescombo_span',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
'style',
'sourceEditing',
],
],
'plugins' => [
'ckeditor5_style' => [
'styles' => [
[
'label' => 'Llama span',
'element' => '<span class="llama">',
],
],
],
'ckeditor5_sourceEditing' => [
'allowed_tags' => [
'<span>',
],
],
],
],
'expected_superset' => '',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [
'status' => [
"The following tags were permitted by the <em class=\"placeholder\">A CKEditor 4 configured to have span styles</em> text format's filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin's <em>Manually editable HTML tags</em>: <span>. The text format must be saved to make these changes active.",
],
],
'expected_messages' => [
'status' => [
'To maintain the capabilities of this text format, <a target="_blank" href="/admin/help/ckeditor5#migration-settings">the CKEditor 5 migration</a> did the following: Added these tags/attributes to the Source Editing Plugin\'s <a target="_blank" href="/admin/help/ckeditor5#source-editing">Manually editable HTML tags</a> setting: <span>. Additional details are available in your logs.',
],
],
]);
(yield "cke4_contrib_plugins_now_in_core can be switched to CKEditor 5 without problems" => [
'format_id' => 'cke4_contrib_plugins_now_in_core',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
'code',
],
],
'plugins' => [],
],
'expected_superset' => '',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [],
'expected_messages' => [],
]);
(yield "minimal_ckeditor_wrong_allowed_html does not have sufficient allowed HTML => necessary allowed HTML added (1 upgrade message)" => [
'format_id' => 'minimal_ckeditor_wrong_allowed_html',
'filters_to_drop' => [],
'expected_ckeditor5_settings' => [
'toolbar' => [
'items' => [
'link',
],
],
'plugins' => [],
],
'expected_superset' => '<a href>',
'expected_fundamental_compatibility_violations' => [],
'expected_db_logs' => [],
'expected_messages' => [
'warning' => [
0 => 'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following: This attribute: <em class="placeholder"> href (for <a>)</em>; Additional details are available in your logs.',
],
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.