Loading core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php +10 −2 Original line number Diff line number Diff line Loading @@ -671,10 +671,18 @@ protected function getEventualEditorWithPrimedFilterFormat(SubformStateInterface $pair = static::createEphemeralPairedEditor($submitted_editor, $submitted_filter_format); // When CKEditor 5 plugins are disabled in the form-based admin UI, the // associated settings (if any) should be omitted too. $original_settings = $pair->getSettings(); $enabled_plugins = $this->ckeditor5PluginManager->getEnabledDefinitions($pair); $updated_settings = [ 'plugins' => array_intersect_key($original_settings['plugins'], $enabled_plugins), ] + $original_settings; $pair->setSettings($updated_settings); if ($pair->getFilterFormat()->filters('filter_html')->status) { // Compute elements provided by the current CKEditor 5 settings. $enabled_plugins = array_keys($this->ckeditor5PluginManager->getEnabledDefinitions($pair)); $elements = $this->ckeditor5PluginManager->getProvidedElements($enabled_plugins, $pair); $elements = $this->ckeditor5PluginManager->getProvidedElements(array_keys($enabled_plugins), $pair); // Compute eventual filter_html setting. Eventual as in: this is the list // of eventually allowed HTML tags. Loading core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php +28 −0 Original line number Diff line number Diff line Loading @@ -170,4 +170,32 @@ public function testMessagesDoNotAccumulate(): void { $this->assertCount(1, $find_validation_error_messages()); } /** * Tests the language config form. */ public function testLanguageConfigForm() { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); $this->createNewTextFormat($page, $assert_session); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); $this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-textPartLanguage')); $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowDown'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should now be present. $assert_session->elementExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); // It must also be possible to remove the language plugin again. $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowUp'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present anymore. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); } } core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php +0 −21 Original line number Diff line number Diff line Loading @@ -183,27 +183,6 @@ public function testSwitchToVersion5() { $assert_session->pageTextContains('The text format ckeditor has been updated'); } /** * Tests the language config form. */ public function testLanguageConfigForm() { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); $this->createNewTextFormat($page, $assert_session); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); $this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-textPartLanguage')); $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowDown'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should now be present. $assert_session->elementExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); } /** * Tests that the img tag is added after enabling image uploads. */ Loading Loading
core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php +10 −2 Original line number Diff line number Diff line Loading @@ -671,10 +671,18 @@ protected function getEventualEditorWithPrimedFilterFormat(SubformStateInterface $pair = static::createEphemeralPairedEditor($submitted_editor, $submitted_filter_format); // When CKEditor 5 plugins are disabled in the form-based admin UI, the // associated settings (if any) should be omitted too. $original_settings = $pair->getSettings(); $enabled_plugins = $this->ckeditor5PluginManager->getEnabledDefinitions($pair); $updated_settings = [ 'plugins' => array_intersect_key($original_settings['plugins'], $enabled_plugins), ] + $original_settings; $pair->setSettings($updated_settings); if ($pair->getFilterFormat()->filters('filter_html')->status) { // Compute elements provided by the current CKEditor 5 settings. $enabled_plugins = array_keys($this->ckeditor5PluginManager->getEnabledDefinitions($pair)); $elements = $this->ckeditor5PluginManager->getProvidedElements($enabled_plugins, $pair); $elements = $this->ckeditor5PluginManager->getProvidedElements(array_keys($enabled_plugins), $pair); // Compute eventual filter_html setting. Eventual as in: this is the list // of eventually allowed HTML tags. Loading
core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php +28 −0 Original line number Diff line number Diff line Loading @@ -170,4 +170,32 @@ public function testMessagesDoNotAccumulate(): void { $this->assertCount(1, $find_validation_error_messages()); } /** * Tests the language config form. */ public function testLanguageConfigForm() { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); $this->createNewTextFormat($page, $assert_session); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); $this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-textPartLanguage')); $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowDown'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should now be present. $assert_session->elementExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); // It must also be possible to remove the language plugin again. $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowUp'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present anymore. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); } }
core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php +0 −21 Original line number Diff line number Diff line Loading @@ -183,27 +183,6 @@ public function testSwitchToVersion5() { $assert_session->pageTextContains('The text format ckeditor has been updated'); } /** * Tests the language config form. */ public function testLanguageConfigForm() { $page = $this->getSession()->getPage(); $assert_session = $this->assertSession(); $this->createNewTextFormat($page, $assert_session); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should not be present. $assert_session->elementNotExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); $this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-textPartLanguage')); $this->triggerKeyUp('.ckeditor5-toolbar-item-textPartLanguage', 'ArrowDown'); $assert_session->assertWaitOnAjaxRequest(); // The language plugin config form should now be present. $assert_session->elementExists('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-language"]'); } /** * Tests that the img tag is added after enabling image uploads. */ Loading