X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..899389d1e4043331309c0433543419258b230b60:/wp-admin/js/editor-expand.js diff --git a/wp-admin/js/editor-expand.js b/wp-admin/js/editor-expand.js index 75496c26..4d767173 100644 --- a/wp-admin/js/editor-expand.js +++ b/wp-admin/js/editor-expand.js @@ -15,7 +15,7 @@ $visualEditor = $(), $textTop = $( '#ed_toolbar' ), $textEditor = $( '#content' ), - $textEditorClone = $( '
' ), + $textEditorClone = $( '
' ), $bottom = $( '#post-status-info' ), $menuBar = $(), $statusBar = $(), @@ -177,7 +177,7 @@ var node = editor.selection.getNode(), range, view, offset; - if ( editor.plugins.wpview && ( view = editor.plugins.wpview.getView( node ) ) ) { + if ( editor.wp && editor.wp.getView && ( view = editor.wp.getView( node ) ) ) { offset = view.getBoundingClientRect(); } else { range = editor.selection.getRng(); @@ -323,7 +323,7 @@ var windowPos = $window.scrollTop(), type = event && event.type, resize = type !== 'scroll', - visual = ( mceEditor && ! mceEditor.isHidden() ), + visual = mceEditor && ! mceEditor.isHidden(), buffer = autoresizeMinHeight, postBodyTop = $postBody.offset().top, borderWidth = 1, @@ -350,6 +350,11 @@ topHeight = heights.textTopHeight; } + // TinyMCE still intializing. + if ( ! visual && ! $top.length ) { + return; + } + topPos = $top.parent().offset().top; editorPos = $editor.offset().top; editorHeight = $editor.outerHeight(); @@ -380,7 +385,8 @@ width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) } ); - $statusBar.add( $bottom ).attr( 'style', '' ); + $statusBar.attr( 'style', advanced ? '' : 'visibility: hidden;' ); + $bottom.attr( 'style', '' ); } } else { // Maybe pin the top. @@ -489,11 +495,8 @@ ( windowPos + heights.windowHeight ) > ( editorPos + editorHeight + heights.bottomHeight + heights.statusBarHeight - borderWidth ) ) ) { fixedBottom = false; - $statusBar.add( $bottom ).attr( 'style', '' ); - - if ( ! advanced ) { - $statusBar.css( 'visibility', 'hidden' ); - } + $statusBar.attr( 'style', advanced ? '' : 'visibility: hidden;' ); + $bottom.attr( 'style', '' ); } } @@ -682,7 +685,13 @@ } function off() { - var height = window.getUserSetting('ed_size'); + var height = parseInt( window.getUserSetting( 'ed_size', 300 ), 10 ); + + if ( height < 50 ) { + height = 50; + } else if ( height > 5000 ) { + height = 5000; + } // Scroll to the top when triggering this from JS. // Ensures toolbars are reset properly.