Make WordPress Core

Ticket #38850: 38850.patch

File 38850.patch, 3.4 KB (added by iseuldebot, 7 years ago)
  • src/wp-admin/css/edit.css

     
    391391        z-index: 999;
    392392}
    393393
     394.wp-editor-expand .wp-editor-tools {
     395        position: sticky;
     396        position: -webkit-sticky;
     397        top: 32px;
     398}
     399
     400.wp-editor-expand div.mce-toolbar-grp,
     401.wp-editor-expand .quicktags-toolbar {
     402        position: sticky;
     403        position: -webkit-sticky;
     404        top: 87px; /* admin bar height + tools height */
     405}
     406
    394407/* TinyMCE native fullscreen mode override */
    395408.mce-fullscreen #wp-content-wrap .mce-menubar,
    396409.mce-fullscreen #wp-content-wrap .mce-toolbar-grp,
  • src/wp-admin/js/editor-expand.js

     
    66                $adminBar = $( '#wpadminbar' ),
    77                $footer = $( '#wpfooter' );
    88
     9        var featureSticky = ( function() {
     10                var element = document.createElement( 'div' );
     11                var style = element.style;
     12
     13                style.cssText = 'position:sticky;position:-webkit-sticky';
     14
     15                return !! style.position;
     16        } )();
     17
    918        /* Autoresize editor. */
    1019        $( function() {
    1120                var $wrap = $( '#postdivrich' ),
     
    333342
    334343                        if ( ! canPin ) {
    335344                                if ( resize ) {
     345                                        if ( ! featureSticky ) {
    336346                                        $tools.css( {
    337347                                                position: 'absolute',
    338348                                                top: 0,
     
    352362                                                top: heights.menuBarHeight,
    353363                                                width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
    354364                                        } );
     365                                        }
    355366
    356367                                        $statusBar.attr( 'style', advanced ? '' : 'visibility: hidden;' );
    357368                                        $bottom.attr( 'style', '' );
     
    365376                                        windowPos <= ( topPos - heights.toolsHeight - heights.adminBarHeight + editorHeight - buffer ) ) ) {
    366377                                        fixedTop = true;
    367378
     379                                        if ( ! featureSticky ) {
    368380                                        $tools.css( {
    369381                                                position: 'fixed',
    370382                                                top: heights.adminBarHeight,
     
    384396                                                top: heights.adminBarHeight + heights.toolsHeight + heights.menuBarHeight,
    385397                                                width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
    386398                                        } );
     399                                        }
    387400                                // Maybe unpin the top.
    388401                                } else if ( fixedTop || resize ) {
    389402                                        // Handle scrolling up.
    390403                                        if ( windowPos <= ( topPos - heights.toolsHeight - heights.adminBarHeight ) ) {
    391404                                                fixedTop = false;
    392405
     406                                                if ( ! featureSticky ) {
    393407                                                $tools.css( {
    394408                                                        position: 'absolute',
    395409                                                        top: 0,
     
    409423                                                        top: heights.menuBarHeight,
    410424                                                        width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
    411425                                                } );
     426                                                }
    412427                                        // Handle scrolling down.
    413428                                        } else if ( windowPos >= ( topPos - heights.toolsHeight - heights.adminBarHeight + editorHeight - buffer ) ) {
    414429                                                fixedTop = false;
    415430
     431                                                if ( ! featureSticky ) {
    416432                                                $tools.css( {
    417433                                                        position: 'absolute',
    418434                                                        top: editorHeight - buffer,
     
    432448                                                        top: editorHeight - buffer + heights.menuBarHeight,
    433449                                                        width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
    434450                                                } );
     451                                                }
    435452                                        }
    436453                                }
    437454
     
    558575                                fixedSideTop = fixedSideBottom = false;
    559576                        }
    560577
    561                         if ( resize ) {
     578                        if ( resize && ! featureSticky ) {
    562579                                $contentWrap.css( {
    563580                                        paddingTop: heights.toolsHeight
    564581                                } );