X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/76aea3697c6043c1613370f172395b4f65ee71f0..11be8dc178e77d0b46189bbd8e33a216a9b90942:/wp-admin/js/media-upload.js diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 4d4065bc..beb8c96b 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -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();