hi !
I try to create a custom style file like this one :
CKEDITOR.addStylesSet( 'custom',
[
// Block Styles
{ name : 'Blue Title', element : 'h2', styles : { 'color' : 'Blue' } },
{ name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },
{ name : 'Custom a', element : 'a', attributes : { 'class' : 'my_style' } }
]);
I can't see the 'custom a' element in my editor custom label list.
All is ok with others elements, this problem seems to be appear only with 'a' element.
Any ideas to resolve this ?
Thanks for your great job !
I try to create a custom style file like this one :
CKEDITOR.addStylesSet( 'custom',
[
// Block Styles
{ name : 'Blue Title', element : 'h2', styles : { 'color' : 'Blue' } },
{ name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },
{ name : 'Custom a', element : 'a', attributes : { 'class' : 'my_style' } }
]);
I can't see the 'custom a' element in my editor custom label list.
All is ok with others elements, this problem seems to be appear only with 'a' element.
Any ideas to resolve this ?
Thanks for your great job !
Re: problem with custom style tag
(added) I think I see the error in your syntax: you must call the new style after you create it. See the (new) last line of code in the sample I provided.
{edit}This assumes that you really have defined a class called "my_style" that you use on hyperlinks, and that "my_style" would not be overridden by an "a" tag class further along downstream in any CSS inline or CSS file attached or linked.
{edit}(added) When using this feature in the CKEditor, you must first select a hyperlink, then click on the Styles menu. If you do not select a hyperlink first, you will not see the styles bound to the 'a' tag.
{edit}(deleted some incorrect info)
You either need to define the individual attributes of the a tag right there in your code, or else if you are calling that class, you have to let the editor know where to find the class. Maybe something like:
(added last -critical- line of code in the above sample) You must call the stylesCombo_stylesSet, not just create it.
I am also wary of using any word in coding that might be a reserved word, so I would use a different word than "custom" to define this styleset. (I would also use a better description name for a class that modifies attributes of the "a" tag, like maybe "linkBigGreen" or something like that, rather than "my_style" - and I code that way whether someone else has to read my code or if it is just me.)
Dennis
p.s. I took the time to go through a number of things regarding the Styles combo items, and this may be of further help: viewtopic.php?f=11&t=16349
Re: problem with custom style tag
My previous post was not a good answer, and had bad guesses and errors. I have edited the living crap out of it, and it should be more useful now.
-Dennis
Re: problem with custom style tag
Any idea why ?
Thanks.