Issue #3273312 by Wim Leers, Dom., ifrik, mpp, seanB, lauriii: Upgrading from CKEditor 4 for a text format that has FilterInterface::TYPE_MARKUP_LANGUAGE filters enabled
(cherry picked from commit e8ed42cc)
@@ -83,16 +83,16 @@ public function testSettingsOnlyFireAjaxWithCkeditor5() {
// The presence of this validation error message confirms the AJAX callback
// was invoked.
$assert_session->pageTextContains('CKEditor 5 only works with HTML-based text formats');
$assert_session->pageTextContains('CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "Limit allowed HTML tags and correct faulty HTML" (filter_html) filter.');
// Disable the incompatible filter. This should trigger another AJAX rebuild
// which will include the removal of the validation error as the issue has
$assert_session->pageTextNotContains('CKEditor 5 only works with HTML-based text formats');
$assert_session->pageTextNotContains('CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "Limit allowed HTML tags and correct faulty HTML" (filter_html) filter.');
}
/**
@@ -149,25 +149,36 @@ public function testMessagesDoNotAccumulate(): void {
return$page->findAll('css','[role=alert]:contains("CKEditor 5 only works with HTML-based text formats.")');
return$page->findAll('css','[role=alert]:contains("The following tag(s) are already supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: Bold (<strong>).")');
0=>'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert line breaks into HTML (i.e. <code>&lt;br&gt;</code> and <code>&lt;p&gt;</code>)</em>" (<em class="placeholder">filter_autop</em>) filter implies this text format is not HTML anymore.',
1=>'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert URLs into links</em>" (<em class="placeholder">filter_url</em>) filter implies this text format is not HTML anymore.',
],
''=>'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_messages'=>[
'The following plugins were enabled to support tags that are allowed by this 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 following tags were permitted by this 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>.',
'This format\'s HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin\'s <em>Manually editable HTML tags</em>: <a hreflang> <blockquote cite> <ul type> <ol start type> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>.',
''=>'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.',
],
];
yield"full_html can be switched to CKEditor 5 (no upgrade messages)"=>[
@@ -367,7 +367,7 @@ public function testPair(array $ckeditor5_settings, array $editor_image_upload_s
publicfunctionproviderPair():array{
// cspell:ignore donk
$data=[];
$data['INVALID: non-HTML format: filter_autop']=[
$data['VALID: legacy format: filter_autop']=[
'settings'=>[
'toolbar'=>[
'items'=>[
@@ -388,11 +388,9 @@ public function providerPair(): array {
'settings'=>[],
],
],
'violations'=>[
''=>'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert line breaks into HTML (i.e. <code>&lt;br&gt;</code> and <code>&lt;p&gt;</code>)</em>" (<em class="placeholder">filter_autop</em>) filter implies this text format is not HTML anymore.',
$data['VALID: legacy HTML format: filter_autop + filter_url']=[
'settings'=>[
'toolbar'=>[
'items'=>[
@@ -422,14 +420,9 @@ public function providerPair(): array {
],
],
],
'violations'=>[
''=>[
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert URLs into links</em>" (<em class="placeholder">filter_url</em>) filter implies this text format is not HTML anymore.',
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert line breaks into HTML (i.e. <code>&lt;br&gt;</code> and <code>&lt;p&gt;</code>)</em>" (<em class="placeholder">filter_autop</em>) filter implies this text format is not HTML anymore.',
$data['VALID: legacy HTML format: filter_autop + filter_url (different order)']=[
'settings'=>[
'toolbar'=>[
'items'=>[
@@ -459,12 +452,7 @@ public function providerPair(): array {
],
],
],
'violations'=>[
''=>[
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert line breaks into HTML (i.e. <code>&lt;br&gt;</code> and <code>&lt;p&gt;</code>)</em>" (<em class="placeholder">filter_autop</em>) filter implies this text format is not HTML anymore.',
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert URLs into links</em>" (<em class="placeholder">filter_url</em>) filter implies this text format is not HTML anymore.',
],
],
'violations'=>[],
];
$data['INVALID: forbidden tags']=[
'settings'=>[
@@ -506,10 +494,7 @@ public function providerPair(): array {
],
'filters'=>$restricted_html_format_filters,
'violations'=>[
''=>[
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert line breaks into HTML (i.e. <code>&lt;br&gt;</code> and <code>&lt;p&gt;</code>)</em>" (<em class="placeholder">filter_autop</em>) filter implies this text format is not HTML anymore.',
'CKEditor 5 only works with HTML-based text formats. The "<em class="placeholder">Convert URLs into links</em>" (<em class="placeholder">filter_url</em>) filter implies this text format is not HTML anymore.',
],
''=>'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.',
],
];
$data['INVALID: the modified restricted_html text format (with filter_autop and filter_url removed)']=[