Index: editors/fckeditor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/fckeditor.inc,v retrieving revision 1.6.2.2 diff -u -p -r1.6.2.2 fckeditor.inc --- editors/fckeditor.inc 24 Jan 2009 23:32:14 -0000 1.6.2.2 +++ editors/fckeditor.inc 24 Jan 2009 23:33:32 -0000 @@ -76,6 +76,7 @@ function wysiwyg_fckeditor_version($edit function wysiwyg_fckeditor_settings($editor, $config, $theme) { $settings = array( 'EditorPath' => base_path() . $editor['library path'] .'/', + 'CustomConfigurationsPath' => wysiwyg_get_path('editors/js/fckeditor.config.js', TRUE), 'SkinPath' => base_path() . $editor['library path'] .'/editor/skins/default/', 'Width' => '100%', 'Height' => 420, @@ -113,6 +114,33 @@ function wysiwyg_fckeditor_settings($edi } } + $plugins = wysiwyg_get_plugins($editor['name']); + if (!empty($config['buttons'])) { + // Use our custom toolbar set (for FCKinstance). + $settings['ToolbarSet'] = 'Wysiwyg'; + // Populate our custom toolbar set for fckeditor.config.js. + $settings['buttons'] = array(); + 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; + } + } + } + } + // For now, all buttons are placed into one row. + if (!empty($settings['buttons'])) { + $settings['buttons'] = array($settings['buttons']); + } + } + return $settings; } @@ -137,6 +165,40 @@ function wysiwyg_fckeditor_themes($edito */ function wysiwyg_fckeditor_plugins($editor) { return array( + 'default' => array( + 'buttons' => array( + 'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'), + 'StrikeThrough' => t('Strike-through'), + 'JustifyLeft' => t('Align left'), 'JustifyCenter' => t('Align center'), 'JustifyRight' => t('Align right'), 'JustifyFull' => t('Justify'), + 'UnorderedList' => t('Bullet list'), 'OrderedList' => t('Numbered list'), + 'Outdent' => t('Outdent'), 'Indent' => t('Indent'), + 'Undo' => t('Undo'), 'Redo' => t('Redo'), + 'Link' => t('Link'), 'Unlink' => t('Unlink'), 'Anchor' => t('Anchor'), + 'Image' => t('Image'), + 'TextColor' => t('Forecolor'), 'BGColor' => t('Backcolor'), + 'Superscript' => t('Superscript'), 'Subscript' => t('Subscript'), + 'Blockquote' => t('Blockquote'), 'Source' => t('Source code'), + 'Rule' => t('Horizontal rule'), + 'Cut' => t('Cut'), 'Copy' => t('Copy'), 'Paste' => t('Paste'), + 'PasteText' => t('Paste Text'), 'PasteWord' => t('Paste from Word'), + 'ShowBlocks' => t('Visual aid'), + 'RemoveFormat' => t('Remove format'), + 'SpecialChar' => t('Character map'), + 'About' => t('About'), + + 'FontFormat' => t('HTML block format'), 'FontName' => t('Font'), 'FontSize' => t('Font size'), 'Style' => t('Font style'), + 'Table' => t('Table'), + 'Find' => t('Search'), 'Replace' => t('Replace'), 'SelectAll' => t('Select all'), + 'CreateDiv' => t('CreateDiv'), + 'Flash' => t('Flash'), 'Smiley' => t('Smiley'), + 'FitWindow' => t('FitWindow'), + 'SpellCheck' => t('SpellCheck'), + // Useless in Drupal. + // 'DocProps' => t('DocProps'), 'Save' => t('Save'), 'NewPage' => t('NewPage'), 'Preview' => t('Preview'), 'Templates' => t('Templates'), + // 'Form' => t('Form'), 'Checkbox' => t('Checkbox'), 'Radio' => t('Radio'), 'TextField' => t('TextField'), 'Textarea' => t('Textarea'), 'Select' => t('Select'), 'Button' => t('Button'), 'ImageButton' => t('ImageButton'), 'HiddenField' => t('HiddenField'), + ), + 'internal' => TRUE, + ), ); } Index: editors/js/fckeditor-2.6.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/fckeditor-2.6.js,v retrieving revision 1.8.2.2 diff -u -p -r1.8.2.2 fckeditor-2.6.js --- editors/js/fckeditor-2.6.js 24 Jan 2009 23:32:14 -0000 1.8.2.2 +++ editors/js/fckeditor-2.6.js 24 Jan 2009 23:32:41 -0000 @@ -5,8 +5,15 @@ */ Drupal.wysiwyg.editor.attach.fckeditor = function(context, params, settings) { var FCKinstance = new FCKeditor(params.field, settings['Width'], settings['Height']); - // Configure editor settings for this input format. + // Apply editor instance settings. FCKinstance.BasePath = settings.EditorPath; + // Apply 'Wysiwyg' toolbar, if defined. + if (settings.buttons) { + FCKinstance.ToolbarSet = settings.ToolbarSet; + } + + // Apply input format configuration. + FCKinstance.Config.format = params.format; for (var setting in settings) { FCKinstance.Config[setting] = settings[setting]; } @@ -27,9 +34,13 @@ Drupal.wysiwyg.editor.detach.fckeditor = delete FCKeditorAPI.__Instances[params.field]; } } -// else { -// tinyMCE.triggerSave(); -// tinyMCE.remove(); -// } + else { + for (instance in FCKeditorAPI.__Instances) { + $('#' + instance).val(editor.GetXHTML()).show(); + $('#' + instance + '___Config').remove(); + $('#' + instance + '___Frame').remove(); + delete FCKeditorAPI.__Instances[instance]; + } + } }; Index: editors/js/fckeditor.config.js =================================================================== RCS file: editors/js/fckeditor.config.js diff -N editors/js/fckeditor.config.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ editors/js/fckeditor.config.js 24 Jan 2009 23:08:21 -0000 @@ -0,0 +1,10 @@ +// $Id$ + +/** + * Apply custom Wysiwyg API toolbar for input format. + * + * For whatever reason, our custom 'format' property is not available in + * FCKConfig.format, but in FCKConfig.PageConfig.format instead. + */ +FCKConfig.ToolbarSets['Wysiwyg'] = window.parent.Drupal.settings.wysiwyg.configs.fckeditor[FCKConfig.PageConfig.format].buttons; +