diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js
index 6136e6ba80..e718716355 100644
--- a/wp-admin/js/editor.js
+++ b/wp-admin/js/editor.js
@@ -13,7 +13,7 @@ window.switchEditors = {
// mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the 'Text' editor tab.
go: function( id, mode ) {
- var t = this, ed, wrap_id, txtarea_el, editorHeight, toolbarHeight,
+ var t = this, ed, wrap_id, txtarea_el, iframe, editorHeight, toolbarHeight,
DOM = tinymce.DOM; //DOMUtils outside the editor iframe
id = id || 'content';
@@ -32,17 +32,14 @@ window.switchEditors = {
}
function getToolbarHeight() {
- var height;
+ var node = DOM.select( '.mce-toolbar-grp', ed.getContainer() )[0],
+ height = node && node.clientHeight;
- try {
- height = DOM.getSize( DOM.select( '.mce-toolbar-grp', ed.getContainer() )[0] );
- } catch(e){}
-
- if ( height && height.h && height.h > 10 && height.h < 100 ) {
- return height.h;
+ if ( height && height > 10 && height < 200 ) {
+ return parseInt( height, 10 );
}
- return 0;
+ return 30;
}
if ( 'tmce' === mode || 'tinymce' === mode ) {
@@ -63,8 +60,9 @@ window.switchEditors = {
if ( ed ) {
ed.show();
- if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
- editorHeight = editorHeight - toolbarHeight + 11;
+ if ( editorHeight ) {
+ toolbarHeight = getToolbarHeight();
+ editorHeight = editorHeight - toolbarHeight + 14;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
@@ -73,9 +71,6 @@ window.switchEditors = {
}
} else {
tinymce.init( tinyMCEPreInit.mceInit[id] );
-
- // ed = tinymce.createEditor( id, tinyMCEPreInit.mceInit[id] );
- // ed.render();
}
DOM.removeClass( wrap_id, 'html-active' );
@@ -89,11 +84,12 @@ window.switchEditors = {
}
if ( ed ) {
- editorHeight = DOM.get( id + '_ifr' );
- editorHeight = editorHeight ? parseInt( editorHeight.style.height, 10 ) : 0;
+ iframe = DOM.get( id + '_ifr' );
+ editorHeight = iframe ? parseInt( iframe.style.height, 10 ) : 0;
- if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
- editorHeight = editorHeight + toolbarHeight - 11;
+ if ( editorHeight ) {
+ toolbarHeight = getToolbarHeight();
+ editorHeight = editorHeight + toolbarHeight - 14;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
diff --git a/wp-admin/js/editor.min.js b/wp-admin/js/editor.min.js
index f437280fd2..9babf7bdf1 100644
--- a/wp-admin/js/editor.min.js
+++ b/wp-admin/js/editor.min.js
@@ -1 +1 @@
-window.switchEditors={switchto:function(a){var b=a.id,c=b.length,d=b.substr(0,c-5),e=b.substr(c-4);this.go(d,e)},go:function(a,b){function c(){var a;try{a=j.getSize(j.select(".mce-toolbar-grp",d.getContainer())[0])}catch(b){}return a&&a.h&&a.h>10&&a.h<100?a.h:0}var d,e,f,g,h,i=this,j=tinymce.DOM;if(a=a||"content",b=b||"toggle",d=tinymce.get(a),e="wp-"+a+"-wrap",f=j.get(a),"toggle"===b&&(b=d&&!d.isHidden()?"html":"tmce"),"tmce"===b||"tinymce"===b){if(d&&!d.isHidden())return!1;"undefined"!=typeof QTags&&QTags.closeAllTags(a),g=f?parseInt(f.style.height,10):0,tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=i.wpautop(f.value)),d?(d.show(),g&&(h=c())&&(g=g-h+11,g>50&&5e3>g&&d.theme.resizeTo(null,g))):tinymce.init(tinyMCEPreInit.mceInit[a]),j.removeClass(e,"html-active"),j.addClass(e,"tmce-active"),setUserSetting("editor","tinymce")}else if("html"===b){if(d&&d.isHidden())return!1;d?(g=j.get(a+"_ifr"),g=g?parseInt(g.style.height,10):0,g&&(h=c())&&(g=g+h-11,g>50&&5e3>g&&(f.style.height=g+"px")),d.hide()):(tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=i.pre_wpautop(f.value)),j.setStyles(f,{display:"",visibility:""})),j.removeClass(e,"tmce-active"),j.addClass(e,"html-active"),setUserSetting("editor","html")}return!1},_wp_Nop:function(a){var b,c,d=!1,e=!1;return(-1!==a.indexOf("
]*>[\s\S]+?<\/\1>/g,function(a){return a=a.replace(/
(\r\n|\n)?/g,""),a=a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),a.replace(/\r?\n/g,"")})),-1!==a.indexOf("[caption")&&(e=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a.replace(/
]*)>/g,"").replace(/[\r\n\t]+/,"")})),b="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",a=a.replace(new RegExp("\\s*("+b+")>\\s*","g"),"$1>\n"),a=a.replace(new RegExp("\\s*<((?:"+b+")(?: [^>]*)?)>","g"),"\n<$1>"),a=a.replace(/(]+>.*?)<\/p>/g,"$1
"),a=a.replace(/]*)?>\s*
/gi,"
\n\n"),a=a.replace(/\s*
/gi,""),a=a.replace(/\s*<\/p>\s*/gi,"\n\n"),a=a.replace(/\n[\s\u00a0]+\n/g,"\n\n"),a=a.replace(/\s*
\s*/gi,"\n"),a=a.replace(/\s*
\s*/g,"
\n"),a=a.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),a=a.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",a=a.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),a=a.replace(new RegExp("\\s*("+c+")>\\s*","g"),"$1>\n"),a=a.replace(/
]*)>/g," "),-1!==a.indexOf("
]*)?>\s*/g,"\n\n
\n\n")),-1!==a.indexOf("