Some hints creating own plugins to CKEditor
Not a full guide but some helpful hints to get in the right direction.
Read this:
I've just checked the wysiwyg-geshi module, the integration with CKEditor module is not hard (but could be easier):
In ckeditor.config.js add something like:
config.extraPlugins += (config.extraPlugins ? ',geshi' : 'geshi' );<br />
CKEDITOR.plugins.addExternal('geshi', Drupal.settings.basePath + 'sites/all/modules/wysiwyg-geshi/ckeditor/');and add selected buttons (Geshi-code, Geshi-php, ...) to selected toolbars.
For example, in Filtered and Full toolbars, there is a set of buttons:
['DrupalBreak', 'DrupalPageBreak']You can add them at the end of the toolbar:
['DrupalBreak', 'DrupalPageBreak','Geshi-code','Geshi-php']Regarding the CKEditor plugin - I saw that there are no icons. To add an icon to a button, specify the "icon" attribute, for example:
editor.ui.addButton( buttonName,<br />
{<br />
label : buttonLabel,<br />
icon : plugin.path + 'images/' + buttonLabel + '.gif',<br />
command : commandName<br />
});where the "plugin" variable is defined at the beginning of the init function with:
...<br />
init : function( editor )<br />
{<br />
var plugin = this;<br />
// All buttons use the same code to register. So, to avoid<br />
...http://drupal.org/node/735632#comment-2705538
For your purpose, I would recommend look at one of the plugins in the _source/plugins directory, for example the "print" button. Adding a simple Javascript function is quite easy to achieve. You should be able to duplicate the print plugin (take the directory from _source into the actual plugins/ directory, worry about minification later), rename it, rename every mention of "print" within it, give the button a proper name you use later in your toolbar setup to include the button, and add your function. http://stackoverflow.com/questions/1957156/ckeditor-how-to-add-a-custom-button-to-the-toolbar-that-calls-a-javascript-funct
Wordcount:
http://cksource.com/forums/viewtopic.php?f=11&t=18032
