How do I add new toolbar buttons to FCKEditor?
I have to replace the standard Horizontal Rule button with two buttons, relating to two different styles of Horizontal Rule.
FWIW, this is for a Drupal installation of FCKEditor.
TIA
Pete.
I have to replace the standard Horizontal Rule button with two buttons, relating to two different styles of Horizontal Rule.
FWIW, this is for a Drupal installation of FCKEditor.
TIA
Pete.

Re: Create new toolbar buttons
take the existing code:
ckeditor/_source/plugins/horizontalrule/plugin.js
copy the plugin and name it something snazzy like
ckeditor/_source/plugins/horizontalrule2/plugin.js
change the var pluginName = 'horizontalrule2';
and var horizontalruleCmd to var horizontalrule2Cmd (just so you know what you are doing and change it's functionality
upload it to /ckeditor/plugins/horizontalrule2/plugin.js
and then you need to tweak the config options to load it up
I do this in by CKEDITOR.Replace
and you need to add HorizontalRule2 to your toolbar.
<script> CKEDITOR.config.toolbar_MA=[ ['Source','-','Cut','Copy','Paste','-','Undo','Redo','RemoveFormat','-','Link','Unlink','Anchor','-','Image','Table','HorizontalRule','HorizontalRule2','SpecialChar'], '/', ['Format','Templates','Bold','Italic','Underline','-','Superscript','-',['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],'-','NumberedList','BulletedList','-','Outdent','Indent'] ]; CKEDITOR.replace( '".$id."', { toolbar:'MA', extraPlugins: 'horizontalrule2' }); </script>as below:
(function() { var horizontalrule2Cmd = { exec : function( editor ) { editor.insertElement( editor.document.createElement( 'hr' ) ); } }; var pluginName = 'horizontalrule2'; // Register a plugin named "horizontalrule2". CKEDITOR.plugins.add( pluginName, { init : function( editor ) { editor.addCommand( pluginName, horizontalrule2Cmd ); editor.ui.addButton( 'HorizontalRule2', { label : editor.lang.horizontalrule, command : pluginName }); } }); })();