[Plugin: Image Widget] possible clashes with other plugins/copies – send_to_editor
-
Hi
Firstly, great plugin. Thanks. Helped me get my head around image upload stuff.
One problem I noticed, when creating a duplicate (heavily renamed) plugin in order to extend your functionality a little, is that the way you are declaring javascript function send_to_editor, can cause clashes and bad behaviour.
the solution I found is quite simple and as follows:
in file image-widget.js:
line 5ish:
function: send_to_editor
change from:function send_to_editor(...
change to (eg):functon my_packagename_send_to_editor(...
line 92-95ish:
change from: `…
if (jQuery(event.target).is(‘a.thickbox-image-widget’)) {
tb_show(“Add an Image”, event.target.href, false);
}…`change to (eg): `…
if (jQuery(event.target).is(‘a.thickbox-image-widget’)) {
window.send_to_editor=window.my_packagename_send_to_editor;
tb_show(“Add an Image”, event.target.href, false);
}…`there is some further info about this general issue to be found at eg:
http://stackoverflow.com/questions/3589091/jquery-on-wordpress-meta-box-input-fields
http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/
http://austinpassy.com/2010/03/creating-custom-metaboxes-and-the-built-in-uploader/
hope this helps someone. possibly role something like this into next release?
- The topic ‘[Plugin: Image Widget] possible clashes with other plugins/copies – send_to_editor’ is closed to new replies.