Skip to content
Snippets Groups Projects
Unverified Commit 190aae10 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2763075 by raman.b, Martijn de Wit, anon, borisson_: Adding new text...

Issue #2763075 by raman.b, Martijn de Wit, anon, borisson_: Adding new text format gives Uncaught TypeError: f.format_tags.split is not a function
parent 2a03fb2c
No related branches found
No related tags found
No related merge requests found
...@@ -116,8 +116,8 @@ public function getConfig(Editor $editor) { ...@@ -116,8 +116,8 @@ public function getConfig(Editor $editor) {
// Add the format_tags setting, if its button is enabled. // Add the format_tags setting, if its button is enabled.
$toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor); $toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor);
if (in_array('Format', $toolbar_buttons)) { if (in_array('Format', $toolbar_buttons) && $format_string = $this->generateFormatTagsSetting($editor)) {
$config['format_tags'] = $this->generateFormatTagsSetting($editor); $config['format_tags'] = $format_string;
} }
return $config; return $config;
...@@ -344,14 +344,15 @@ public function getButtons() { ...@@ -344,14 +344,15 @@ public function getButtons() {
* @param \Drupal\editor\Entity\Editor $editor * @param \Drupal\editor\Entity\Editor $editor
* A configured text editor object. * A configured text editor object.
* *
* @return array * @return string|false
* An array containing the "format_tags" configuration. * A string containing the "format_tags" configuration or FALSE if the
* editor has not an associated filter format.
*/ */
protected function generateFormatTagsSetting(Editor $editor) { protected function generateFormatTagsSetting(Editor $editor) {
// When no text format is associated yet, assume no tag is allowed. // When no text format is associated yet, assume no tag is allowed.
// @see \Drupal\editor\EditorInterface::hasAssociatedFilterFormat() // @see \Drupal\editor\EditorInterface::hasAssociatedFilterFormat()
if (!$editor->hasAssociatedFilterFormat()) { if (!$editor->hasAssociatedFilterFormat()) {
return []; return FALSE;
} }
$format = $editor->getFilterFormat(); $format = $editor->getFilterFormat();
......
...@@ -54,6 +54,7 @@ public function testEditorSelection() { ...@@ -54,6 +54,7 @@ public function testEditorSelection() {
$this->assertNotEmpty($assert_session->waitForText('sulaco')); $this->assertNotEmpty($assert_session->waitForText('sulaco'));
$page->selectFieldOption('editor[editor]', 'ckeditor'); $page->selectFieldOption('editor[editor]', 'ckeditor');
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', 'ul.ckeditor-toolbar-group-buttons')); $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', 'ul.ckeditor-toolbar-group-buttons'));
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#ckeditor-plugin-settings'));
$page->pressButton('Save configuration'); $page->pressButton('Save configuration');
// Test that toggling the editor selection off and back on works. // Test that toggling the editor selection off and back on works.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment