Andy Skelton wrote:
On 12/15/05, Isaac Wedin <[EMAIL PROTECTED]> 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.
Following is the URL to my buttonsnap library for adding buttons to the
WordPress 2.0 editors. It adds buttons to both the RTE and the textarea
(regardless of user settings) by adding a single include and one line of
php for each button.
There are three possibilities for the action of added buttons:
* You can directly replace the selected text in the editor with a fixed
value.
* You can execute javascript (for popping up dialogs or whatever).
* You can directly replace the selected text in the editor with a value
returned from a WordPress plugin hook.
Read that last one again.
Here's an example:
buttonsnap_ajaxbutton($button_image_url3, 'Ajax Button', 'my_hook');
add_filter('my_hook', 'my_hook_sink');
function my_hook_sink($selectedtext)
{
return '<del datetime="' . date('Y-m-d H:i:s') . '">' . $selectedtext .
'</del>';
}
You don't need to learn javascript to use this, much less the cryptic
format of the TinyMCE javascript plugins. It's also instantly
compatible with *both* editors.
I'm interested in comments or updates.
http://redalt.com/downloads/wp2/buttonsnap.zip
Owen
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers