I have an issue I'm trying to better understand in order to force mce to true in the script check below.
Background: I'm applying a rich text editor to the category description textarea to allow users to apply rich text formatting to the category descriptions.
The problem I'm having is when the user happens to leave the post or page editor on the "HTML" tab. In this case, WordPress apparently is setting a global flag that results in the mce variable in the script below to initialize as false.
This has the effect of disabling my rich text editor on the category description field.
How can I overcome this?
<script type="text/javascript">
(function(){
var init, ed, qt, first_init, mce = false;
//mce needs to be true!!!
if ( typeof(tinymce) == 'object' ) {
// mark wp_theme/ui.css as loaded
tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
for ( ed in tinyMCEPreInit.mceInit ) {
if ( first_init ) {
init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] );
} else {
init = first_init = tinyMCEPreInit.mceInit[ed];
}
if ( mce )
try { tinymce.init(init); } catch(e){}
}
}
if ( typeof(QTags) == 'function' ) {
for ( qt in tinyMCEPreInit.qtInit ) {
try { quicktags( tinyMCEPreInit.qtInit[qt] ); } catch(e){}
}
}
})();