Loading core/modules/ckeditor5/ckeditor5.libraries.yml +12 −1 Original line number Diff line number Diff line Loading @@ -29,8 +29,17 @@ drupal.ckeditor5: - core/ckeditor5.editorDecoupled - core/ckeditor5 - editor/drupal.editor - ckeditor5/drupal.ckeditor5.quickedit-temporary-work-around - ckeditor5/ie11.user.warnings - ckeditor5/drupal.ckeditor5.stylesheets - core/drupalSettings - core/drupal.message # Library used for dynamically loading CKEditor 5 stylesheets from the default # front end theme. # @see ckeditor5_library_info_alter() drupal.ckeditor5.stylesheets: version: VERSION css: [] drupal.ckeditor5.quickedit-temporary-work-around: deprecated: "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands." Loading Loading @@ -103,6 +112,8 @@ drupal.ckeditor5.filter.admin: - core/drupal.message - core/once - core/drupal.ajax - core/drupalSettings - core/drupal.message admin: js: Loading core/modules/ckeditor5/ckeditor5.module +58 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ declare(strict_types = 1); use Drupal\ckeditor5\Plugin\Editor\CKEditor5; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\InvokeCommand; use Drupal\Core\Ajax\MessageCommand; Loading Loading @@ -392,6 +393,22 @@ function ckeditor5_library_info_alter(&$libraries, $extension) { } $moduleHandler = \Drupal::moduleHandler(); if ($extension === 'ckeditor5') { // Add paths to stylesheets specified by a theme's ckeditor5-stylesheets // config property. $css = _ckeditor5_theme_css(); $libraries['drupal.ckeditor5.stylesheets'] = [ 'css' => [ 'theme' => array_fill_keys(array_values($css), []), ], ]; if ($moduleHandler->moduleExists('quickedit')) { $libraries['drupal.ckeditor5']['dependencies'][] = 'ckeditor5/drupal.ckeditor5.quickedit-temporary-work-around'; } } // Only add translation processing if the locale module is enabled. if (!$moduleHandler->moduleExists('locale')) { return; Loading Loading @@ -558,3 +575,44 @@ function ckeditor5_config_schema_info_alter(&$definitions) { // @see @see editor.editor.*.image_upload $definitions['ckeditor5_valid_pair__format_and_editor']['mapping']['image_upload'] = $definitions['editor.editor.*']['mapping']['image_upload']; } /** * Retrieves the default theme's CKEditor 5 stylesheets. * * Themes may specify CSS files for use within CKEditor 5 by including a * "ckeditor5-stylesheets" key in their .info.yml file. * * @code * ckeditor5-stylesheets: * - css/ckeditor.css * @endcode * * @return string[] * A list of paths to CSS files. */ function _ckeditor5_theme_css($theme = NULL): array { $css = []; if (!isset($theme)) { $theme = \Drupal::config('system.theme')->get('default'); } if (isset($theme) && $theme_path = \Drupal::service('extension.list.theme')->getPath($theme)) { $info = \Drupal::service('extension.list.theme')->getExtensionInfo($theme); if (isset($info['ckeditor5-stylesheets'])) { $css = $info['ckeditor5-stylesheets']; foreach ($css as $key => $url) { // CSS url is external or relative to Drupal root. if (UrlHelper::isExternal($url) || $url[0] === '/') { $css[$key] = $url; } // CSS url is relative to theme. else { $css[$key] = '/' . $theme_path . '/' . $url; } } } if (isset($info['base theme'])) { $css = array_merge(_ckeditor5_theme_css($info['base theme']), $css); } } return $css; } core/modules/ckeditor5/ckeditor5.services.yml +10 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,13 @@ services: - '@plugin.manager.ckeditor5.plugin' - '@plugin.manager.ckeditor4to5upgrade.plugin' - '@?plugin.manager.ckeditor.plugin' ckeditor5.stylesheets.message: class: Drupal\ckeditor5\CKEditor5StylesheetsMessage arguments: - '@theme_handler' - '@config.factory' ckeditor5.ckeditor5_cache_tag: class: Drupal\ckeditor5\EventSubscriber\CKEditor5CacheTag arguments: ['@cache_tags.invalidator'] tags: - { name: event_subscriber } core/modules/ckeditor5/js/ie11.filter.warnings.es6.js +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ // Add a container for messages above the text format select element. const selectMessageContainer = document.createElement('div'); select.parentNode.insertBefore(selectMessageContainer, select); select.parentNode.after(selectMessageContainer, select); const selectMessages = new Drupal.Message(selectMessageContainer); const editorSettings = document.querySelector( '#editor-settings-wrapper', Loading core/modules/ckeditor5/js/ie11.filter.warnings.js +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ if (typeof editorSelect[0] !== 'undefined') { const select = editorSelect[0]; const selectMessageContainer = document.createElement('div'); select.parentNode.insertBefore(selectMessageContainer, select); select.parentNode.after(selectMessageContainer, select); const selectMessages = new Drupal.Message(selectMessageContainer); const editorSettings = document.querySelector('#editor-settings-wrapper'); Loading Loading
core/modules/ckeditor5/ckeditor5.libraries.yml +12 −1 Original line number Diff line number Diff line Loading @@ -29,8 +29,17 @@ drupal.ckeditor5: - core/ckeditor5.editorDecoupled - core/ckeditor5 - editor/drupal.editor - ckeditor5/drupal.ckeditor5.quickedit-temporary-work-around - ckeditor5/ie11.user.warnings - ckeditor5/drupal.ckeditor5.stylesheets - core/drupalSettings - core/drupal.message # Library used for dynamically loading CKEditor 5 stylesheets from the default # front end theme. # @see ckeditor5_library_info_alter() drupal.ckeditor5.stylesheets: version: VERSION css: [] drupal.ckeditor5.quickedit-temporary-work-around: deprecated: "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands." Loading Loading @@ -103,6 +112,8 @@ drupal.ckeditor5.filter.admin: - core/drupal.message - core/once - core/drupal.ajax - core/drupalSettings - core/drupal.message admin: js: Loading
core/modules/ckeditor5/ckeditor5.module +58 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ declare(strict_types = 1); use Drupal\ckeditor5\Plugin\Editor\CKEditor5; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\InvokeCommand; use Drupal\Core\Ajax\MessageCommand; Loading Loading @@ -392,6 +393,22 @@ function ckeditor5_library_info_alter(&$libraries, $extension) { } $moduleHandler = \Drupal::moduleHandler(); if ($extension === 'ckeditor5') { // Add paths to stylesheets specified by a theme's ckeditor5-stylesheets // config property. $css = _ckeditor5_theme_css(); $libraries['drupal.ckeditor5.stylesheets'] = [ 'css' => [ 'theme' => array_fill_keys(array_values($css), []), ], ]; if ($moduleHandler->moduleExists('quickedit')) { $libraries['drupal.ckeditor5']['dependencies'][] = 'ckeditor5/drupal.ckeditor5.quickedit-temporary-work-around'; } } // Only add translation processing if the locale module is enabled. if (!$moduleHandler->moduleExists('locale')) { return; Loading Loading @@ -558,3 +575,44 @@ function ckeditor5_config_schema_info_alter(&$definitions) { // @see @see editor.editor.*.image_upload $definitions['ckeditor5_valid_pair__format_and_editor']['mapping']['image_upload'] = $definitions['editor.editor.*']['mapping']['image_upload']; } /** * Retrieves the default theme's CKEditor 5 stylesheets. * * Themes may specify CSS files for use within CKEditor 5 by including a * "ckeditor5-stylesheets" key in their .info.yml file. * * @code * ckeditor5-stylesheets: * - css/ckeditor.css * @endcode * * @return string[] * A list of paths to CSS files. */ function _ckeditor5_theme_css($theme = NULL): array { $css = []; if (!isset($theme)) { $theme = \Drupal::config('system.theme')->get('default'); } if (isset($theme) && $theme_path = \Drupal::service('extension.list.theme')->getPath($theme)) { $info = \Drupal::service('extension.list.theme')->getExtensionInfo($theme); if (isset($info['ckeditor5-stylesheets'])) { $css = $info['ckeditor5-stylesheets']; foreach ($css as $key => $url) { // CSS url is external or relative to Drupal root. if (UrlHelper::isExternal($url) || $url[0] === '/') { $css[$key] = $url; } // CSS url is relative to theme. else { $css[$key] = '/' . $theme_path . '/' . $url; } } } if (isset($info['base theme'])) { $css = array_merge(_ckeditor5_theme_css($info['base theme']), $css); } } return $css; }
core/modules/ckeditor5/ckeditor5.services.yml +10 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,13 @@ services: - '@plugin.manager.ckeditor5.plugin' - '@plugin.manager.ckeditor4to5upgrade.plugin' - '@?plugin.manager.ckeditor.plugin' ckeditor5.stylesheets.message: class: Drupal\ckeditor5\CKEditor5StylesheetsMessage arguments: - '@theme_handler' - '@config.factory' ckeditor5.ckeditor5_cache_tag: class: Drupal\ckeditor5\EventSubscriber\CKEditor5CacheTag arguments: ['@cache_tags.invalidator'] tags: - { name: event_subscriber }
core/modules/ckeditor5/js/ie11.filter.warnings.es6.js +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ // Add a container for messages above the text format select element. const selectMessageContainer = document.createElement('div'); select.parentNode.insertBefore(selectMessageContainer, select); select.parentNode.after(selectMessageContainer, select); const selectMessages = new Drupal.Message(selectMessageContainer); const editorSettings = document.querySelector( '#editor-settings-wrapper', Loading
core/modules/ckeditor5/js/ie11.filter.warnings.js +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ if (typeof editorSelect[0] !== 'undefined') { const select = editorSelect[0]; const selectMessageContainer = document.createElement('div'); select.parentNode.insertBefore(selectMessageContainer, select); select.parentNode.after(selectMessageContainer, select); const selectMessages = new Drupal.Message(selectMessageContainer); const editorSettings = document.querySelector('#editor-settings-wrapper'); Loading