Issue #3248177 by Wim Leers, marcvangend, lauriii, Lendude: Language toolbar item cannot be removed from the toolbar
parent
65c863be89
commit
88a8d35c51
|
@ -671,10 +671,18 @@ class CKEditor5 extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
|
||||
$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.
|
||||
|
|
|
@ -170,4 +170,32 @@ class AdminUiTest extends CKEditor5TestBase {
|
|||
$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"]');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -183,27 +183,6 @@ class CKEditor5AllowedTagsTest extends CKEditor5TestBase {
|
|||
$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…
Reference in New Issue