Make WordPress Core

Ticket #29338: 29338.3.patch

File 29338.3.patch, 1.2 KB (added by azaozz, 11 years ago)
  • src/wp-admin/js/editor-expand.js

     
    223223                }
    224224
    225225                function mceHide() {
    226                         var wrapHeight = $( '#wpwrap' ).height();
     226                        var wrapHeight = $( '#wpwrap' ).height(),
     227                                windowPos = $window.scrollTop(),
     228                                iframeHeight, textareaHeight, scroll, topPos;
    227229
    228230                        textEditorResize();
     231                        iframeHeight = $('#content_ifr').height();
     232                        textareaHeight = $textEditor.height();
    229233
    230                         if ( wrapHeight && $window.scrollTop() > wrapHeight ) {
     234                        if ( iframeHeight > textareaHeight && ( windowPos + heights.windowHeight ) > ( textareaHeight + $textEditor.offset().top ) ) {
     235                                scroll = iframeHeight - textareaHeight - 1;
     236                                topPos = $textEditor.parent().offset().top - heights.toolsHeight - heights.adminBarHeight;
     237
     238                                if ( windowPos - scroll < topPos ) {
     239                                        window.scrollTo( window.pageXOffset, topPos );
     240                                } else {
     241                                        window.scrollBy( 0, -scroll );
     242                                }
     243
     244                                adjust();
     245                                window.scrollBy( 0, 1 );
     246                        } else if ( wrapHeight && windowPos > wrapHeight ) {
    231247                                window.scrollTo( window.pageXOffset, wrapHeight - 1 );
    232248                        }
    233249