diff --git a/editors/ckeditor.inc b/editors/ckeditor.inc index 80c9fff..e53b2bf 100644 --- a/editors/ckeditor.inc +++ b/editors/ckeditor.inc @@ -32,6 +32,10 @@ function wysiwyg_ckeditor_editor() { ), ), 'install note callback' => 'wysiwyg_ckeditor_install_note', + 'toolbar groups' => TRUE, + 'toolbar rows' => TRUE, + 'toolbar separator' => '-', + 'install note callback' => 'wysiwyg_ckeditor_install_note', 'version callback' => 'wysiwyg_ckeditor_version', 'themes callback' => 'wysiwyg_ckeditor_themes', 'settings form callback' => 'wysiwyg_ckeditor_settings_form', @@ -41,7 +45,8 @@ function wysiwyg_ckeditor_editor() { 'plugin settings callback' => 'wysiwyg_ckeditor_plugin_settings', 'proxy plugin' => array( 'drupal' => array( - 'load' => TRUE, + 'title' => t('Drupal proxy plugin'), + 'load' => FALSE, 'proxy' => TRUE, ), ), @@ -428,73 +433,46 @@ function wysiwyg_ckeditor_settings($editor, $config, $theme) { $settings['resize_enabled'] = (bool) $config['resize_enabled']; } - $settings['toolbar'] = array(); - $supports_groups = version_compare($editor['installed version'], '3.6.0', '>='); - $use_default_groups = $supports_groups && !empty($config['default_toolbar_grouping']); - if (!empty($config['buttons'])) { - $extra_plugins = array(); - $plugins = wysiwyg_get_plugins($editor['name']); - foreach ($config['buttons'] as $plugin => $buttons) { - foreach ($buttons as $button => $enabled) { - // Iterate separately over buttons and extensions properties. - foreach (array('buttons', 'extensions') as $type) { - // Skip unavailable plugins. - if (!isset($plugins[$plugin][$type][$button])) { - continue; - } - // Add buttons. - if ($type == 'buttons') { - if ($use_default_groups) { - $settings['toolbar'][_wysiwyg_ckeditor_group($button)][] = $button; - } - else { - // Use one button row for backwards compatibility. - $settings['toolbar'][] = $button; - } - } - // Add external Drupal plugins to the list of extensions. - if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { - $extra_plugins[] = $button; - } - // Add external plugins to the list of extensions. - elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { - $extra_plugins[] = $plugin; - } - // Add internal buttons that also need to be loaded as extension. - elseif ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { - $extra_plugins[] = $plugin; - } - // Add plain extensions. - elseif ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { - $extra_plugins[] = $plugin; - } - // Allow plugins to add or override global configuration settings. - if (!empty($plugins[$plugin]['options'])) { - $settings = array_merge($settings, $plugins[$plugin]['options']); - } - } - } + $toolbar = array(); + $extra_plugins = array(); + $plugins = wysiwyg_get_plugins($editor['name']); + foreach ($config['plugins'] as $plugin => $enabled) { + if (!$enabled || !isset($plugins[$plugin])) { + continue; } - if (!empty($extra_plugins)) { - $settings['extraPlugins'] = implode(',', $extra_plugins); + // Add plain extensions. + if (!empty($plugins[$plugin]['load'])) { + $extra_plugins[] = $plugin; + } + // Allow plugins to add or override global configuration settings. + if (!empty($plugins[$plugin]['options'])) { + $settings = array_merge($settings, $plugins[$plugin]['options']); } } - if ($use_default_groups) { - // Organize groups to use lables to improves accessibility. - // http://docs.ckeditor.com/#!/guide/dev_toolbar-section-3. - $groups_toolbar = array(); - foreach ($settings['toolbar'] as $group => $items) { - $groups_toolbar[] = array( - 'name' => $group, - 'items' => $items, - ); - $settings['toolbar'] = $groups_toolbar; + foreach ($config['toolbar'] as $config_row) { + foreach ($config_row as $buttons) { + $row = array(); + foreach ($buttons as $button) { + // Cross-editor plugin buttons are prefixed by the proxy plugin name. + if (strpos($button, '.') !== FALSE) { + list($plugin, $button) = explode('.', $button); + // @todo Proxy-plugins: remove when allowing multiple buttons. + $extra_plugins[] = $button; + } + $row[] = $button; + } + $toolbar[] = $row; } + $toolbar[] = '/'; } - else { - // For now, all buttons are placed into one row. - $settings['toolbar'] = array($settings['toolbar']); + + // Remove the last '/'. + array_pop($toolbar); + $settings['toolbar'] = $toolbar; + + if (!empty($extra_plugins)) { + $settings['extraPlugins'] = implode(',', array_unique($extra_plugins)); } return $settings; @@ -596,6 +574,7 @@ function wysiwyg_ckeditor_proxy_plugin_settings($editor, $profile, $plugins) { function wysiwyg_ckeditor_plugins($editor) { $plugins = array( 'default' => array( + 'title' => t('CKEditor core'), 'buttons' => array( 'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'), 'Strike' => t('Strike-through'), diff --git a/editors/css/tinymce-2.css b/editors/css/tinymce-2.css index 4aa201d..b076335 100644 --- a/editors/css/tinymce-2.css +++ b/editors/css/tinymce-2.css @@ -6,22 +6,3 @@ table.mceEditor { clear: left; } -/** - * Align all buttons and separators in a single row, so they wrap into multiple - * rows if required. - */ -.mceToolbarTop a, .mceToolbarBottom a { - float: left; -} -.mceSeparatorLine { - float: left; - margin-top: 3px; -} -.mceSelectList { - float: left; - margin-bottom: 1px; -} -/* Place table plugin buttons into new row */ -#mce_editor_0_table, #mce_editor_1_table { - clear: left; -} diff --git a/editors/css/tinymce-3.css b/editors/css/tinymce-3.css index 5d0ebe9..ce13c63 100644 --- a/editors/css/tinymce-3.css +++ b/editors/css/tinymce-3.css @@ -6,19 +6,3 @@ table.mceLayout { clear: left; } -/** - * Align all buttons and separators in a single row, so they wrap into multiple - * rows if required. - */ -.mceToolbar td { - display: inline; -} -.mceToolbar a, -.mceSeparator { - float: left; -} -.mceListBox, -.mceSplitButton { - float: left; - margin-bottom: 1px; -} diff --git a/editors/fckeditor.inc b/editors/fckeditor.inc index 672e6d1..09fa867 100644 --- a/editors/fckeditor.inc +++ b/editors/fckeditor.inc @@ -19,6 +19,9 @@ function wysiwyg_fckeditor_editor() { 'files' => array('fckeditor.js'), ), ), + 'toolbar groups' => TRUE, + 'toolbar rows' => TRUE, + 'toolbar separator' => '-', 'version callback' => 'wysiwyg_fckeditor_version', 'themes callback' => 'wysiwyg_fckeditor_themes', 'settings form callback' => 'wysiwyg_fckeditor_settings_form', @@ -27,7 +30,8 @@ function wysiwyg_fckeditor_editor() { 'plugin settings callback' => 'wysiwyg_fckeditor_plugin_settings', 'proxy plugin' => array( 'drupal' => array( - 'load' => TRUE, + 'title' => t('Drupal proxy plugin'), + 'load' => FALSE, 'proxy' => TRUE, ), ), @@ -205,32 +209,36 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) { // Use our custom toolbar set. $settings['ToolbarSet'] = 'Wysiwyg'; - // Populate our custom toolbar set for fckeditor.config.js. - $settings['buttons'] = array(); - if (!empty($config['buttons'])) { - $plugins = wysiwyg_get_plugins($editor['name']); - foreach ($config['buttons'] as $plugin => $buttons) { - foreach ($buttons as $button => $enabled) { - // Iterate separately over buttons and extensions properties. - foreach (array('buttons', 'extensions') as $type) { - // Skip unavailable plugins. - if (!isset($plugins[$plugin][$type][$button])) { - continue; - } - // Add buttons. - if ($type == 'buttons') { - $settings['buttons'][] = $button; - } - // Allow plugins to add or override global configuration settings. - if (!empty($plugins[$plugin]['options'])) { - $settings = array_merge($settings, $plugins[$plugin]['options']); - } + $toolbar = array(); + $plugins = wysiwyg_get_plugins($editor['name']); + foreach ($config['plugins'] as $plugin => $enabled) { + if (!$enabled || !isset($plugins[$plugin])) { + continue; + } + // Allow plugins to add or override global configuration settings. + if (!empty($plugins[$plugin]['options'])) { + $settings = array_merge($settings, $plugins[$plugin]['options']); + } + } + + foreach ($config['toolbar'] as $row) { + foreach ($row as $buttons) { + $group = array(); + foreach ($buttons as $button_name) { + // Cross-editor plugin buttons are prefixed with the proxy plugin name. + if (strpos($button_name, '.') !== FALSE) { + list($plugin, $button_name) = explode('.', $button_name); } + $group[] = $button_name; } + $toolbar[] = $group; } + $toolbar[] = '/'; } - // For now, all buttons are placed into one row. - $settings['buttons'] = array($settings['buttons']); + // Remove the last '/'. + array_pop($toolbar); + + $settings['ToolbarSets']['Wysiwyg'] = $toolbar; return $settings; } @@ -281,6 +289,7 @@ function wysiwyg_fckeditor_proxy_plugin_settings($editor, $profile, $plugins) { function wysiwyg_fckeditor_plugins($editor) { $plugins = array( 'default' => array( + 'title' => t('FCKeditor core'), 'buttons' => array( 'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'), 'StrikeThrough' => t('Strike-through'), diff --git a/editors/js/fckeditor.config.js b/editors/js/fckeditor.config.js index d441055..9f05fc5 100644 --- a/editors/js/fckeditor.config.js +++ b/editors/js/fckeditor.config.js @@ -16,28 +16,7 @@ var pluginSettings = (Drupal.settings.wysiwyg.plugins[wysiwygFormat] ? Drupal.se * Apply format-specific settings. */ for (var setting in wysiwygSettings) { - if (setting == 'buttons') { - // Apply custom Wysiwyg toolbar for this format. - // FCKConfig.ToolbarSets['Wysiwyg'] = wysiwygSettings.buttons; - - // Temporarily stack buttons into multiple button groups and remove - // separators until #277954 is solved. - FCKConfig.ToolbarSets['Wysiwyg'] = []; - for (var i = 0; i < wysiwygSettings.buttons[0].length; i++) { - FCKConfig.ToolbarSets['Wysiwyg'].push([wysiwygSettings.buttons[0][i]]); - } - FCKTools.AppendStyleSheet(document, '#xToolbar .TB_Start { display:none; }'); - // Set valid height of select element in silver and office2003 skins. - if (FCKConfig.SkinPath.match(/\/office2003\/$/)) { - FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 24px; } #xToolbar .TB_End { display: none; }'); - } - else if (FCKConfig.SkinPath.match(/\/silver\/$/)) { - FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 27px; }'); - } - } - else { - FCKConfig[setting] = wysiwygSettings[setting]; - } + FCKConfig[setting] = wysiwygSettings[setting]; } // Fix Drupal toolbar obscuring editor toolbar in fullscreen mode. diff --git a/editors/markitup.inc b/editors/markitup.inc index faa35b4..05475d3 100644 --- a/editors/markitup.inc +++ b/editors/markitup.inc @@ -172,13 +172,9 @@ function wysiwyg_markitup_settings($editor, $config, $theme) { ), ); $settings['markupSet'] = array(); - if (!empty($config['buttons'])) { - foreach ($config['buttons'] as $plugin) { - foreach ($plugin as $button => $enabled) { - if (isset($default_buttons[$button])) { - $settings['markupSet'][$button] = $default_buttons[$button]; - } - } + if (!empty($config['toolbar'])) { + foreach ($config['toolbar'] as $button) { + $settings['markupSet'][$button] = $default_buttons[$button]; } } @@ -191,6 +187,7 @@ function wysiwyg_markitup_settings($editor, $config, $theme) { function wysiwyg_markitup_plugins($editor) { return array( 'default' => array( + 'title' => t('markItUp core'), 'buttons' => array( 'bold' => t('Bold'), 'italic' => t('Italic'), 'stroke' => t('Strike-through'), diff --git a/editors/nicedit.inc b/editors/nicedit.inc index 8a77564..fe48b2b 100644 --- a/editors/nicedit.inc +++ b/editors/nicedit.inc @@ -79,12 +79,8 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) { // Add configured buttons or all available. $settings['buttonList'] = array(); - if (!empty($config['buttons'])) { - $buttons = array(); - foreach ($config['buttons'] as $plugin) { - $buttons = array_merge($buttons, $plugin); - } - $settings['buttonList'] = array_keys($buttons); + if (!empty($config['toolbar'])) { + $settings['buttonList'] = $config['toolbar']; } // Add editor content stylesheet. @@ -110,6 +106,7 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) { function wysiwyg_nicedit_plugins($editor) { return array( 'default' => array( + 'title' => t('NicEdit core'), 'buttons' => array( 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), 'strikethrough' => t('Strike-through'), diff --git a/editors/openwysiwyg.inc b/editors/openwysiwyg.inc index 5aae0ed..ce40114 100644 --- a/editors/openwysiwyg.inc +++ b/editors/openwysiwyg.inc @@ -20,6 +20,8 @@ function wysiwyg_openwysiwyg_editor() { 'files' => array('wysiwyg.js'), ), ), + 'toolbar rows' => TRUE, + 'toolbar separator' => 'seperator', 'version callback' => 'wysiwyg_openwysiwyg_version', 'themes callback' => 'wysiwyg_openwysiwyg_themes', 'settings form callback' => 'wysiwyg_openwysiwyg_settings_form', @@ -133,21 +135,13 @@ function wysiwyg_openwysiwyg_settings($editor, $config, $theme) { } $settings['Toolbar'] = array(); - if (!empty($config['buttons'])) { - $plugins = wysiwyg_get_plugins($editor['name']); - foreach ($config['buttons'] as $plugin => $buttons) { - foreach ($buttons as $button => $enabled) { - foreach (array('buttons', 'extensions') as $type) { - // Skip unavailable plugins. - if (!isset($plugins[$plugin][$type][$button])) { - continue; - } - // Add buttons. - if ($type == 'buttons') { - $settings['Toolbar'][0][] = $button; - } - } + if (!empty($config['toolbar'])) { + foreach ($config['toolbar'] as $row) { + $toolbar_row = array(); + foreach ($row as $button) { + $toolbar_row[] = $button; } + $settings['Toolbar'][] = $toolbar_row; } } @@ -160,6 +154,7 @@ function wysiwyg_openwysiwyg_settings($editor, $config, $theme) { function wysiwyg_openwysiwyg_plugins($editor) { $plugins = array( 'default' => array( + 'title' => t('openWYSIWYG core'), 'buttons' => array( 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), 'strikethrough' => t('Strike-through'), diff --git a/editors/tinymce.inc b/editors/tinymce.inc index 3316aa2..39e7399 100644 --- a/editors/tinymce.inc +++ b/editors/tinymce.inc @@ -26,6 +26,8 @@ function wysiwyg_tinymce_editor() { 'files' => array('tiny_mce_src.js'), ), ), + 'toolbar rows' => TRUE, + 'toolbar separator' => '|', 'version callback' => 'wysiwyg_tinymce_version', 'themes callback' => 'wysiwyg_tinymce_themes', 'settings form callback' => 'wysiwyg_tinymce_settings_form', @@ -35,7 +37,8 @@ function wysiwyg_tinymce_editor() { 'plugin settings callback' => 'wysiwyg_tinymce_plugin_settings', 'proxy plugin' => array( 'drupal' => array( - 'load' => TRUE, + 'title' => t('Drupal proxy plugin'), + 'load' => FALSE, 'proxy' => TRUE, ), ), @@ -373,69 +376,49 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { } } - // Find the enabled buttons and the button row they belong on. - // Also map the plugin metadata for each button. - // @todo What follows is a pain; needs a rewrite. - // $settings['buttons'] are stacked into $settings['theme_advanced_buttons1'] - // later. - $settings['buttons'] = array(); - if (!empty($config['buttons']) && is_array($config['buttons'])) { - // Only array keys in $settings['extensions'] matter; added to - // $settings['plugins'] later. - $settings['extensions'] = array(); - // $settings['extended_valid_elements'] are just stacked, unique'd later, - // and transformed into a comma-separated string in - // wysiwyg_add_editor_settings(). - // @todo Needs a complete plugin API redesign using arrays for - // tag => attributes definitions and array_merge_recursive(). - $settings['extended_valid_elements'] = array(); - - $plugins = wysiwyg_get_plugins($editor['name']); - foreach ($config['buttons'] as $plugin => $buttons) { - foreach ($buttons as $button => $enabled) { - // Iterate separately over buttons and extensions properties. - foreach (array('buttons', 'extensions') as $type) { - // Skip unavailable plugins. - if (!isset($plugins[$plugin][$type][$button])) { - continue; - } - // Add buttons. - if ($type == 'buttons') { - $settings['buttons'][] = $button; - } - // Add external Drupal plugins to the list of extensions. - if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { - $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $button)] = 1; - } - // Add external plugins to the list of extensions. - elseif ($type == 'buttons' && empty($plugins[$plugin]['internal'])) { - $settings['extensions'][_wysiwyg_tinymce_plugin_name('add', $plugin)] = 1; - } - // Add internal buttons that also need to be loaded as extension. - elseif ($type == 'buttons' && !empty($plugins[$plugin]['load'])) { - $settings['extensions'][$plugin] = 1; - } - // Add plain extensions. - elseif ($type == 'extensions' && !empty($plugins[$plugin]['load'])) { - $settings['extensions'][$plugin] = 1; - } - // Allow plugins to add valid HTML elements. - if (!empty($plugins[$plugin]['extended_valid_elements'])) { - $settings['extended_valid_elements'] = array_merge($settings['extended_valid_elements'], $plugins[$plugin]['extended_valid_elements']); - } - // Allow plugins to add or override global configuration settings. - if (!empty($plugins[$plugin]['options'])) { - $settings = array_merge($settings, $plugins[$plugin]['options']); - } - } + $toolbar = array(); + $extensions = array(); + $settings['extended_valid_elements'] = array(); + + $plugins = wysiwyg_get_plugins($editor['name']); + foreach ($config['plugins'] as $plugin => $enabled) { + if (!$enabled || !isset($plugins[$plugin])) { + continue; + } + // Add plain extensions. + if (!empty($plugins[$plugin]['load'])) { + if (!empty($plugins[$plugin]['internal'])) { + $extensions[$plugin] = 1; } + else { + $extensions[_wysiwyg_tinymce_plugin_name('add', $plugin)] = 1; + } + } + // Allow plugins to add valid HTML elements. + if (!empty($plugins[$plugin]['extended_valid_elements'])) { + $settings['extended_valid_elements'] = array_merge($settings['extended_valid_elements'], $plugins[$plugin]['extended_valid_elements']); } - // Clean-up. - $settings['extended_valid_elements'] = array_unique($settings['extended_valid_elements']); - if ($settings['extensions']) { - $settings['plugins'] = array_keys($settings['extensions']); + // Allow plugins to add or override global configuration settings. + if (!empty($plugins[$plugin]['options'])) { + $settings = array_merge($settings, $plugins[$plugin]['options']); } - unset($settings['extensions']); + } + + foreach ($config['toolbar'] as $config_row) { + $row = array(); + foreach ($config_row as $button) { + // Cross-editor plugin buttons are prefixed by the proxy plugin name. + if (strpos($button, '.') !== FALSE) { + list($plugin, $button) = explode('.', $button); + $extensions['-' . $button ] = 1; + } + $row[] = $button; + } + $toolbar[] = $row; + } + $settings['extended_valid_elements'] = array_unique($settings['extended_valid_elements']); + if ($extensions) { + $settings['plugins'] = array_keys($extensions); } // Add theme-specific settings. @@ -449,25 +432,29 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { 'theme_advanced_toolbar_location' => isset($config['theme_advanced_toolbar_location']) ? $config['theme_advanced_toolbar_location'] : 'top', 'theme_advanced_toolbar_align' => isset($config['theme_advanced_toolbar_align']) ? $config['theme_advanced_toolbar_align'] : 'left', ); - if (isset($settings['buttons'])) { + if (isset($config['block_formats'])) { + $settings['theme_advanced_blockformats'] = $config['block_formats']; + } + if ($toolbar) { // These rows explicitly need to be set to be empty, otherwise TinyMCE // loads its default buttons of the advanced theme for each row. $settings += array( - 'theme_advanced_buttons1' => array(), - 'theme_advanced_buttons2' => array(), - 'theme_advanced_buttons3' => array(), + 'theme_advanced_buttons1' => '', + 'theme_advanced_buttons2' => '', + 'theme_advanced_buttons3' => '', ); - // @todo Allow to sort/arrange editor buttons. - for ($i = 0; $i < count($settings['buttons']); $i++) { - $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; + for ($i = 0; $i < count($toolbar); $i++) { + $settings['theme_advanced_buttons' . ($i + 1)] = $toolbar[$i]; } } break; } - unset($settings['buttons']); // Convert the config values into the form expected by TinyMCE. - $csv_settings = array('plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); + $csv_settings = array('plugins', 'extended_valid_elements'); + for ($i = 0; $i < count($toolbar); $i++) { + $csv_settings[] = 'theme_advanced_buttons' . ($i + 1); + } foreach ($csv_settings as $key) { if (isset($settings[$key]) && is_array($settings[$key])) { $settings[$key] = implode(',', $settings[$key]); @@ -548,6 +535,7 @@ function _wysiwyg_tinymce_plugin_name($op, $name) { function wysiwyg_tinymce_plugins($editor) { $plugins = array( 'default' => array( + 'title' => t('TinyMCE core'), 'path' => $editor['library path'] . '/themes/advanced', 'buttons' => array( 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), @@ -565,7 +553,7 @@ function wysiwyg_tinymce_plugins($editor) { 'sup' => t('Superscript'), 'sub' => t('Subscript'), 'blockquote' => t('Blockquote'), 'code' => t('Source code'), 'hr' => t('Horizontal rule'), - 'cut' => t('Cut'), 'copy' => t('Copy'), 'paste' => t('Paste'), + 'cut' => t('Cut'), 'copy' => t('Copy'), 'pastetext' => t('Paste text'), 'visualaid' => t('Visual aid'), 'removeformat' => t('Remove format'), 'charmap' => t('Character map'), diff --git a/editors/whizzywig.inc b/editors/whizzywig.inc index 3c627c4..a642167 100644 --- a/editors/whizzywig.inc +++ b/editors/whizzywig.inc @@ -23,6 +23,8 @@ function wysiwyg_whizzywig_editor() { 'settings form callback' => 'wysiwyg_whizzywig_settings_form', 'settings callback' => 'wysiwyg_whizzywig_settings', 'plugin callback' => 'wysiwyg_whizzywig_plugins', + 'toolbar separator' => '|', + 'toolbar rows' => TRUE, 'versions' => array( '55' => array( 'js files' => array('whizzywig.js'), @@ -103,13 +105,13 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) { // Add configured buttons or all available. $settings['buttons'] = array(); - if (!empty($config['buttons'])) { - $buttons = array(); - foreach ($config['buttons'] as $plugin) { - $buttons = array_merge($buttons, $plugin); + $toolbar = array(); + if (!empty($config['toolbar'])) { + foreach ($config['toolbar'] as $config_row) { + $toolbar[] = implode(' ', $config_row); } - $settings['buttons'] = implode(' ', array_keys($buttons)); } + $settings['buttons'] = implode(' newline ', $toolbar); // Add editor content stylesheet. // @todo CSS settings are currently not used. @@ -134,6 +136,7 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) { function wysiwyg_whizzywig_plugins($editor) { return array( 'default' => array( + 'title' => t('Whizzywig core'), 'buttons' => array( 'formatblock' => t('HTML block format'), 'fontname' => t('Font'), 'fontsize' => t('Font size'), 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), diff --git a/editors/wymeditor.inc b/editors/wymeditor.inc index d317d26..d85f5b2 100644 --- a/editors/wymeditor.inc +++ b/editors/wymeditor.inc @@ -142,34 +142,33 @@ function wysiwyg_wymeditor_settings($editor, $config, $theme) { // Add configured buttons. $settings['toolsItems'] = array(); - if (!empty($config['buttons'])) { + if (!empty($config['toolbar'])) { $buttoninfo = _wysiwyg_wymeditor_button_info(); $plugins = wysiwyg_get_plugins($editor['name']); - foreach ($config['buttons'] as $plugin => $buttons) { - foreach ($buttons as $button => $enabled) { - // Iterate separately over buttons and extensions properties. - foreach (array('buttons', 'extensions') as $type) { - // Skip unavailable plugins. - if (!isset($plugins[$plugin][$type][$button])) { - continue; - } - // Add buttons. - if ($type == 'buttons') { - // Merge meta-data for internal default buttons. - if (isset($buttoninfo[$button])) { - $buttoninfo[$button] += array('name' => $button); - $settings['toolsItems'][] = $buttoninfo[$button]; - } - // For custom buttons, try to provide a valid button definition. - else { - $settings['toolsItems'][] = array( - 'name' => $button, - 'title' => $plugins[$plugin][$type][$button], - 'css' => 'wym_tools_' . $button, - ); - } - } - } + // Allow looking up which button is provided by which plugin. + $plugin_lookup = array(); + foreach ($plugins as $plugin => $meta) { + if (empty($meta['buttons'])) { + continue; + } + foreach ($meta['buttons'] as $button_name => $button) { + $plugin_lookup[$button_name] = $plugin; + } + } + foreach ($config['toolbar'] as $button) { + // Merge meta-data for internal default buttons. + if (isset($buttoninfo[$button])) { + $buttoninfo[$button] += array('name' => $button); + $settings['toolsItems'][] = $buttoninfo[$button]; + } + // For custom buttons, try to provide a valid button definition. + else { + $plugin = $plugin_lookup[$button]; + $settings['toolsItems'][] = array( + 'name' => $button, + 'title' => $plugins[$plugin]['buttons'][$button], + 'css' => 'wym_tools_' . $button, + ); } } } diff --git a/editors/yui.inc b/editors/yui.inc index db952b6..9662f7f 100644 --- a/editors/yui.inc +++ b/editors/yui.inc @@ -49,11 +49,14 @@ function wysiwyg_yui_editor() { 'plugin settings callback' => 'wysiwyg_yui_plugin_settings', 'proxy plugin' => array( 'drupal' => array( + 'title' => t('Drupal proxy plugin'), 'load' => TRUE, 'proxy' => TRUE, ), ), 'proxy plugin settings callback' => 'wysiwyg_yui_proxy_plugin_settings', + 'toolbar groups' => TRUE, + 'toolbar separator' => TRUE, 'versions' => array( '2.7.0' => array( 'js files' => array('yui.js'), @@ -189,10 +192,21 @@ function wysiwyg_yui_settings($editor, $config, $theme) { 'buttons' => array(), ), ); - if (!empty($config['buttons'])) { + $plugins = wysiwyg_get_plugins($editor['name']); + foreach ($config['plugins'] as $plugin => $enabled) { + if (!$enabled || !isset($plugins[$plugin])) { + continue; + } + // Allow plugins to add or override global configuration settings. + if (!empty($plugins[$plugin]['options'])) { + $settings = array_merge($settings, $plugins[$plugin]['options']); + } + } + if (!empty($config['toolbar'])) { $buttons = array(); - foreach ($config['buttons'] as $plugin => $enabled_buttons) { - foreach ($enabled_buttons as $button => $enabled) { + foreach ($config['toolbar'] as $group_index => $group_config) { + $group = array('group' => 'group' . $group_index, 'label' => '', 'buttons' => array()); + foreach ($group_config as $button) { $extra = array(); if ($button == 'heading') { $extra = array('menu' => array( @@ -228,12 +242,11 @@ function wysiwyg_yui_settings($editor, $config, $theme) { array('text' => 'Verdana'), )); } - $buttons[] = wysiwyg_yui_button_setting($editor, $plugin, $button, $extra); + $group['buttons'][] = wysiwyg_yui_button_setting($editor, $button, $extra); } + $buttons[] = $group; } - // Group buttons in a dummy group. - $buttons = array('group' => 'default', 'label' => '', 'buttons' => $buttons); - $settings['toolbar']['buttons'] = array($buttons); + $settings['toolbar']['buttons'] = $buttons; } if (isset($config['css_setting'])) { @@ -259,25 +272,41 @@ function wysiwyg_yui_settings($editor, $config, $theme) { * * @param $editor * A processed hook_editor() array of editor properties. - * @param $plugin - * The internal name of a plugin. * @param $button - * The internal name of a button, defined by $plugin. + * The internal name of a button, defined by a plugin. * @param $extra * (optional) An array containing arbitrary other elements to add to the * resulting button. */ -function wysiwyg_yui_button_setting($editor, $plugin, $button, $extra = array()) { +function wysiwyg_yui_button_setting($editor, $button, $extra = array()) { static $plugins; + static $plugin_lookup; if (!isset($plugins)) { $plugins = wysiwyg_get_plugins($editor['name']); + // Allow looking up which button is provided by which plugin. + $plugin_lookup = array(); + foreach ($plugins as $plugin => $meta) { + if (empty($meta['buttons'])) { + continue; + } + foreach ($meta['buttons'] as $button_name => $button_info) { + $plugin_lookup[$button_name] = $plugin; + } + } } // Return a simple separator. if ($button === 'separator') { return array('type' => 'separator'); } + // Cross-editor plugin buttons are prefixed by the proxy plugin name. + if (strpos($button, '.') !== FALSE) { + list($plugin, $button) = explode('.', $button); + } + else { + $plugin = $plugin_lookup[$button]; + } // Setup defaults. $type = 'push'; $label = $plugins[$plugin]['buttons'][$button]; @@ -347,6 +376,7 @@ function wysiwyg_yui_proxy_plugin_settings($editor, $profile, $plugins) { function wysiwyg_yui_plugins($editor) { return array( 'default' => array( + 'title' => t('YUI Editor core'), 'buttons' => array( 'bold' => t('Bold'), 'italic' => t('Italic'), 'underline' => t('Underline'), 'strikethrough' => t('Strike-through'), diff --git a/images/add.png b/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..6332fefea4be19eeadf211b0b202b272e8564898 GIT binary patch literal 733 zcmV<30wVp1P)9VHk(~TedF+gQSL8D5xnVSSWAVY>J9b+m>@{iq7_KE}go~11+5s4;8hc+i0Xa zI1j@EX5!S+Me6HNqKzU5YQwL;-W5$p%ZMKMeR<%zp69-~?<4?8|C8S?bklXr4v&Ov zb&06v2|-x?qB`90yn>Qi%Sh2^G4n)$ZdyvTPf9}1)_buUT7>`e2G&2VU@~Bb(o+Mz zi4)>IxlSY${Dj4k={-9RzU^W5g9|2V5RZ2ZulL9s2xQbZ@r6eP9Ra5u(s|C0Nj#&4>wTSkb?%#=9?@ z^oxDy-O@tyN{L@by(WWvQ3%CyEu8x{+#Jb4-h&K9Owi)2pgg+heWDyked|3R$$kL@A z#sp1v-r+=G4B8D6DqsDH0@7OztA7aT9qc1Py{()w`m``?Y0&gi2=ROcc-9+nU^I6< zT=e_Y=vSnG@?3Ue{BW5ONFttcE!R-R_W4O01|0-|K-YNXLo2`4Qv z`r1LxR6#yf3FB%T95gJnaKKivA~Z}S9A(ZxEDK}O3T04USJ P00000NkvXXu0mjf^IS-S literal 0 HcmV?d00001 diff --git a/images/draggable.png b/images/draggable.png new file mode 100644 index 0000000000000000000000000000000000000000..47e8a02cf432be62bde8984f14cb2d243b6db160 GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^{6MV1!VDxY2k!k2q?n7HJVQ7*IBq}me*omF2l#}z z0_j7C4z;$n78Mmeefsp?y?Y-%eCY1(77!4aJbCh$FJG#wt7p!f`DZ0l15hb%NswRg ze>haqa)?ajT1!zmWXI<5{%?^x~^5ItZ6d&VOb+1E03;5 za;5N;g$EY0ChDZNc4Vx5#Po=j=X7LHWbljz9#%Gi3sDC)aHuhbH(%K5)ySB2PD!m~ dw??5cgB0^N9f>5BNkHc?c)I$ztaD0e0sz|Kfb{?X literal 0 HcmV?d00001 diff --git a/images/remove.png b/images/remove.png new file mode 100644 index 0000000000000000000000000000000000000000..1514d51a3cf1b67e1c5b9ada36f1fd474e2d214a GIT binary patch literal 655 zcmV;A0&x9_P)uEoyT++I zn$b9r%cFfhHe2K68PkBu*@^<$y+7xQ$wJ~;c5aBx$R=xq*41Wo zhwQus_VOgm0hughj}MhOvs#{>Vg09Y8WxjWUJY5YW zJ?&8eG!59Cz=|E%Ns@013KLWOLV)CObIIj_5{>{#k%TEAMs_GbdDV`x-iYsGH z#=Z{USAQA>NY(}X7=3{K8#