views:

189

answers:

2

I'm using ckeditor version 3 as a text editor to create markup to be sent through email. This means that I have to have all the styles inline and anything that needs to be styled will definitely need the style applied.

I'm currently using addStylesSet to generate custom styles that can be applied to elements. The problem I have is that although this works on most elements, styles don't seem to be applied to <a> <ol> <ul> and <li>

I really need to be able to apply inline styles to these elements as well. I've been looking at the examples on the ckeditor site, but even they just seem to be wrapping a <span> around the link.

Is there anyway I can apply inline styles to <a> tags or failing that, can I just give ckeditor a bunch of classes that can be applied to any tag (Like TinyMCE does with it's link to an external css file)? so that I can at least do a textreplace on them to get the styles inline?

I haven't pasted any code here because it's exactly the same as what's been done on the ckeditor site.

A: 

In case anybody having the same problem sees my question, this is how I managed to get around it.

CKEDITOR.addStylesSet( 'my_styles',
[
    { name : 'Red', element : 'a', attributes : { 'style' : 'color:#f00;text-decoration:none;' } }
]);

CKEDITOR.config.stylesCombo_stylesSet = 'my_styles';

Simply use attributes instead of style to define your style declarations, and then point it toward the style combo box.

I guess it's obvious when you think about it :)

jomanlk