customizing the format flyout box

Discuss and participate of this important initiative project.

customizing the format flyout box

Postby cowtipper » Thu Aug 27, 2009 5:54 am

I've been having a lot of trouble trying to customize out the format combobox.

with the CKEDITOR.replace function, i'm trying to add/edit the default format tags:

Code: Select all
CKEDITOR.replace( someElement,
{
format_tags : 'tag1,tag2,tag3',
format_tag1 : { element:'p', attributes : {class:'tag1 label'}},
format_tag2 : { element:'p', attributes : {class:'tag2 label'}},
format_tag3 : { element:'p', attributes : {class:'tag3 label'}}
});


this works in Firefox, but I get a parse error in safari and it doesn't work in internet explorer (most versions)

any ideas? am i doing this right?
cowtipper
 
Posts: 5
Joined: Wed Aug 26, 2009 6:38 pm

Re: customizing the format flyout box

Postby cowtipper » Thu Aug 27, 2009 6:13 am

ok, i solved my problem after hours of bashing my head and judicial use of lint. :evil: :evil: :evil:

the example given in the _source:

Code: Select all
config.format_h5 = { element : 'h5', attributes : { class : 'contentTitle5' } };


is wrong. It may work in firefox, but it won't work in ie and safari and opera. The code should be:

Code: Select all
config.format_h5 = { element : 'h5', attributes : { 'class' : 'contentTitle5' } };


see the change? notice the single quotes around "class"

so that makes the final code:

Code: Select all
CKEDITOR.replace( someElement,
{
format_tags : 'tag1,tag2,tag3',
format_tag1 : { element:'p', attributes : {'class':'tag1 label'}},
format_tag2 : { element:'p', attributes : {'class':'tag2 label'}},
format_tag3 : { element:'p', attributes : {'class':'tag3 label'}}
});


and it should work. you also have to do one more thing: add tag1, tag2, and tag3 to the language files.

and you should be good to go.
cowtipper
 
Posts: 5
Joined: Wed Aug 26, 2009 6:38 pm


Return to CKEditor 3.x

Who is online

Users browsing this forum: No registered users and 7 guests