tony noriega
tony noriega

Reputation: 7673

TinyMCE Version 3.12 Converting <font> to <span>

Ok...

We just upgraded our CMS that has a TinyMCE version 3.12 installed.

We migrated all of our existing data over.

The previous platform used an Ektron visual editor which was quite old.

In the HTML of a majority of our pages we have code snippets that look like:

<p><font size='1'>Font Size 1</font></p>
<p><font size='2'>Font Size 2</font></p>
<p><font size='3'>Font Size 3</font></p>
<p><font size='4'>Font Size 4</font></p>
<p><font size='5'>Font Size 5</font></p>
<p><font size='6'>Font Size 6</font></p>
<p><font size='7'>Font Size 7</font></p>

The version of TinyMCE is properly converting this code to:

<p><span style="font-size: xx-small;">Font Size 1</span></p>
<p><span style="font-size: x-small;">Font Size 2</span></p>
<p><span style="font-size: small;">Font Size 3</span></p>
<p><span style="font-size: medium;">Font Size 4</span></p>
<p><span style="font-size: large;">Font Size 5</span></p>
<p><span style="font-size: x-large;">Font Size 6</span></p>
<p><span style="font-size: xx-large;">Font Size 7</span></p>

Which is fine...

However, in our old visual editor, my content contributors would set <font size='2'> because it was looked like it was 12pt font... so it looked normal...

TinyMCE converts <font size='2'> to x-small, looking like 10pt font.

SO..in TinyMCE is there a way to associate <font size='2'> to correlate to <span style="font-size:small"> instead of x-small font?

make sense?

Upvotes: 0

Views: 1130

Answers (2)

Gabriel
Gabriel

Reputation: 1

You can try setting: convert_fonts_to_spans : false

Upvotes: 0

Tim Fountain
Tim Fountain

Reputation: 33148

The config option font_size_style_values allows you to control what styles are used for font sizes 1-7. See http://www.tinymce.com/wiki.php/Configuration:font_size_style_values for details.

So for your use case you'll want to remove the xx-small option from the start and shift everything down one (adding an additional value at the end):

font_size_style_values: "x-small,small,medium,large,x-large,xx-large,xx-large"

I just tested this in a local copy of TinyMCE (version 3.4.9) and this seemed to work except for font size 1, which was always converted to xx-small regardless of the config. But it's possible this bug is fixed in the newly released 3.5.

Upvotes: 1

Related Questions