Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Annotation\CKEditorPlugin.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\Core\Plugin\PluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginButtonsInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +18,7 @@ namespace Drupal\ckeditor;
|
|||
* @see \Drupal\ckeditor\CKEditorPluginInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginContextualInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\CKEditorPluginManager
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginConfigurableInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -20,6 +15,7 @@ use Drupal\editor\Entity\Editor;
|
|||
* @see \Drupal\ckeditor\CKEditorPluginInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginContextualInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\CKEditorPluginManager
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginContextualInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
@ -24,6 +19,7 @@ use Drupal\editor\Entity\Editor;
|
|||
* @see \Drupal\ckeditor\CKEditorPluginInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\CKEditorPluginManager
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
|
|
39
core/modules/ckeditor/src/CKEditorPluginCssInterface.php
Normal file
39
core/modules/ckeditor/src/CKEditorPluginCssInterface.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
/**
|
||||
* Defines an interface for CKEditor plugins with associated CSS.
|
||||
*
|
||||
* This allows a CKEditor plugin to add additional CSS in iframe CKEditor
|
||||
* instances without needing to implement hook_ckeditor_css_alter().
|
||||
*
|
||||
* @see \Drupal\ckeditor\CKEditorPluginInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginContextualInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\CKEditorPluginManager
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
* @see plugin_api
|
||||
*/
|
||||
interface CKEditorPluginCssInterface extends CKEditorPluginInterface {
|
||||
|
||||
/**
|
||||
* Retrieves enabled plugins' iframe instance CSS files.
|
||||
*
|
||||
* Note: this does not use a Drupal asset library because this CSS will be
|
||||
* loaded by CKEditor, not by Drupal.
|
||||
*
|
||||
* @param \Drupal\editor\Entity\Editor $editor
|
||||
* A configured text editor object.
|
||||
*
|
||||
* @return string[]
|
||||
* An array of CSS files. This is a flat list of file paths relative to
|
||||
* the Drupal root.
|
||||
*/
|
||||
public function getCssFiles(Editor $editor);
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
|
@ -28,6 +23,7 @@ use Drupal\editor\Entity\Editor;
|
|||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginContextualInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\CKEditorPluginManager
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\CKEditorPluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor;
|
||||
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
|
@ -21,6 +16,7 @@ use Drupal\editor\Entity\Editor;
|
|||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginContextualInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface
|
||||
* @see \Drupal\ckeditor\CKEditorPluginBase
|
||||
* @see \Drupal\ckeditor\Annotation\CKEditorPlugin
|
||||
* @see plugin_api
|
||||
|
@ -71,15 +67,7 @@ class CKEditorPluginManager extends DefaultPluginManager {
|
|||
*/
|
||||
public function getEnabledPluginFiles(Editor $editor, $include_internal_plugins = FALSE) {
|
||||
$plugins = array_keys($this->getDefinitions());
|
||||
// Flatten each row.
|
||||
$toolbar_rows = array();
|
||||
$settings = $editor->getSettings();
|
||||
foreach ($settings['toolbar']['rows'] as $row_number => $row) {
|
||||
$toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function (&$result, $button_group) {
|
||||
return array_merge($result, $button_group['items']);
|
||||
}, array());
|
||||
}
|
||||
$toolbar_buttons = array_unique(NestedArray::mergeDeepArray($toolbar_rows));
|
||||
$toolbar_buttons = $this->getEnabledButtons($editor);
|
||||
$enabled_plugins = array();
|
||||
$additional_plugins = array();
|
||||
|
||||
|
@ -120,6 +108,26 @@ class CKEditorPluginManager extends DefaultPluginManager {
|
|||
return $enabled_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enabled toolbar buttons in the given text editor instance.
|
||||
*
|
||||
* @param \Drupal\editor\Entity\Editor $editor
|
||||
* A configured text editor object.
|
||||
*
|
||||
* @return string[]
|
||||
* A list of the toolbar buttons enabled in the given text editor instance.
|
||||
*/
|
||||
public static function getEnabledButtons(Editor $editor) {
|
||||
$toolbar_rows = [];
|
||||
$settings = $editor->getSettings();
|
||||
foreach ($settings['toolbar']['rows'] as $row_number => $row) {
|
||||
$toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function (&$result, $button_group) {
|
||||
return array_merge($result, $button_group['items']);
|
||||
}, []);
|
||||
}
|
||||
return array_unique(NestedArray::mergeDeepArray($toolbar_rows));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all available CKEditor buttons, keyed by plugin ID.
|
||||
*
|
||||
|
@ -127,7 +135,7 @@ class CKEditorPluginManager extends DefaultPluginManager {
|
|||
* All available CKEditor buttons, with plugin IDs as keys and button
|
||||
* metadata (as implemented by getButtons()) as values.
|
||||
*
|
||||
* @see CKEditorPluginButtonsInterface::getButtons()
|
||||
* @see \Drupal\ckeditor\CKEditorPluginButtonsInterface::getButtons()
|
||||
*/
|
||||
public function getButtons() {
|
||||
$plugins = array_keys($this->getDefinitions());
|
||||
|
@ -182,4 +190,32 @@ class CKEditorPluginManager extends DefaultPluginManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves enabled plugins' iframe instance CSS files, keyed by plugin ID.
|
||||
*
|
||||
* @param \Drupal\editor\Entity\Editor $editor
|
||||
* A configured text editor object.
|
||||
*
|
||||
* @return string[]
|
||||
* Enabled plugins CKEditor CSS files, with plugin IDs as keys and CSS file
|
||||
* paths relative to the Drupal root (as implemented by getCssFiles()) as
|
||||
* values.
|
||||
*
|
||||
* @see \Drupal\ckeditor\CKEditorPluginCssInterface::getCssFiles()
|
||||
*/
|
||||
public function getCssFiles(Editor $editor) {
|
||||
$enabled_plugins = array_keys($this->getEnabledPluginFiles($editor, TRUE));
|
||||
$css_files = array();
|
||||
|
||||
foreach ($enabled_plugins as $plugin_id) {
|
||||
$plugin = $this->createInstance($plugin_id);
|
||||
if ($plugin instanceof CKEditorPluginCssInterface) {
|
||||
$css_files[$plugin_id] = $plugin->getCssFiles($editor);
|
||||
}
|
||||
}
|
||||
|
||||
return $css_files;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImage.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
|
@ -56,7 +51,7 @@ class DrupalImage extends CKEditorPluginBase implements CKEditorPluginConfigurab
|
|||
return array(
|
||||
'DrupalImage' => array(
|
||||
'label' => t('Image'),
|
||||
'image' => drupal_get_path('module', 'ckeditor') . '/js/plugins/drupalimage/image.png',
|
||||
'image' => drupal_get_path('module', 'ckeditor') . '/js/plugins/drupalimage/icons/drupalimage.png',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\ckeditor\CKEditorPluginInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginCssInterface;
|
||||
|
||||
/**
|
||||
* Defines the "drupalimagecaption" plugin.
|
||||
|
@ -21,7 +17,7 @@ use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
|||
* module = "ckeditor"
|
||||
* )
|
||||
*/
|
||||
class DrupalImageCaption extends PluginBase implements CKEditorPluginInterface, CKEditorPluginContextualInterface {
|
||||
class DrupalImageCaption extends PluginBase implements CKEditorPluginInterface, CKEditorPluginContextualInterface, CKEditorPluginCssInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -69,6 +65,15 @@ class DrupalImageCaption extends PluginBase implements CKEditorPluginInterface,
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCssFiles(Editor $editor) {
|
||||
return array(
|
||||
drupal_get_path('module', 'ckeditor') . '/css/plugins/drupalimagecaption/ckeditor.drupalimagecaption.css'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalLink.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
|
@ -55,11 +50,11 @@ class DrupalLink extends CKEditorPluginBase {
|
|||
return array(
|
||||
'DrupalLink' => array(
|
||||
'label' => t('Link'),
|
||||
'image' => $path . '/link.png',
|
||||
'image' => $path . '/icons/drupallink.png',
|
||||
),
|
||||
'DrupalUnlink' => array(
|
||||
'label' => t('Unlink'),
|
||||
'image' => $path . '/unlink.png',
|
||||
'image' => $path . '/icons/drupalunlink.png',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
use Drupal\ckeditor\CKEditorPluginContextualInterface;
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
|
@ -24,7 +20,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
* label = @Translation("CKEditor core")
|
||||
* )
|
||||
*/
|
||||
class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInterface {
|
||||
class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInterface, CKEditorPluginContextualInterface {
|
||||
|
||||
/**
|
||||
* The cache backend.
|
||||
|
@ -81,6 +77,15 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isEnabled(Editor $editor) {
|
||||
// This plugin represents the core CKEditor plugins. They're always enabled:
|
||||
// its configuration is always necessary.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -100,6 +105,7 @@ class Internal extends CKEditorPluginBase implements ContainerFactoryPluginInter
|
|||
'resize_dir' => 'vertical',
|
||||
'justifyClasses' => array('text-align-left', 'text-align-center', 'text-align-right', 'text-align-justify'),
|
||||
'entities' => FALSE,
|
||||
'disableNativeSpellChecker' => FALSE,
|
||||
);
|
||||
|
||||
// Add the allowedContent setting, which ensures CKEditor only allows tags
|
||||
|
|
136
core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php
Normal file
136
core/modules/ckeditor/src/Plugin/CKEditorPlugin/Language.php
Normal file
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
use Drupal\ckeditor\CKEditorPluginConfigurableInterface;
|
||||
use Drupal\ckeditor\CKEditorPluginCssInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManager;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
/**
|
||||
* Defines the "language" plugin.
|
||||
*
|
||||
* @CKEditorPlugin(
|
||||
* id = "language",
|
||||
* label = @Translation("Language")
|
||||
* )
|
||||
*/
|
||||
class Language extends CKEditorPluginBase implements CKEditorPluginConfigurableInterface, CKEditorPluginCssInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isInternal() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFile() {
|
||||
// This plugin is already part of Drupal core's CKEditor build.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLibraries(Editor $editor) {
|
||||
return ['ckeditor/drupal.ckeditor.plugins.language'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfig(Editor $editor) {
|
||||
$language_list = [];
|
||||
$config = ['language_list' => 'un'];
|
||||
$settings = $editor->getSettings();
|
||||
if (isset($settings['plugins']['language'])) {
|
||||
$config = $settings['plugins']['language'];
|
||||
}
|
||||
|
||||
$predefined_languages = ($config['language_list'] === 'all') ?
|
||||
LanguageManager::getStandardLanguageList() :
|
||||
LanguageManager::getUnitedNationsLanguageList();
|
||||
|
||||
// Generate the language_list setting as expected by the CKEditor Language
|
||||
// plugin, but key the values by the full language name so that we can sort
|
||||
// them later on.
|
||||
foreach ($predefined_languages as $langcode => $language) {
|
||||
$english_name = $language[0];
|
||||
$direction = empty($language[2]) ? NULL : $language[2];
|
||||
if ($direction === LanguageInterface::DIRECTION_RTL) {
|
||||
$language_list[$english_name] = $langcode . ':' . $english_name . ':rtl';
|
||||
}
|
||||
else {
|
||||
$language_list[$english_name] = $langcode . ':' . $english_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort on full language name.
|
||||
ksort($language_list);
|
||||
$config = ['language_list' => array_values($language_list)];
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getButtons() {
|
||||
return [
|
||||
'Language' => [
|
||||
'label' => $this->t('Language'),
|
||||
'image_alternative' => [
|
||||
'#type' => 'inline_template',
|
||||
'#template' => '<a href="#" class="cke-icon-only" role="button" title="' . $this->t('Language') . '" aria-label="' . $this->t('Language') . '"><span class="cke_button_icon cke_button__language_icon">' . $this->t('Language') . '</span></a>',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
|
||||
// Defaults.
|
||||
$config = ['language_list' => 'un'];
|
||||
$settings = $editor->getSettings();
|
||||
if (isset($settings['plugins']['language'])) {
|
||||
$config = $settings['plugins']['language'];
|
||||
}
|
||||
|
||||
$predefined_languages = LanguageManager::getStandardLanguageList();
|
||||
$form['language_list'] = array(
|
||||
'#title' => $this->t('Language list'),
|
||||
'#title_display' => 'invisible',
|
||||
'#type' => 'select',
|
||||
'#options' => [
|
||||
'un' => $this->t("United Nations' official languages"),
|
||||
'all' => $this->t('All @count languages', ['@count' => count($predefined_languages)]),
|
||||
],
|
||||
'#default_value' => $config['language_list'],
|
||||
'#description' => $this->t('The list of languages to show in the language dropdown. The basic list will only show the <a href=":url">six official languages of the UN</a>. The extended list will show all @count languages that are available in Drupal.', [
|
||||
':url' => Url::fromUri('http://www.un.org/en/aboutun/languages.shtml/')->toString(),
|
||||
'@count' => count($predefined_languages),
|
||||
]),
|
||||
'#attached' => ['library' => ['ckeditor/drupal.ckeditor.language.admin']],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function getCssFiles(Editor $editor) {
|
||||
return array(
|
||||
drupal_get_path('module', 'ckeditor') . '/css/plugins/language/ckeditor.language.css'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\StylesCombo.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
|
||||
|
||||
use Drupal\ckeditor\CKEditorPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Plugin\Editor\CKEditor.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Plugin\Editor;
|
||||
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
|
@ -15,7 +10,7 @@ use Drupal\Core\Render\Element;
|
|||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\editor\Plugin\EditorBase;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\editor\Entity\Editor as EditorEntity;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -135,14 +130,14 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
),
|
||||
),
|
||||
),
|
||||
'plugins' => array(),
|
||||
'plugins' => ['language' => ['language_list' => 'un']],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) {
|
||||
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
|
||||
$settings = $editor->getSettings();
|
||||
|
||||
$ckeditor_settings_toolbar = array(
|
||||
|
@ -204,7 +199,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
}, array());
|
||||
// Build a fake Editor object, which we'll use to generate JavaScript
|
||||
// settings for this fake Editor instance.
|
||||
$fake_editor = entity_create('editor', array(
|
||||
$fake_editor = Editor::create(array(
|
||||
'format' => $editor->id(),
|
||||
'editor' => 'ckeditor',
|
||||
'settings' => array(
|
||||
|
@ -259,7 +254,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJSSettings(EditorEntity $editor) {
|
||||
public function getJSSettings(Editor $editor) {
|
||||
$settings = array();
|
||||
|
||||
// Get the settings for all enabled plugins, even the internal ones.
|
||||
|
@ -367,7 +362,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLibraries(EditorEntity $editor) {
|
||||
public function getLibraries(Editor $editor) {
|
||||
$libraries = array(
|
||||
'ckeditor/drupal.ckeditor',
|
||||
);
|
||||
|
@ -393,7 +388,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
* @return array
|
||||
* An array containing the "toolbar" configuration.
|
||||
*/
|
||||
public function buildToolbarJSSetting(EditorEntity $editor) {
|
||||
public function buildToolbarJSSetting(Editor $editor) {
|
||||
$toolbar = array();
|
||||
|
||||
$settings = $editor->getSettings();
|
||||
|
@ -416,12 +411,17 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
|
|||
* @return array
|
||||
* An array containing the "contentsCss" configuration.
|
||||
*/
|
||||
public function buildContentsCssJSSetting(EditorEntity $editor) {
|
||||
public function buildContentsCssJSSetting(Editor $editor) {
|
||||
$css = array(
|
||||
drupal_get_path('module', 'ckeditor') . '/css/ckeditor-iframe.css',
|
||||
drupal_get_path('module', 'system') . '/css/components/align.module.css',
|
||||
);
|
||||
$this->moduleHandler->alter('ckeditor_css', $css, $editor);
|
||||
// Get a list of all enabled plugins' iframe instance CSS files.
|
||||
$plugins_css = array_reduce($this->ckeditorPluginManager->getCssFiles($editor), function($result, $item) {
|
||||
return array_merge($result, array_values($item));
|
||||
}, array());
|
||||
$css = array_merge($css, $plugins_css);
|
||||
$css = array_merge($css, _ckeditor_theme_css());
|
||||
$css = array_map('file_create_url', $css);
|
||||
$css = array_map('file_url_transform_relative', $css);
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorAdminTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\filter\FilterFormatInterface;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests administration of CKEditor.
|
||||
|
@ -37,7 +33,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create text format.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
|
@ -109,7 +105,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
),
|
||||
),
|
||||
),
|
||||
'plugins' => array(),
|
||||
'plugins' => ['language' => ['language_list' => 'un']],
|
||||
);
|
||||
$this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings);
|
||||
|
||||
|
@ -148,7 +144,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$expected_settings['plugins']['stylescombo']['styles'] = '';
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Configure the Styles plugin, and ensure the updated settings are saved.
|
||||
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
|
||||
|
@ -159,7 +155,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n";
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Change the buttons that appear on the toolbar (in JavaScript, this is
|
||||
// done via drag and drop, but here we can only emulate the end result of
|
||||
|
@ -175,7 +171,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Check that the markup we're setting for the toolbar buttons (actually in
|
||||
// JavaScript's drupalSettings, and Unicode-escaped) is correctly rendered.
|
||||
|
@ -203,7 +199,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$this->assertTrue(count($ultra_llama_mode_checkbox) === 1, 'The "Ultra llama mode" checkbox exists and is not checked.');
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
|
||||
|
||||
// Finally, check the "Ultra llama mode" checkbox.
|
||||
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
|
||||
|
@ -217,7 +213,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$expected_settings['plugins']['llama_contextual_and_button']['ultra_llama_mode'] = TRUE;
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
|
||||
$this->assertIdentical($expected_settings, $editor->getSettings());
|
||||
$this->assertEqual($expected_settings, $editor->getSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,7 +278,7 @@ class CKEditorAdminTest extends WebTestBase {
|
|||
$expected_settings['plugins']['stylescombo']['styles'] = '';
|
||||
$editor = entity_load('editor', 'amazing_format');
|
||||
$this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
|
||||
$this->assertIdentical($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
|
||||
$this->assertEqual($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorLoadingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests loading of CKEditor.
|
||||
|
@ -41,22 +38,22 @@ class CKEditorLoadingTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create text format, associate CKEditor.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
'filters' => array(),
|
||||
));
|
||||
$filtered_html_format->save();
|
||||
$editor = entity_create('editor', array(
|
||||
$editor = Editor::create([
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
));
|
||||
]);
|
||||
$editor->save();
|
||||
|
||||
// Create a second format without an associated editor so a drop down select
|
||||
// list is created when selecting formats.
|
||||
$full_html_format = entity_create('filter_format', array(
|
||||
$full_html_format = FilterFormat::create(array(
|
||||
'format' => 'full_html',
|
||||
'name' => 'Full HTML',
|
||||
'weight' => 1,
|
||||
|
@ -146,6 +143,55 @@ class CKEditorLoadingTest extends WebTestBase {
|
|||
$this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct.");
|
||||
$this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.');
|
||||
$this->assertTrue(in_array('ckeditor/drupal.ckeditor', explode(',', $settings['ajaxPageState']['libraries'])), 'CKEditor glue library is present.');
|
||||
|
||||
// Assert that CKEditor uses Drupal's cache-busting query string by
|
||||
// comparing the setting sent with the page with the current query string.
|
||||
$settings = $this->getDrupalSettings();
|
||||
$expected = $settings['ckeditor']['timestamp'];
|
||||
$this->assertIdentical($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct before flushing all caches.");
|
||||
// Flush all caches then make sure that $settings['ckeditor']['timestamp']
|
||||
// still matches.
|
||||
drupal_flush_all_caches();
|
||||
$this->assertIdentical($expected, \Drupal::state()->get('system.css_js_query_string'), "CKEditor scripts cache-busting string is correct after flushing all caches.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests presence of essential configuration even without Internal's buttons.
|
||||
*/
|
||||
protected function testLoadingWithoutInternalButtons() {
|
||||
// Change the CKEditor text editor configuration to only have link buttons.
|
||||
// This means:
|
||||
// - 0 buttons are from \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal
|
||||
// - 2 buttons are from \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalLink
|
||||
$filtered_html_editor = Editor::load('filtered_html');
|
||||
$settings = $filtered_html_editor->getSettings();
|
||||
$settings['toolbar']['rows'] = [
|
||||
0 => [
|
||||
0 => [
|
||||
'name' => 'Links',
|
||||
'items' => [
|
||||
'DrupalLink',
|
||||
'DrupalUnlink',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
$filtered_html_editor->setSettings($settings)->save();
|
||||
|
||||
// Even when no buttons of \Drupal\ckeditor\Plugin\CKEditorPlugin\Internal
|
||||
// are in use, its configuration (Internal::getConfig()) is still essential:
|
||||
// this is configuration that is associated with the (custom, optimized)
|
||||
// build of CKEditor that Drupal core ships with. For example, it configures
|
||||
// CKEditor to not perform its default action of loading a config.js file,
|
||||
// to not convert special characters into HTML entities, and the allowedContent
|
||||
// setting to configure CKEditor's Advanced Content Filter.
|
||||
$this->drupalLogin($this->normalUser);
|
||||
$this->drupalGet('node/add/article');
|
||||
$editor_settings = $this->getDrupalSettings()['editor']['formats']['filtered_html']['editorSettings'];
|
||||
$this->assertTrue(isset($editor_settings['customConfig']));
|
||||
$this->assertTrue(isset($editor_settings['entities']));
|
||||
$this->assertTrue(isset($editor_settings['allowedContent']));
|
||||
$this->assertTrue(isset($editor_settings['disallowedContent']));
|
||||
}
|
||||
|
||||
protected function getThingsToCheck() {
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorPluginManagerTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests different ways of enabling CKEditor plugins.
|
||||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class CKEditorPluginManagerTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'filter', 'editor', 'ckeditor');
|
||||
|
||||
/**
|
||||
* The manager for "CKEditor plugin" plugins.
|
||||
*
|
||||
* @var \Drupal\Component\Plugin\PluginManagerInterface
|
||||
*/
|
||||
protected $manager;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Install the Filter module.
|
||||
$this->installSchema('system', 'url_alias');
|
||||
|
||||
// Create text format, associate CKEditor.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
'filters' => array(),
|
||||
));
|
||||
$filtered_html_format->save();
|
||||
$editor = entity_create('editor', array(
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
));
|
||||
$editor->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the enabling of plugins.
|
||||
*/
|
||||
function testEnabledPlugins() {
|
||||
$this->manager = $this->container->get('plugin.manager.ckeditor.plugin');
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
|
||||
// Case 1: no CKEditor plugins.
|
||||
$definitions = array_keys($this->manager->getDefinitions());
|
||||
sort($definitions);
|
||||
$this->assertIdentical(array('drupalimage', 'drupalimagecaption', 'drupallink', 'internal', 'stylescombo'), $definitions, 'No CKEditor plugins found besides the built-in ones.');
|
||||
$enabled_plugins = array(
|
||||
'drupalimage' => 'core/modules/ckeditor/js/plugins/drupalimage/plugin.js',
|
||||
'drupallink' => 'core/modules/ckeditor/js/plugins/drupallink/plugin.js',
|
||||
);
|
||||
$this->assertIdentical($enabled_plugins, $this->manager->getEnabledPluginFiles($editor), 'Only built-in plugins are enabled.');
|
||||
$this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPluginFiles($editor, TRUE), 'Only the "internal" plugin is enabled.');
|
||||
|
||||
// Enable the CKEditor Test module, which has the Llama plugin (plus three
|
||||
// variations of it, to cover all possible ways a plugin can be enabled) and
|
||||
// clear the editor manager's cache so it is picked up.
|
||||
$this->enableModules(array('ckeditor_test'));
|
||||
$this->manager = $this->container->get('plugin.manager.ckeditor.plugin');
|
||||
$this->manager->clearCachedDefinitions();
|
||||
|
||||
// Case 2: CKEditor plugins are available.
|
||||
$plugin_ids = array_keys($this->manager->getDefinitions());
|
||||
sort($plugin_ids);
|
||||
$this->assertIdentical(array('drupalimage', 'drupalimagecaption', 'drupallink', 'internal', 'llama', 'llama_button', 'llama_contextual', 'llama_contextual_and_button', 'stylescombo'), $plugin_ids, 'Additional CKEditor plugins found.');
|
||||
$this->assertIdentical($enabled_plugins, $this->manager->getEnabledPluginFiles($editor), 'Only the internal plugins are enabled.');
|
||||
$this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPluginFiles($editor, TRUE), 'Only the "internal" plugin is enabled.');
|
||||
|
||||
// Case 3: enable each of the newly available plugins, if possible:
|
||||
// a. Llama: cannot be enabled, since it does not implement
|
||||
// CKEditorPluginContextualInterface nor CKEditorPluginButtonsInterface.
|
||||
// b. LlamaContextual: enabled by adding the 'Strike' button, which is
|
||||
// part of another plugin!
|
||||
// c. LlamaButton: automatically enabled by adding its 'Llama' button.
|
||||
// d. LlamaContextualAndButton: enabled by either b or c.
|
||||
// Below, we will first enable the "Llama" button, which will cause the
|
||||
// LlamaButton and LlamaContextualAndButton plugins to be enabled. Then we
|
||||
// will remove the "Llama" button and add the "Strike" button, which will
|
||||
// cause the LlamaContextual and LlamaContextualAndButton plugins to be
|
||||
// enabled. Finally, we will add the "Strike" button back again, which would
|
||||
// cause all three plugins to be enabled.
|
||||
$settings = $editor->getSettings();
|
||||
$original_toolbar = $settings['toolbar'];
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Llama';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$file = array();
|
||||
$file['b'] = 'core/modules/ckeditor/tests/modules/js/llama_button.js';
|
||||
$file['c'] = 'core/modules/ckeditor/tests/modules/js/llama_contextual.js';
|
||||
$file['cb'] = 'core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js';
|
||||
$expected = $enabled_plugins + array('llama_button' => $file['b'], 'llama_contextual_and_button' => $file['cb']);
|
||||
$this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
|
||||
$this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
|
||||
$settings['toolbar'] = $original_toolbar;
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Strike';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected = $enabled_plugins + array('llama_contextual' => $file['c'], 'llama_contextual_and_button' => $file['cb']);
|
||||
$this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The LLamaContextual and LlamaContextualAndButton plugins are enabled.');
|
||||
$this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LlamaContextual and LlamaContextualAndButton plugins are enabled.');
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Llama';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected = $enabled_plugins + array('llama_button' => $file['b'], 'llama_contextual' => $file['c'], 'llama_contextual_and_button' => $file['cb']);
|
||||
$this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The LlamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
|
||||
$this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LLamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,487 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
||||
/**
|
||||
* Tests for the 'CKEditor' text editor plugin.
|
||||
*
|
||||
* @group ckeditor
|
||||
*/
|
||||
class CKEditorTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'user', 'filter', 'editor', 'ckeditor', 'filter_test');
|
||||
|
||||
/**
|
||||
* An instance of the "CKEditor" text editor plugin.
|
||||
*
|
||||
* @var \Drupal\ckeditor\Plugin\Editor\CKEditor;
|
||||
*/
|
||||
protected $ckeditor;
|
||||
|
||||
/**
|
||||
* The Editor Plugin Manager.
|
||||
*
|
||||
* @var \Drupal\editor\Plugin\EditorManager;
|
||||
*/
|
||||
protected $manager;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Install the Filter module.
|
||||
$this->installSchema('system', 'url_alias');
|
||||
|
||||
// Create text format, associate CKEditor.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
'filters' => array(
|
||||
'filter_html' => array(
|
||||
'status' => 1,
|
||||
'settings' => array(
|
||||
'allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>',
|
||||
)
|
||||
),
|
||||
),
|
||||
));
|
||||
$filtered_html_format->save();
|
||||
$editor = entity_create('editor', array(
|
||||
'format' => 'filtered_html',
|
||||
'editor' => 'ckeditor',
|
||||
));
|
||||
$editor->save();
|
||||
|
||||
// Create "CKEditor" text editor plugin instance.
|
||||
$this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests CKEditor::getJSSettings().
|
||||
*/
|
||||
function testGetJSSettings() {
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
|
||||
// Default toolbar.
|
||||
$expected_config = $this->getDefaultInternalConfig() + array(
|
||||
'drupalImage_dialogTitleAdd' => 'Insert Image',
|
||||
'drupalImage_dialogTitleEdit' => 'Edit Image',
|
||||
'drupalLink_dialogTitleAdd' => 'Add Link',
|
||||
'drupalLink_dialogTitleEdit' => 'Edit Link',
|
||||
'allowedContent' => $this->getDefaultAllowedContentConfig(),
|
||||
'disallowedContent' => $this->getDefaultDisallowedContentConfig(),
|
||||
'toolbar' => $this->getDefaultToolbarConfig(),
|
||||
'contentsCss' => $this->getDefaultContentsCssConfig(),
|
||||
'extraPlugins' => 'drupalimage,drupallink',
|
||||
'language' => 'en',
|
||||
'stylesSet' => FALSE,
|
||||
'drupalExternalPlugins' => array(
|
||||
'drupalimage' => file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/plugin.js')),
|
||||
'drupallink' => file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupallink/plugin.js')),
|
||||
),
|
||||
);
|
||||
$expected_config = $this->castSafeStrings($expected_config);
|
||||
ksort($expected_config);
|
||||
ksort($expected_config['allowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for default configuration.');
|
||||
|
||||
// Customize the configuration: add button, have two contextually enabled
|
||||
// buttons, and configure a CKEditor plugin setting.
|
||||
$this->enableModules(array('ckeditor_test'));
|
||||
$this->container->get('plugin.manager.editor')->clearCachedDefinitions();
|
||||
$this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
|
||||
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
|
||||
$settings = $editor->getSettings();
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Strike';
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Format';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected_config['toolbar'][0]['items'][] = 'Strike';
|
||||
$expected_config['toolbar'][0]['items'][] = 'Format';
|
||||
$expected_config['format_tags'] = 'p;h2;h3;h4;h5;h6';
|
||||
$expected_config['extraPlugins'] .= ',llama_contextual,llama_contextual_and_button';
|
||||
$expected_config['drupalExternalPlugins']['llama_contextual'] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual.js'));
|
||||
$expected_config['drupalExternalPlugins']['llama_contextual_and_button'] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js'));
|
||||
$expected_config['contentsCss'][] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/ckeditor_test.css'));
|
||||
ksort($expected_config);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Change the allowed HTML tags; the "allowedContent" and "format_tags"
|
||||
// settings for CKEditor should automatically be updated as well.
|
||||
$format = $editor->getFilterFormat();
|
||||
$format->filters('filter_html')->settings['allowed_html'] .= '<pre class> <h1> <blockquote class="*"> <address class="foo bar-* *">';
|
||||
$format->save();
|
||||
|
||||
$expected_config['allowedContent']['pre'] = array('attributes' => 'class', 'styles' => FALSE, 'classes' => TRUE);
|
||||
$expected_config['allowedContent']['h1'] = array('attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE);
|
||||
$expected_config['allowedContent']['blockquote'] = array('attributes' => 'class', 'styles' => FALSE, 'classes' => TRUE);
|
||||
$expected_config['allowedContent']['address'] = array('attributes' => 'class', 'styles' => FALSE, 'classes' => 'foo,bar-*');
|
||||
$expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre';
|
||||
ksort($expected_config['allowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Disable the filter_html filter: allow *all *tags.
|
||||
$format->setFilterConfig('filter_html', array('status' => 0));
|
||||
$format->save();
|
||||
|
||||
$expected_config['allowedContent'] = TRUE;
|
||||
$expected_config['disallowedContent'] = FALSE;
|
||||
$expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre';
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
|
||||
// Enable the filter_test_restrict_tags_and_attributes filter.
|
||||
$format->setFilterConfig('filter_test_restrict_tags_and_attributes', array(
|
||||
'status' => 1,
|
||||
'settings' => array(
|
||||
'restrictions' => array(
|
||||
'allowed' => array(
|
||||
'p' => TRUE,
|
||||
'a' => array(
|
||||
'href' => TRUE,
|
||||
'rel' => array('nofollow' => TRUE),
|
||||
'class' => array('external' => TRUE),
|
||||
'target' => array('_blank' => FALSE),
|
||||
),
|
||||
'span' => array(
|
||||
'class' => array('dodo' => FALSE),
|
||||
'property' => array('dc:*' => TRUE),
|
||||
'rel' => array('foaf:*' => FALSE),
|
||||
'style' => array('underline' => FALSE, 'color' => FALSE, 'font-size' => TRUE),
|
||||
),
|
||||
'*' => array(
|
||||
'style' => FALSE,
|
||||
'on*' => FALSE,
|
||||
'class' => array('is-a-hipster-llama' => TRUE, 'and-more' => TRUE),
|
||||
'data-*' => TRUE,
|
||||
),
|
||||
'del' => FALSE,
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
$format->save();
|
||||
|
||||
$expected_config['allowedContent'] = array(
|
||||
'p' => array(
|
||||
'attributes' => TRUE,
|
||||
'styles' => FALSE,
|
||||
'classes' => 'is-a-hipster-llama,and-more',
|
||||
),
|
||||
'a' => array(
|
||||
'attributes' => 'href,rel,class,target',
|
||||
'styles' => FALSE,
|
||||
'classes' => 'external',
|
||||
),
|
||||
'span' => array(
|
||||
'attributes' => 'class,property,rel,style',
|
||||
'styles' => 'font-size',
|
||||
'classes' => FALSE,
|
||||
),
|
||||
'*' => array(
|
||||
'attributes' => 'class,data-*',
|
||||
'styles' => FALSE,
|
||||
'classes' => 'is-a-hipster-llama,and-more',
|
||||
),
|
||||
'del' => array(
|
||||
'attributes' => FALSE,
|
||||
'styles' => FALSE,
|
||||
'classes' => FALSE,
|
||||
),
|
||||
);
|
||||
$expected_config['disallowedContent'] = array(
|
||||
'span' => array(
|
||||
'styles' => 'underline,color',
|
||||
'classes' => 'dodo',
|
||||
),
|
||||
'*' => array(
|
||||
'attributes' => 'on*',
|
||||
),
|
||||
);
|
||||
$expected_config['format_tags'] = 'p';
|
||||
ksort($expected_config);
|
||||
ksort($expected_config['allowedContent']);
|
||||
ksort($expected_config['disallowedContent']);
|
||||
$this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests CKEditor::buildToolbarJSSetting().
|
||||
*/
|
||||
function testBuildToolbarJSSetting() {
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
|
||||
// Default toolbar.
|
||||
$expected = $this->getDefaultToolbarConfig();
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for default toolbar.');
|
||||
|
||||
// Customize the configuration.
|
||||
$settings = $editor->getSettings();
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Strike';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected[0]['items'][] = 'Strike';
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar.');
|
||||
|
||||
// Enable the editor_test module, customize further.
|
||||
$this->enableModules(array('ckeditor_test'));
|
||||
$this->container->get('plugin.manager.ckeditor.plugin')->clearCachedDefinitions();
|
||||
// Override the label of a toolbar component.
|
||||
$settings['toolbar']['rows'][0][0]['name'] = 'JunkScience';
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Llama';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected[0]['name'] = 'JunkScience';
|
||||
$expected[0]['items'][] = 'Llama';
|
||||
$this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar with contrib module-provided CKEditor plugin.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests CKEditor::buildContentsCssJSSetting().
|
||||
*/
|
||||
function testBuildContentsCssJSSetting() {
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
|
||||
// Default toolbar.
|
||||
$expected = $this->getDefaultContentsCssConfig();
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly for default toolbar.');
|
||||
|
||||
// Enable the editor_test module, which implements hook_ckeditor_css_alter().
|
||||
$this->enableModules(array('ckeditor_test'));
|
||||
$expected[] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/ckeditor_test.css'));
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a hook_ckeditor_css_alter() implementation exists.');
|
||||
|
||||
// Enable the Bartik theme, which specifies a CKEditor stylesheet.
|
||||
\Drupal::service('theme_handler')->install(['bartik']);
|
||||
$this->config('system.theme')->set('default', 'bartik')->save();
|
||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/base/elements.css'));
|
||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/captions.css'));
|
||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/table.css'));
|
||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/text-formatted.css'));
|
||||
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a theme providing a CKEditor stylesheet exists.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Internal::getConfig().
|
||||
*/
|
||||
function testInternalGetConfig() {
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$internal_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('internal');
|
||||
|
||||
// Default toolbar.
|
||||
$expected = $this->getDefaultInternalConfig();
|
||||
$expected['disallowedContent'] = $this->getDefaultDisallowedContentConfig();
|
||||
$expected['allowedContent'] = $this->getDefaultAllowedContentConfig();
|
||||
$this->assertEqual($expected, $internal_plugin->getConfig($editor), '"Internal" plugin configuration built correctly for default toolbar.');
|
||||
|
||||
// Format dropdown/button enabled: new setting should be present.
|
||||
$settings = $editor->getSettings();
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Format';
|
||||
$editor->setSettings($settings);
|
||||
$expected['format_tags'] = 'p;h2;h3;h4;h5;h6';
|
||||
$this->assertEqual($expected, $internal_plugin->getConfig($editor), '"Internal" plugin configuration built correctly for customized toolbar.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests StylesCombo::getConfig().
|
||||
*/
|
||||
function testStylesComboGetConfig() {
|
||||
$editor = entity_load('editor', 'filtered_html');
|
||||
$stylescombo_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('stylescombo');
|
||||
|
||||
// Styles dropdown/button enabled: new setting should be present.
|
||||
$settings = $editor->getSettings();
|
||||
$settings['toolbar']['rows'][0][0]['items'][] = 'Styles';
|
||||
$settings['plugins']['stylescombo']['styles'] = '';
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected['stylesSet'] = array();
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
|
||||
// Configure the optional "styles" setting in odd ways that shouldn't affect
|
||||
// the end result.
|
||||
$settings['plugins']['stylescombo']['styles'] = " \n";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor));
|
||||
$settings['plugins']['stylescombo']['styles'] = "\r\n \n \r \n ";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
|
||||
// Now configure it properly, the end result should change.
|
||||
$settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.mAgical.Callout|Callout";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected['stylesSet'] = array(
|
||||
array('name' => 'Title', 'element' => 'h1', 'attributes' => array('class' => 'title')),
|
||||
array('name' => 'Callout', 'element' => 'p', 'attributes' => array('class' => 'mAgical Callout')),
|
||||
);
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
|
||||
// Same configuration, but now interspersed with nonsense. Should yield the
|
||||
// same result.
|
||||
$settings['plugins']['stylescombo']['styles'] = " h1 .title | Title \r \n\r \np.mAgical .Callout|Callout\r";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
|
||||
// Slightly different configuration: class names are optional.
|
||||
$settings['plugins']['stylescombo']['styles'] = " h1 | Title ";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected['stylesSet'] = array(array('name' => 'Title', 'element' => 'h1'));
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
|
||||
// Invalid syntax should cause stylesSet to be set to FALSE.
|
||||
$settings['plugins']['stylescombo']['styles'] = "h1";
|
||||
$editor->setSettings($settings);
|
||||
$editor->save();
|
||||
$expected['stylesSet'] = FALSE;
|
||||
$this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests language list availability in CKEditor.
|
||||
*/
|
||||
function testLanguages() {
|
||||
// Get CKEditor supported language codes and spot-check.
|
||||
$this->enableModules(array('language'));
|
||||
$this->installConfig(array('language'));
|
||||
$langcodes = $this->ckeditor->getLangcodes();
|
||||
|
||||
// Language codes transformed with browser mappings.
|
||||
$this->assertTrue($langcodes['pt-pt'] == 'pt', '"pt" properly resolved');
|
||||
$this->assertTrue($langcodes['zh-hans'] == 'zh-cn', '"zh-hans" properly resolved');
|
||||
|
||||
// Language code both in Drupal and CKEditor.
|
||||
$this->assertTrue($langcodes['gl'] == 'gl', '"gl" properly resolved');
|
||||
|
||||
// Language codes only in CKEditor.
|
||||
$this->assertTrue($langcodes['en-au'] == 'en-au', '"en-au" properly resolved');
|
||||
$this->assertTrue($langcodes['sr-latn'] == 'sr-latn', '"sr-latn" properly resolved');
|
||||
|
||||
// No locale module, so even though languages are enabled, CKEditor should
|
||||
// still be in English.
|
||||
$this->assertCKEditorLanguage('en');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that CKEditor plugins participate in JS translation.
|
||||
*/
|
||||
function testJSTranslation() {
|
||||
$this->enableModules(array('language', 'locale'));
|
||||
$this->installSchema('locale', 'locales_source');
|
||||
$this->installSchema('locale', 'locales_location');
|
||||
$this->installSchema('locale', 'locales_target');
|
||||
$editor = Editor::load('filtered_html');
|
||||
$this->ckeditor->getJSSettings($editor);
|
||||
$localeStorage = $this->container->get('locale.storage');
|
||||
$string = $localeStorage->findString(array('source' => 'Edit Link', 'context' => ''));
|
||||
$this->assertTrue(!empty($string), 'String from JavaScript file saved.');
|
||||
|
||||
// With locale module, CKEditor should not adhere to the language selected.
|
||||
$this->assertCKEditorLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that CKEditor picks the expected language when French is default.
|
||||
*
|
||||
* @param string $langcode
|
||||
* Language code to assert for. Defaults to French. That is the default
|
||||
* language set in this assertion.
|
||||
*/
|
||||
protected function assertCKEditorLanguage($langcode = 'fr') {
|
||||
// Set French as the site default language.
|
||||
ConfigurableLanguage::createFromLangcode('fr')->save();
|
||||
$this->config('system.site')->set('default_langcode', 'fr')->save();
|
||||
|
||||
// Reset the language manager so new negotiations attempts will fall back on
|
||||
// French. Reinject the language manager CKEditor to use the current one.
|
||||
$this->container->get('language_manager')->reset();
|
||||
$this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
|
||||
|
||||
// Test that we now get the expected language.
|
||||
$editor = Editor::load('filtered_html');
|
||||
$settings = $this->ckeditor->getJSSettings($editor);
|
||||
$this->assertEqual($settings['language'], $langcode);
|
||||
}
|
||||
|
||||
protected function getDefaultInternalConfig() {
|
||||
return array(
|
||||
'customConfig' => '',
|
||||
'pasteFromWordPromptCleanup' => TRUE,
|
||||
'resize_dir' => 'vertical',
|
||||
'justifyClasses' => array('text-align-left', 'text-align-center', 'text-align-right', 'text-align-justify'),
|
||||
'entities' => FALSE,
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDefaultAllowedContentConfig() {
|
||||
return [
|
||||
'h2' => ['attributes' => 'id', 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h3' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h4' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h5' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'h6' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'p' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'br' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'strong' => ['attributes' => FALSE, 'styles' => FALSE, 'classes' => FALSE],
|
||||
'a' => ['attributes' => 'href,hreflang', 'styles' => FALSE, 'classes' => FALSE],
|
||||
'*' => ['attributes' => 'lang,dir', 'styles' => FALSE, 'classes' => FALSE],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getDefaultDisallowedContentConfig() {
|
||||
return array(
|
||||
'*' => array('attributes' => 'on*'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDefaultToolbarConfig() {
|
||||
return array(
|
||||
array(
|
||||
'name' => 'Formatting',
|
||||
'items' => array('Bold', 'Italic',),
|
||||
),
|
||||
array(
|
||||
'name' => 'Links',
|
||||
'items' => array('DrupalLink', 'DrupalUnlink',),
|
||||
),
|
||||
array(
|
||||
'name' => 'Lists',
|
||||
'items' => array('BulletedList', 'NumberedList',),
|
||||
),
|
||||
array(
|
||||
'name' => 'Media',
|
||||
'items' => array('Blockquote', 'DrupalImage',),
|
||||
),
|
||||
array(
|
||||
'name' => 'Tools',
|
||||
'items' => array('Source',),
|
||||
),
|
||||
'/',
|
||||
);
|
||||
}
|
||||
|
||||
protected function getDefaultContentsCssConfig() {
|
||||
return array(
|
||||
file_url_transform_relative(file_create_url('core/modules/ckeditor/css/ckeditor-iframe.css')),
|
||||
file_url_transform_relative(file_create_url('core/modules/system/css/components/align.module.css')),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\ckeditor\Tests\CKEditorToolbarButtonTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\ckeditor\Tests;
|
||||
|
||||
|
@ -74,7 +70,7 @@ class CKEditorToolbarButtonTest extends WebTestBase {
|
|||
$json_encode = function($html) {
|
||||
return trim(Json::encode($html), '"');
|
||||
};
|
||||
$markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/image.png')));
|
||||
$markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png')));
|
||||
$this->assertRaw($markup);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue