If you have the flexibility of an interface, you can simply add your styles to the Styles selector.
This will be less work than creating your own plugin. Especially if you are using CKEditor 3.6 or later, where you can use the new Parser Plugin for styles .
You can use the plugin from the answer where you asked me to consider this issue .
It is based on the plugin "basicstyles". If you look at the comments that I have included, you will see that you can use it to add multiple buttons and multiple styles.
You will have several calls to the addButtonCommand method.
addButtonCommand( 'Fg_red' , 'Label' , 'fg_red' , config.coreStyles_fg_red ); addButtonCommand( 'Bg_blue' , 'Label' , 'bg_blue' , config.coreStyles_bg_blue );
The last line of code after the plugin code is what you add to your configuration. You can use any attributes you like:
CKEDITOR.config.coreStyles_fg_red = { element : 'span', attributes : { 'class': 'fg red' } }; CKEDITOR.config.coreStyles_bg_blue = { element : 'span', attributes : { 'class': 'bg blue' } };
You can also create a plugin based on the colorbutton plugin. It creates a dialog box of native front and rear colors.
source share