Make WordPress Core

Ticket #30668: 30668.3.patch

File 30668.3.patch, 2.8 KB (added by iseulde, 11 years ago)
  • src/wp-admin/js/editor-expand.js

     
    803803                        mouseY = event.pageY;
    804804                } );
    805805
     806                function recalcEditorRect() {
     807                        editorRect = $editor.offset();
     808                        editorRect.right = editorRect.left + $editor.outerWidth();
     809                        editorRect.bottom = editorRect.top + $editor.outerHeight();
     810                }
     811
    806812                function activate() {
    807813                        if ( ! _isActive ) {
    808814                                _isActive = true;
     
    909915                                $overlay
    910916                                        // Always recalculate the editor area entering the overlay with the mouse.
    911917                                        .on( 'mouseenter.focus', function() {
    912                                                 editorRect = $editor.offset();
    913                                                 editorRect.right = editorRect.left + $editor.outerWidth();
    914                                                 editorRect.bottom = editorRect.top + $editor.outerHeight();
     918                                                recalcEditorRect();
    915919
    916920                                                $window.on( 'scroll.focus', function() {
    917921                                                        var nScrollY = window.pageYOffset;
     
    937941                                        } )
    938942                                        // Fade in when the mouse moves away form the editor area.
    939943                                        .on( 'mousemove.focus', function( event ) {
    940                                                 var nx = event.pageX,
    941                                                         ny = event.pageY;
     944                                                var nx = event.clientX,
     945                                                        ny = event.clientY,
     946                                                        pageYOffset = window.pageYOffset,
     947                                                        pageXOffset = window.pageXOffset;
     948
    942949
    943950                                                if ( x && y && ( nx !== x || ny !== y ) ) {
    944951                                                        if (
    945                                                                 ( ny <= y && ny < editorRect.top ) ||
    946                                                                 ( ny >= y && ny > editorRect.bottom ) ||
    947                                                                 ( nx <= x && nx < editorRect.left ) ||
    948                                                                 ( nx >= x && nx > editorRect.right )
     952                                                                ( ny <= y && ny < editorRect.top - pageYOffset ) ||
     953                                                                ( ny >= y && ny > editorRect.bottom - pageYOffset ) ||
     954                                                                ( nx <= x && nx < editorRect.left - pageXOffset ) ||
     955                                                                ( nx >= x && nx > editorRect.right - pageXOffset )
    949956                                                        ) {
    950957                                                                traveledX += Math.abs( x - nx );
    951958                                                                traveledY += Math.abs( y - ny );
    952959
    953960                                                                if ( (
    954                                                                         ny <= editorRect.top - buffer ||
    955                                                                         ny >= editorRect.bottom + buffer ||
    956                                                                         nx <= editorRect.left - buffer ||
    957                                                                         nx >= editorRect.right + buffer
     961                                                                        ny <= editorRect.top - buffer - pageYOffset ||
     962                                                                        ny >= editorRect.bottom + buffer - pageYOffset ||
     963                                                                        nx <= editorRect.left - buffer - pageXOffset ||
     964                                                                        nx >= editorRect.right + buffer - pageXOffset
    958965                                                                ) && (
    959966                                                                        traveledX > 10 ||
    960967                                                                        traveledY > 10
     
    11511158                                        editor.on( 'blur', maybeFadeIn );
    11521159                                        editor.on( 'focus', focus );
    11531160                                        editor.on( 'blur', blur );
     1161                                        editor.on( 'wp-autoresize', recalcEditorRect );
    11541162                                };
    11551163
    11561164                                mceUnbind = function() {
     
    11581166                                        editor.off( 'blur', maybeFadeIn );
    11591167                                        editor.off( 'focus', focus );
    11601168                                        editor.off( 'blur', blur );
     1169                                        editor.off( 'wp-autoresize', recalcEditorRect );
    11611170                                };
    11621171
    11631172                                if ( _isOn ) {