]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/media-upload.js
Wordpress 2.7.1
[autoinstalls/wordpress.git] / wp-admin / js / media-upload.js
index 4d4065bc1a19f07cd3df22f6369544981cba5b04..beb8c96b7de223f626ba5c8a62ae34845a3fa43e 100644 (file)
@@ -5,12 +5,21 @@ function send_to_editor(h) {
                if (tinymce.isIE)
                        ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
 
-               if ( h.indexOf('[caption') != -1 )
-                       h = ed.plugins.wpeditimage._do_shcode(h);
-               
+               if ( h.indexOf('[caption') === 0 ) {
+                       if ( ed.plugins.wpeditimage )
+                               h = ed.plugins.wpeditimage._do_shcode(h);
+               } else if ( h.indexOf('[gallery') === 0 ) {
+                       if ( ed.plugins.wpgallery )
+                               h = ed.plugins.wpgallery._do_gallery(h);
+               }
+
                ed.execCommand('mceInsertContent', false, h);
-       } else
+
+       } else if ( typeof edInsertContent == 'function' ) {
                edInsertContent(edCanvas, h);
+       } else {
+               jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
+       }
 
        tb_remove();
 }
@@ -40,7 +49,7 @@ jQuery(function($) {
                        $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
                });
        };
-       
+
        jQuery('a.thickbox').click(function(){
                if ( typeof tinyMCE != 'undefined' &&  tinyMCE.activeEditor ) {
                        tinyMCE.get('content').focus();