How to Get TinyMCE to Format HTML Source Correctly in TinyMCE 2.0.6.1

From MODx Wiki

Jump to: navigation, search

Note: This has been fixed in the latest SVN trunk of MODx 0.9.5. All users using prior versions will need this update.

Note 2: This only works in TinyMCE versions 2.0.6.1 and newer.

Contents

Fixing Source Formatting

To prevent TinyMCE from stripping your newlines and uglyifying your HTML, in:

/assets/plugins/tinymce/jscripts/tiny_mce/tiny_mce.js


Turn On Apply Source Formatting

this._def("apply_source_formatting", false);
TO
this._def("apply_source_formatting", true);


Turn Off Removing Linebreaks

this._def("remove_linebreaks", true);
TO
this._def("remove_linebreaks", false);


You're Done!

And viola, nicely readable source.

Alternatively you can simply override these parameters, when initiating tinyMCE:

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    apply_source_formatting : true,
    remove_linebreaks: false
});

Personal tools