wpEditorInit = function() {
// Activate tinyMCE if it's the user's default editor
if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
document.getElementById('editorcontainer').style.padding = '0px';
tinyMCE.execCommand("mceAddControl", true, "content");
} else {
var H;
if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
document.getElementById('content').style.height = H.ch - 30 + 'px';
}
};
switchEditors = {
saveCallback : function(el, content, body) {
document.getElementById(el).style.color = '#fff';
if ( tinyMCE.activeEditor.isHidden() )
content = document.getElementById(el).value;
else
content = this.pre_wpautop(content);
return content;
},
pre_wpautop : function(content) {
// We have a TON of cleanup to do.
// content = content.replace(/\n|\r/g, ' ');
// Remove anonymous, empty paragraphs.
content = content.replace(new RegExp('
(\\s| |
)*
', 'mg'), '');
// Mark if it has any attributes.
content = content.replace(new RegExp('(]+>.*?)
', 'mg'), '$1');
// Get it ready for wpautop.
content = content.replace(new RegExp('\\s*', 'mgi'), '');
content = content.replace(new RegExp('\\s*
\\s*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*
\\s*', 'gi'), '\n');
// Fix some block element newline issues
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*('+blocklist+')>\\s*', 'mg'), '$1>\n');
content = content.replace(new RegExp('', 'g'), '\t');
if ( content.indexOf('