core/modules/ckeditor/ckeditor.admin.inc | 2 +- core/modules/ckeditor/ckeditor.api.php | 21 +++---- core/modules/ckeditor/ckeditor.module | 76 ++++++++++++++++++-------- core/modules/ckeditor/css/ckeditor.admin.css | 2 +- 4 files changed, 66 insertions(+), 35 deletions(-) diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc index 3342e1b..10f55fe 100644 --- a/core/modules/ckeditor/ckeditor.admin.inc +++ b/core/modules/ckeditor/ckeditor.admin.inc @@ -58,7 +58,7 @@ function theme_ckeditor_settings_toolbar($variables) { foreach ($row_buttons as $button) { $button_name = $button['name']; if (isset($button['image_alternative'])) { - $data = $button['image_alternative']; + $data = $button['image_alternative' . $rtl]; } elseif (isset($button['image'])) { $data = theme('image', array('uri' => $button['image' . $rtl], 'title' => $button['label'])); diff --git a/core/modules/ckeditor/ckeditor.api.php b/core/modules/ckeditor/ckeditor.api.php index f434b54..fa2c9e8 100644 --- a/core/modules/ckeditor/ckeditor.api.php +++ b/core/modules/ckeditor/ckeditor.api.php @@ -18,14 +18,14 @@ * file location so that CKEditor may add the plugin. Available properties for * each plugin include: * - * - location: Required for all external plugins. String path to the plugin + * - path: Required for all external plugins. String path to the plugin * directory relative to the Drupal installation root. Do not include a * trailing slash. * - file: Required for all external plugins. String file name of the plugin in - * the "location" directory. + * the "path" directory. * - internal: Boolean value indicating if the plugin is part of the compressed * CKEditor library package and already loaded on all instances. If TRUE, - * the "location" and "file" properties are not needed. + * the "path" and "file" properties are not needed. * - css: An array of CSS files that should be added by CKEditor. These files * are used only when CKEditor is using an iframe wrapper around its content. * If a plugin needs to include CSS for inline and iframe versions, it should @@ -33,17 +33,18 @@ * - enabled callback: String containing a function name that can determine if * this plugin should be enabled based on the current editor configuration. * See the hook_ckeditor_PLUGIN_plugin_check() function for an example. - * - buttons: An array of buttons that are provided by this plugin. Each button - * should by keyed by its CKEditor button name, and should contain an array - * of button properties, including: + * - buttons: An array of buttons that are provided by this plugin. This will + * only be used in the administrative section for assembling the toolbar. Each + * button should by keyed by its CKEditor button name, and should contain an + * array of button properties, including: * - label: A human-readable, translated button name. * - image: An image for the button to be used in the toolbar. * - image_rtl: If the image needs to have a right-to-left version, specify * an alternative file that will be used in RTL editors. * - image_alternative: If this button does not render as an image, specify - * an HTML string representing the contents of this button. This alternative - * will only be used in the administrative section for assembling the - * toolbar. + * an HTML string representing the contents of this button. + * - image_alternative_rtl: Similar to image_alternative, but a right-to-left + * version. * - attributes: An array of HTML attributes which should be added to this * button when rendering the button in the administrative section for * assembling the toolbar. @@ -103,7 +104,7 @@ function hook_ckeditor_plugins_alter(array &$plugins) { * ckeditor_stylesheets[] = css/ckeditor-iframe.css * @endcode * - * @param $css + * @param array &$css * An array of CSS files, passed by reference. This is a flat list of file * paths relative to the Drupal root. * @param $editor diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index 5eae915..8a6a1ec 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -5,8 +5,6 @@ * Provides integration with the CKEditor WYSIWYG editor. */ -define('CKEDITOR_VERSION', '4.0.1'); - /** * Implements hook_library_info(). */ @@ -45,6 +43,7 @@ function ckeditor_library_info() { ), 'css' => array( $module_path . '/css/ckeditor.admin.css' => array(), + 'core/misc/ckeditor/skins/moono/editor.css' => array(), ), 'dependencies' => array( array('system', 'jquery.once'), @@ -54,9 +53,9 @@ function ckeditor_library_info() { ); $libraries['ckeditor'] = array( 'title' => 'Loads the main CKEditor library.', - 'version' => CKEDITOR_VERSION, + 'version' => '4.0.1', 'js' => array( - '/core/misc/ckeditor/ckeditor.js' => array(), + 'core/misc/ckeditor/ckeditor.js' => array(), ), ); @@ -99,127 +98,163 @@ function ckeditor_plugins() { * Return a list of all plugins provided by this module. */ function ckeditor_ckeditor_plugins() { - $image_prefix = drupal_get_path('module', 'ckeditor') . '/images/buttons/'; + $button = function($name, $direction = 'ltr') { + return ' '; + }; + $buttons = array( 'Bold' => array( 'label' => t('Bold'), + 'image_alternative' => $button('bold'), 'required_tags' => array('strong'), ), 'Italic' => array( 'label' => t('Italic'), + 'image_alternative' => $button('italic'), 'required_tags' => array('em'), ), 'Underline' => array( 'label' => t('Underline'), + 'image_alternative' => $button('underline'), // A class is used on spans for underline. 'required_tags' => array('span'), ), 'Strike' => array( 'label' => t('Strike-through'), + 'image_alternative' => $button('strike'), 'required_tags' => array('del'), ), 'JustifyLeft' => array( 'label' => t('Align left'), + 'image_alternative' => $button('justifyleft'), 'required_tags' => array('p'), ), 'JustifyCenter' => array( 'label' => t('Align center'), + 'image_alternative' => $button('justifycenter'), 'required_tags' => array('p'), ), 'JustifyRight' => array( 'label' => t('Align right'), + 'image_alternative' => $button('justifyright'), 'required_tags' => array('p'), ), 'JustifyBlock' => array( 'label' => t('Justify'), + 'image_alternative' => $button('justifyblock'), 'required_tags' => array('p'), ), 'BulletedList' => array( 'label' => t('Bullet list'), - 'image_rtl' => $image_prefix . '/bulletedlist-rtl.png', + 'image_alternative' => $button('bulletedlist'), + 'image_alternative_rtl' => $button('bulletedlist', 'rtl'), 'required_tags' => array('ul', 'li'), ), 'NumberedList' => array( 'label' => t('Numbered list'), - 'image_rtl' => $image_prefix . '/numberedlist-rtl.png', + 'image_alternative' => $button('numberedlist'), + 'image_alternative_rtl' => $button('numberedlist', 'rtl'), 'required_tags' => array('ol', 'li'), ), 'Outdent' => array( 'label' => t('Outdent'), - 'image_rtl' => $image_prefix . '/outdent-rtl.png', + 'image_alternative' => $button('outdent'), + 'image_alternative_rtl' => $button('outdent', 'rtl'), 'required_tags' => array('p'), ), 'Indent' => array( 'label' => t('Indent'), - 'image_rtl' => $image_prefix . '/indent-rtl.png', + 'image_alternative' => $button('indent'), + 'image_alternative_rtl' => $button('indent', 'rtl'), 'required_tags' => array('p'), ), 'Undo' => array( 'label' => t('Undo'), - 'image_rtl' => $image_prefix . '/undo-rtl.png', + 'image_alternative' => $button('undo'), + 'image_alternative_rtl' => $button('undo', 'rtl'), ), 'Redo' => array( 'label' => t('Redo'), - 'image_rtl' => $image_prefix . '/redo-rtl.png', + 'image_alternative' => $button('redo'), + 'image_alternative_rtl' => $button('redo', 'rtl'), ), 'Link' => array( 'label' => t('Link'), + 'image_alternative' => $button('link'), 'required_tags' => array('a'), ), 'Unlink' => array( 'label' => t('Unlink'), + 'image_alternative' => $button('unlink'), 'required_tags' => array('a'), ), 'Anchor' => array( - 'image_rtl' => $image_prefix . '/anchor-rtl.png', 'label' => t('Anchor'), + 'image_alternative' => $button('anchor'), + 'image_alternative_rtl' => $button('anchor', 'rtl'), 'required_tags' => array('a'), ), 'Superscript' => array( 'label' => t('Superscript'), + 'image_alternative' => $button('superscript'), 'required_tags' => array('sup'), ), 'Subscript' => array( 'label' => t('Subscript'), + 'image_alternative' => $button('subscript'), 'required_tags' => array('sub'), ), 'Blockquote' => array( 'label' => t('Blockquote'), + 'image_alternative' => $button('blockquote'), 'required_tags' => array('blockquote'), ), 'Source' => array( 'label' => t('Source code'), + 'image_alternative' => $button('source'), ), 'HorizontalRule' => array( 'label' => t('Horizontal rule'), + 'image_alternative' => $button('horizontalrule'), 'required_tags' => array('hr'), ), 'Cut' => array( 'label' => t('Cut'), + 'image_alternative' => $button('cut'), + 'image_alternative_rtl' => $button('cut', 'rtl'), ), 'Copy' => array( 'label' => t('Copy'), + 'image_alternative' => $button('copy'), + 'image_alternative_rtl' => $button('copy', 'rtl'), ), 'Paste' => array( 'label' => t('Paste'), + 'image_alternative' => $button('paste'), + 'image_alternative_rtl' => $button('paste', 'rtl'), ), 'PasteText' => array( 'label' => t('Paste Text'), - 'image_rtl' => $image_prefix . '/pastetext-rtl.png', + 'image_alternative' => $button('pastetext'), + 'image_alternative_rtl' => $button('pastetext', 'rtl'), ), 'PasteFromWord' => array( 'label' => t('Paste from Word'), - 'image_rtl' => $image_prefix . '/pastefromword-rtl.png', + 'image_alternative' => $button('pastefromword'), + 'image_alternative_rtl' => $button('pastefromword', 'rtl'), ), 'ShowBlocks' => array( 'label' => t('Show blocks'), - 'image_rtl' => $image_prefix . '/showblocks-rtl.png', + 'image_alternative' => $button('showblocks'), + 'image_alternative_rtl' => $button('showblocks', 'rtl'), ), 'RemoveFormat' => array( 'label' => t('Remove format'), + 'image_alternative' => $button('removeformat'), ), 'SpecialChar' => array( 'label' => t('Character map'), + 'image_alternative' => $button('specialchar'), ), 'Format' => array( 'label' => t('HTML block format'), @@ -231,14 +266,17 @@ function ckeditor_ckeditor_plugins() { ), 'Image' => array( 'label' => t('Image'), + 'image_alternative' => $button('image'), 'required_tags' => array('img'), ), 'Table' => array( 'label' => t('Table'), + 'image_alternative' => $button('table'), 'required_tags' => array('table', 'thead', 'tbody', 'tr', 'td', 'th'), ), 'Maximize' => array( 'label' => t('Maximize'), + 'image_alternative' => $button('maximize'), ), '|' => array( 'label' => t('Group separator'), @@ -254,14 +292,6 @@ function ckeditor_ckeditor_plugins() { ), ); - // Populate image locations, which match button names. - foreach ($buttons as $button_name => &$button) { - if (!isset($button['image_alternative']) && !isset($button['image'])) { - // Because button names are ASCII text, drupal_strtolower() is not needed. - $button['image'] = $image_prefix . strtolower($button_name) . '.png'; - } - } - // List all the basic plugin buttons as an "internal" plugin. $plugins['default'] = array( 'buttons' => $buttons, diff --git a/core/modules/ckeditor/css/ckeditor.admin.css b/core/modules/ckeditor/css/ckeditor.admin.css index 15fad3b..0d70f36 100644 --- a/core/modules/ckeditor/css/ckeditor.admin.css +++ b/core/modules/ckeditor/css/ckeditor.admin.css @@ -89,7 +89,7 @@ ul.ckeditor-multiple-buttons li { } ul.ckeditor-buttons li.ckeditor-group-button-separator, ul.ckeditor-multiple-buttons li.ckeditor-group-button-separator { - background: url(../images/group-separator.png) no-repeat center center; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAdCAMAAABG4xbVAAAAhFBMVEUAAACmpqampqampqb////l5eX////5+fmmpqatra2urq6vr6+1tbW2tra4uLi6urq8vLzb29ve3t7i4uLl5eXn5+fo6Ojp6enq6urr6+vs7Ozt7e3u7u7v7+/w8PDx8fHy8vLz8/P09PT19fX29vb39/f4+Pj5+fn6+vr7+/v8/Pz+/v7qIQO+AAAACHRSTlMATVmAi8XM29MuWToAAABjSURBVBiVrc5BCoAwDETRMKhtRBduev9LKm1xjItWRBBE6Nt9QkIwOTcUzk0Imi8aoMssxbgoTHMtqsFMLta0vPh2N49HyfdelPg6k9uvX/a+Bmggt1qJRNzQFVgjEnkUZDoBmH57VSypjg4AAAAASUVORK5CYII=) no-repeat center center; width: 13px; padding: 0; height: 29px;