diff --git a/wp-admin/js/media-upload.dev.js b/wp-admin/js/media-upload.dev.js index 672d81de93..75478725ac 100644 --- a/wp-admin/js/media-upload.dev.js +++ b/wp-admin/js/media-upload.dev.js @@ -3,7 +3,9 @@ function send_to_editor(h) { var ed; if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { - ed.focus(); + // restore caret position on IE + if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) + ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); if ( h.indexOf('[caption') === 0 ) { if ( ed.plugins.wpeditimage ) @@ -55,4 +57,16 @@ var tb_position; $(window).resize(function(){ tb_position(); }); + // store caret position in IE + $(document).ready(function($){ + $('a.thickbox').click(function(){ + var ed; + + if ( typeof tinyMCE != 'undefined' && tinymce.isIE && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) { + ed.focus(); + ed.windowManager.insertimagebookmark = ed.selection.getBookmark(); + } + }); + }); + })(jQuery); diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 8ed45caa55..201f6abc2c 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -1 +1 @@ -function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}else{if(b.indexOf("[embed")===0){if(a.plugins.wordpress){b=a.plugins.wordpress._setEmbed(b)}}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20110414' ); - $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20110414' ); + $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20110425' ); $scripts->add_data( 'media-upload', 'group', 1 ); $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20101007' );