--- ckeditor.inc Fri Jan 14 16:43:04 2011 +++ ckeditor_new.inc Tue Feb 08 15:16:41 2011 @@ -195,7 +195,23 @@ function wysiwyg_ckeditor_settings($edit $settings['toolbar'] = array(); if (!empty($config['buttons'])) { $extra_plugins = array(); + $toolbar_groups = array( + 'Source' => -1, + 'Save' => 0, 'NewPage' => 0, 'Preview' => 0, 'Templates' => 0, + 'Cut' => 1, 'Copy' => 1, 'Paste' => 1, 'PasteText' => 1, 'PasteFromWord' => 1, 'Print' => 1, 'SpellChecker' => 1, 'Scayt' => 1, + 'Undo' => 2, 'Redo' => 2, 'Find' => 2, 'Replace' => 2, 'SelectAll' => 2, 'RemoveFormat' => 2, + 'Form' => 3, 'Checkbox' => 3, 'Radio' => 3, 'TextField' => 3, 'Textarea' => 3, 'Select' => 3, 'Button' => 3, 'ImageButton' => 3, 'HiddenField' => 3, + 'Bold' => 4, 'Italic' => 4, 'Underline' => 4, 'Strike' => 4, 'Subscript' => 4, 'Superscript' => 4, + 'NumberedList' => 5, 'BulletedList' => 5, 'Outdent' => 5, 'Indent' => 5, 'Blockquote' => 5, 'CreateDiv' => 5, + 'JustifyLeft' => 6, 'JustifyCenter' => 6, 'JustifyRight' => 6, 'JustifyBlock' => 6, + 'Link' => 7, 'Unlink' => 7, 'Anchor' => 7, + 'Image' => 8, 'Flash' => 8, 'Table' => 8, 'HorizontalRule' => 8, 'Smiley' => 8, 'SpecialChar' => 8, 'PageBreak' => 8, + 'Styles' => 9, 'Format' => 9, 'Font' => 9, 'FontSize' => 9, + 'TextColor' => 10, 'BGColor' => 10, + 'Maximize' => 11, 'ShowBlocks' => 11, 'About' => 11 + ); $plugins = wysiwyg_get_plugins($editor['name']); + $group = 0; foreach ($config['buttons'] as $plugin => $buttons) { foreach ($buttons as $button => $enabled) { // Iterate separately over buttons and extensions properties. @@ -206,7 +222,13 @@ function wysiwyg_ckeditor_settings($edit } // Add buttons. if ($type == 'buttons') { - $settings['toolbar'][] = $button; + if (isset($toolbar_groups[$button])) { + if (isset($last_group) && $last_group != $toolbar_groups[$button]) { + $group++; + } + $last_group = $toolbar_groups[$button]; + } + $settings['toolbar'][$group][] = $button; } // Add external Drupal plugins to the list of extensions. if ($type == 'buttons' && !empty($plugins[$plugin]['proxy'])) { @@ -235,9 +257,6 @@ function wysiwyg_ckeditor_settings($edit $settings['extraPlugins'] = implode(',', $extra_plugins); } } - // For now, all buttons are placed into one row. - $settings['toolbar'] = array($settings['toolbar']); - return $settings; }