]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/editor-expand.js
WordPress 4.2
[autoinstalls/wordpress.git] / wp-admin / js / editor-expand.js
index 75496c26ce096a1bfa6e69eebc913a068b000350..db7561e62a843fa7a8233a1c871367da09fbf031 100644 (file)
                                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();
                        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,
                                topHeight = heights.textTopHeight;
                        }
 
+                       // TinyMCE still intializing.
+                       if ( ! visual && ! $top.length ) {
+                               return;
+                       }
+
                        topPos = $top.parent().offset().top;
                        editorPos = $editor.offset().top;
                        editorHeight = $editor.outerHeight();
                                                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.
                                                ( 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', '' );
                                }
                        }
 
                }
 
                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.