Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding TinyMCE's Default Formatting

Tags:

tinymce

How can I override TinyMCE's default formatting for basic stuff like bold, underline, and strikethrough? Currently the generated HTML uses styled spans, which is normally fine. Unfortunately, in this situation I need to do some simple parsing and need the elements to be the old-style <b>, <u>, and <strike>.

The following code is what I currently have that doesn't work. Applying these styles to content continues to wrap the content in styled spans.

$('<textarea></textarea>').tinymce(
{
    theme_advanced_buttons1: "bold,italic,underline,strikethrough",
    theme_advanced_buttons2: "",
    theme_advanced_buttons3: "",
    formats:
    {
        bold: { inline : 'b' },
        underline : { inline : 'u' },
        strikethrough : { inline : 'strike' }
    },
    // ...
});
like image 869
MikeWyatt Avatar asked Sep 08 '10 19:09

MikeWyatt


1 Answers

I found the answer on the TinyMCE forum:

$('<textarea></textarea>').tinymce(
{
    plugins : 'legacyoutput', // this overrides the formats automatically
    // ...
} );
like image 126
MikeWyatt Avatar answered Nov 10 '22 13:11

MikeWyatt