From 541e47c09b503df8bd9b6d149c82cb8d98ac2710 Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 30 Jun 2008 11:17:02 +0000 Subject: WP Merge to revision 8195 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1342 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/js/media-upload.js | 23 ++++++++++++++++------- wp-admin/js/theme-preview.js | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'wp-admin/js') 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() } ); }); diff --git a/wp-admin/js/theme-preview.js b/wp-admin/js/theme-preview.js index 43b01cd..f4f85e8 100644 --- a/wp-admin/js/theme-preview.js +++ b/wp-admin/js/theme-preview.js @@ -12,7 +12,7 @@ jQuery(function($) { tbWindow.width( W - 90 ).height( H - 60 ); $('#TB_iframeContent').width( W - 90 ).height( H - 90 ); tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'}); - if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) ) + if ( typeof document.body.style.maxWidth != 'undefined' ) tbWindow.css({'top':'30px','margin-top':'0'}); }; -- cgit