[wp-hackers] Initializing TinyMCE

Andrew Ozz admin at laptoptips.ca
Tue Jul 8 19:15:25 GMT 2008


Chris Poteet wrote:
> I see that the admin section set's the TinyMCE mode to "none", but I
> can't then find where it's actually initialized.  I see 	'onpageload'
> => 'wpEditorInit', but I don't understand what that means.
> 
> The question is that I have other textreas in 2.5 that I'd like to be
> turned into rich editors as well on the post-new screen (using the
> Custom Write Panel plugin), but when I change the "mode" to
> "textareas" then the main editor doesn't work correctly.
> 
> Is there a way to do this and preferably without editing the core?
> I'll give a $25 gift certificate to Amazon to whoever figures this out
> for me.*
> 
> *Hopefully I can do that on here.

All of TinyMCE's settings can be controlled with the filter 
tiny_mce_before_init. It passes through the editor's init object as a 
php array. It also sets compression and disk caching.

The 'mode' => 'none' stops TinyMCE from loading if the HTML editor is 
set as default. Later it's initialized with
tinyMCE.execCommand("mceAddControl", false, "textarea id");

When you're loading in on other textareas, you can replace this with any 
other loading method and change both values in the init array. Check the 
  documentation for all the options:
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration

Also you can filter the list of plugins, buttons and any other TinyMCE 
setting for each page you're loading it on.

Another method would be to include directly 
wp-includes/js/tinymce/tiny_mce.js and start it with hard-coded init 
object. That should work well especially if you don't load many plugins 
in it.


More information about the wp-hackers mailing list