Update to Drupal 8.1.8. For more information, see https://www.drupal.org/project/drupal/releases/8.1.8
This commit is contained in:
parent
e9f047ccf8
commit
f9f23cdf38
312 changed files with 6751 additions and 1546 deletions
|
@ -198,6 +198,10 @@
|
|||
far too wide focus indicator. This fixes that. */
|
||||
overflow: hidden;
|
||||
}
|
||||
.ckeditor-buttons .cke_button_icon img {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.ckeditor-buttons li .cke_ltr {
|
||||
direction: ltr;
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@
|
|||
* A HTML string for the button to toggle group names.
|
||||
*/
|
||||
Drupal.theme.ckeditorButtonGroupNamesToggle = function () {
|
||||
return '<a class="ckeditor-groupnames-toggle" role="button" aria-pressed="false"></a>';
|
||||
return '<button class="link ckeditor-groupnames-toggle" aria-pressed="false"></button>';
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,9 +96,16 @@ class StylesCombo extends CKEditorPluginBase implements CKEditorPluginConfigurab
|
|||
* #element_validate handler for the "styles" element in settingsForm().
|
||||
*/
|
||||
public function validateStylesValue(array $element, FormStateInterface $form_state) {
|
||||
if ($this->generateStylesSetSetting($element['#value']) === FALSE) {
|
||||
$styles_setting = $this->generateStylesSetSetting($element['#value']);
|
||||
if ($styles_setting === FALSE) {
|
||||
$form_state->setError($element, t('The provided list of styles is syntactically incorrect.'));
|
||||
}
|
||||
else {
|
||||
$style_names = array_map(function ($style) { return $style['name']; }, $styles_setting);
|
||||
if (count($style_names) !== count(array_unique($style_names))) {
|
||||
$form_state->setError($element, t('Each style must have a unique label.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests administration of the CKEditor StylesCombo plugin.
|
||||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class CKEditorStylesComboAdminTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['filter', 'editor', 'ckeditor'];
|
||||
|
||||
/**
|
||||
* A user with the 'administer filters' permission.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* A random generated format machine name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $format;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->format = strtolower($this->randomMachineName());
|
||||
$filter_format = FilterFormat::create([
|
||||
'format' => $this->format,
|
||||
'name' => $this->randomString(),
|
||||
'filters' => [],
|
||||
]);
|
||||
$filter_format->save();
|
||||
$editor = Editor::create([
|
||||
'format' => $this->format,
|
||||
'editor' => 'ckeditor',
|
||||
]);
|
||||
$editor->save();
|
||||
|
||||
$this->adminUser = $this->drupalCreateUser(['administer filters']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests StylesCombo settings for an existing text format.
|
||||
*/
|
||||
function testExistingFormat() {
|
||||
$ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
|
||||
$default_settings = $ckeditor->getDefaultSettings();
|
||||
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('admin/config/content/formats/manage/' . $this->format);
|
||||
|
||||
// Ensure an Editor config entity exists, with the proper settings.
|
||||
$expected_settings = $default_settings;
|
||||
$editor = Editor::load($this->format);
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Case 1: Configure the Styles plugin with different labels for each style,
|
||||
// and ensure the updated settings are saved.
|
||||
$this->drupalGet('admin/config/content/formats/manage/' . $this->format);
|
||||
$edit = [
|
||||
'editor[settings][plugins][stylescombo][styles]' => "h1.title|Title\np.callout|Callout\n\n",
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
|
||||
$expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n";
|
||||
$editor = Editor::load($this->format);
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Case 2: Configure the Styles plugin with same labels for each style, and
|
||||
// ensure that an error is displayed and that the updated settings are not
|
||||
// saved.
|
||||
$this->drupalGet('admin/config/content/formats/manage/' . $this->format);
|
||||
$edit = [
|
||||
'editor[settings][plugins][stylescombo][styles]' => "h1.title|Title\np.callout|Title\n\n",
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
|
||||
$this->assertRaw(t('Each style must have a unique label.'));
|
||||
$expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n";
|
||||
$editor = Editor::load($this->format);
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue