I am writing a CKEditor plugin to apply a specific class to an element. Basically this class is setting the text colour to a specific redish colour.
Anyways, I am not getting how to define a class for the wrapped text.
Please look at my plugin code:
CKEDITOR.plugins.add( 'red',
{
init: function( editor )
{
editor.addCommand( 'red',
{
exec : function( editor )
{
var format = {
element : 'span'
};
var style = new CKEDITOR.style(format);
style.apply(editor.document);
}
});
editor.ui.addButton( 'red',
{
label: 'red',
command: 'red',
icon: this.path + 'images/red.png'
} );
}
} );
Basically I want to have an output like:
<span class="red">This is now a red text</span>
Thank you very much in advance for helping me.
The sources I have used to get this far: http://docs.cksource.com/CKEditor_3.x/Howto http://docs.cksource.com/CKEditor_3.x/Tutorials/Timestamp_Plugin http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.command.html#exec
Maybe I overread something there, but for me it does not seem that this kind of things are mentioned there ? Please proof me wrong : )