summaryrefslogtreecommitdiffstats
path: root/wp-admin/js/media-upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin/js/media-upload.js')
-rw-r--r--wp-admin/js/media-upload.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js
index 8c88270..99acd26 100644
--- a/wp-admin/js/media-upload.js
+++ b/wp-admin/js/media-upload.js
@@ -1,13 +1,15 @@
// send html to the post editor
function send_to_editor(h) {
- var win = window.dialogArguments || opener || parent || top;
+ if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
+ ed.focus();
+ if (tinymce.isIE)
+ ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
- tinyMCE = win.tinyMCE;
- if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) {
- tinyMCE.selectedInstance.getWin().focus();
- tinyMCE.execCommand('mceInsertContent', false, h);
+ ed.execCommand('mceInsertContent', false, h);
} else
- win.edInsertContent(win.edCanvas, h);
+ edInsertContent(edCanvas, h);
+
+ tb_remove();
}
// thickbox settings
@@ -22,7 +24,7 @@ jQuery(function($) {
tbWindow.width( W - 50 ).height( H - 45 );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
- if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
+ if ( typeof document.body.style.maxWidth != 'undefined' )
tbWindow.css({'top':'20px','margin-top':'0'});
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
};
@@ -35,6 +37,13 @@ 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();
+ tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
+ }
+ });
$(window).resize( function() { tb_position() } );
});