1

Topic: Adding custom formats to the format-dropdown.

Hi!

I would like some help adding a custom format or style to the format-dropdown-menu.

I would like to add one called XL.


Ive tried  theme_advanced_blockformats, but that doesnt work.


Any ideas?


Best regards Fredrol

2

Re: Adding custom formats to the format-dropdown.

fidde88pven wrote:

Ive tried  theme_advanced_blockformats, but that doesnt work.

You're looking for content_css.

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

3

Re: Adding custom formats to the format-dropdown.

But doesnt that add all styles from that css?


Tanks // Fredrik

4

Re: Adding custom formats to the format-dropdown.

What keeps you from having a special one which only has the XL class name?

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

5

Re: Adding custom formats to the format-dropdown.

Well... Is there a way of getting the site css to tinymce aswell then? Because I mean, we must have the same size and styles as the rest of the site inside tinymce-editor...

Thanks // Fredrik

6

Re: Adding custom formats to the format-dropdown.

You contradict yourself. What is it exactly that you want?

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

7

Re: Adding custom formats to the format-dropdown.

Hi again.

Its like this.

I want to have one more option in Format-menu, with the name XL.
As a class.

Is this possible?

Last edited by fidde88pven (2009-07-30 12:04:10)

8

Re: Adding custom formats to the format-dropdown.

fidde88pven wrote:

I want to have one more option in Format-menu, with the name XL.
As a class.

Is this possible?

Yes. Use content_css as I've written before.

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

9

Re: Adding custom formats to the format-dropdown.

It doesnt show up in my Format-menu.

I added a class in the mce.css (linked to in content_css), but it did not show up.

Ive read the wiki, but dont really get an answer.

Know why it did not show up?

//Fidde

10

Re: Adding custom formats to the format-dropdown.

http://wiki.moxiecode.com/index.php/Tin … ockformats

11

Re: Adding custom formats to the format-dropdown.

Hi,
first this is possible, second your question is very precise! wink

You have to add a custom format to tinyMCE.init() like:

formats : {
      mynewformat : {inline : 'span', classes : 'mynewcssclass'},
}

then you have to add this format to theme_advanced_blockformats like:

theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6,mynewformat"

then you have to alter the advanced theme (it would be better to create your own...anyway)
to do this copy the file tiny_mce/themes/advanced/editor_template_src.js to editor_template.js (override existing one - maybe backup the old before)
then add your format to formats listed after "_createBlockFormats : function() {" in the editor_template.js like:

var c, fmts = {
    p : 'advanced.paragraph',
    address : 'advanced.address',
    pre : 'advanced.pre',
    h1 : 'advanced.h1',
    h2 : 'advanced.h2',
    h3 : 'advanced.h3',
    h4 : 'advanced.h4',
    h5 : 'advanced.h5',
    h6 : 'advanced.h6',
    div : 'advanced.div',
    blockquote : 'advanced.blockquote',
    code : 'advanced.code',
    dt : 'advanced.dt',
    dd : 'advanced.dd',
    samp : 'advanced.samp',
    mynewformat : 'advanced.mynewformat',
}

after that add something like:
mynewformat: "My New Format Localization String",
to tiny_mce/themes/langs/en.js (or other lang file in same dir)

Finally your new format works!

If you want it to be displayed in a special way in the format list then add
a css rule to the tiny_mce/themes/advanced/skin/default/ui.css file
the rule should look like:
.defaultSkin .mce_mynewformat span.mceText {font-weight:bolder; font-size: .75em}
add it after:
.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}


Now you have a perfect new custom format in the advanced theme.
If you do the little extra work to make a new theme this isnĀ“t even a hack.

Lenz

Last edited by lenzo (2010-09-05 01:24:29)