[wp-testers] CSS in WYSIWYG
Andy Skelton
skeltoac at gmail.com
Fri Dec 16 05:33:22 GMT 2005
On 12/15/05, Isaac Wedin <isaac at wedin.org> wrote:
> I'd *love* to see some hooks for TinyMCE in the plugin API. I've gotten
> the images popup tool in my plugin (Photopress) to more-or-less work by
> including tiny_mce_popup.js and using tinyMCE.insertimage(). I'd like to
> see a simple way to add a button to the TinyMCE toolbar, and a way to
> specify a CSS class for inserted images.
That's clever work! There's a filter for the toolbar icons in
tiny_mce_gzip.php: mce_buttons.
If you want to change the way a tinyMCE core function works, you can
replace it with your own function. This might work:
add_action('tinymce_before_init', 'replace_insertImage');
function replace_insertImage() {
?>
tinyMCE.oldInsertImage = tinyMCE.insertImage;
tinyMCE.insertImage = function (<all the args of insertImage>, class) {
re = tinyMCE.oldInsertImage(<all the args again>);
if ( this.imgElement )
tinyMCE.setAttrib(this.imgElement, 'class', class);
return re;
}
<?php
}
But no guarantees, okay? :-)
Andy
More information about the wp-testers
mailing list