Make WordPress Core

Ticket #29806: 29806.7.patch

File 29806.7.patch, 7.0 KB (added by iseulde, 11 years ago)
  • src/wp-admin/css/edit.css

     
    363363        background: transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom;
    364364}
    365365
    366 .wp-editor-expand #content-resize-handle {
     366.wp-editor-expand + #post-status-info #content-resize-handle {
    367367        display: none;
    368368}
    369369
     
    427427        z-index: 1;
    428428}
    429429
    430 .wp-editor-expand #post-status-info {
     430.wp-editor-expand + #post-status-info {
    431431        border-top: 1px solid #e5e5e5;
    432432}
    433433
  • src/wp-admin/edit-form-advanced.php

     
    1111        die('-1');
    1212
    1313wp_enqueue_script('post');
    14 $_wp_editor_expand = false;
    15 
    16 /**
    17  * Filter whether to enable the 'expand' functionality in the post editor.
    18  *
    19  * @since 4.0.0
    20  *
    21  * @param bool $expand Whether to enable the 'expand' functionality. Default true.
    22  */
    23 if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
    24          ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
    25          apply_filters( 'wp_editor_expand', true ) ) {
    26 
    27         wp_enqueue_script('editor-expand');
    28         $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
    29 }
    3014
    3115if ( wp_is_mobile() )
    3216        wp_enqueue_script( 'jquery-touch-punch' );
     
    509493
    510494if ( post_type_supports($post_type, 'editor') ) {
    511495?>
    512 <div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>">
     496<div id="postdivrich" class="postarea">
    513497
    514498<?php wp_editor( $post->post_content, 'content', array(
    515499        'drag_drop_upload' => true,
     
    517501        'editor_height' => 300,
    518502        'tinymce' => array(
    519503                'resize' => false,
    520                 'wp_autoresize_on' => $_wp_editor_expand,
    521                 'add_unload_trigger' => false,
    522         ),
     504                'add_unload_trigger' => false
     505        )
    523506) ); ?>
    524507<table id="post-status-info"><tbody><tr>
    525508        <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
  • src/wp-admin/js/editor-expand.js

     
    88
    99        /* Autoresize editor. */
    1010        $( function() {
    11                 var $wrap = $( '#postdivrich' ),
    12                         $contentWrap = $( '#wp-content-wrap' ),
     11                var $contentWrap = $( '#wp-content-wrap' ),
    1312                        $tools = $( '#wp-content-editor-tools' ),
    1413                        $visualTop = $(),
    1514                        $visualEditor = $(),
     
    297296                                $window.off( 'scroll.mce-float-panels' );
    298297                        };
    299298
    300                         if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
     299                        if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
    301300                                // Adjust "immediately"
    302301                                mceBind();
    303302                                initialResize( adjust );
     
    619618                                window.scrollTo( window.pageXOffset, 0 );
    620619                        }
    621620
    622                         $wrap.addClass( 'wp-editor-expand' );
     621                        $contentWrap.addClass( 'wp-editor-expand' );
    623622
    624623                        // Adjust when the window is scrolled or resized.
    625624                        $window.on( 'scroll.editor-expand resize.editor-expand', function( event ) {
     
    680679                                window.scrollTo( window.pageXOffset, 0 );
    681680                        }
    682681
    683                         $wrap.removeClass( 'wp-editor-expand' );
     682                        $contentWrap.removeClass( 'wp-editor-expand' );
    684683
    685684                        $window.off( '.editor-expand' );
    686685                        $document.off( '.editor-expand' );
     
    718717                }
    719718
    720719                // Start on load
    721                 if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
     720                if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
    722721                        on();
    723722
    724723                        // Ideally we need to resize just after CSS has fully loaded and QuickTags is ready.
  • src/wp-admin/js/post.js

     
    10051005                var editor, offset, mce,
    10061006                        $textarea = $('textarea#content'),
    10071007                        $handle = $('#post-status-info'),
    1008                         $postdivrich = $('#postdivrich');
     1008                        $postdivrich = $('#wp-content-wrap');
    10091009
    10101010                // No point for touch devices
    10111011                if ( ! $textarea.length || 'ontouchstart' in window ) {
  • src/wp-includes/class-wp-editor.php

     
    2525        private static $has_medialib = false;
    2626        private static $editor_buttons_css = true;
    2727        private static $drag_drop_upload = false;
     28        private static $expand = false;
    2829
    2930        private function __construct() {}
    3031
     
    109110                if ( self::$this_quicktags )
    110111                        self::$has_quicktags = true;
    111112
     113                if (
     114                        'content' === $editor_id &&
     115                        ! wp_is_mobile() &&
     116                        ! ( $GLOBALS['is_IE'] && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
     117                        /**
     118                         * Filter whether to enable the 'expand' functionality in the post editor.
     119                         *
     120                         * @since 4.0.0
     121                         *
     122                         * @param bool $expand Whether to enable the 'expand' functionality. Default true.
     123                         */
     124                        apply_filters( 'wp_editor_expand', true )
     125                ) {
     126                        self::$expand = get_user_setting( 'editor_expand', 'on' );
     127                }
     128
     129                $set['tinymce']['wp_autoresize_on'] = self::$expand === 'on';
     130
    112131                if ( empty( $set['editor_height'] ) )
    113132                        return $set;
    114133
    115                 if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
     134                if ( 'content' === $editor_id && ! $set['tinymce']['wp_autoresize_on'] ) {
    116135                        // A cookie (set when a user resizes the editor) overrides the height.
    117136                        $cookie = (int) get_user_setting( 'ed_size' );
    118137
     
    187206                        $wrap_class .= ' has-dfw';
    188207                }
    189208
     209                if ( self::$expand === 'on' ) {
     210                        $wrap_class .= ' wp-editor-expand';
     211                }
     212
    190213                echo '<div id="wp-' . $editor_id . '-wrap" class="' . $wrap_class . '">';
    191214
    192215                if ( self::$editor_buttons_css ) {
     
    278301                        if ( $set['dfw'] )
    279302                                $qtInit['buttons'] .= ',fullscreen';
    280303
    281                         if ( $editor_id === 'content' && ! wp_is_mobile() )
     304                        if ( self::$expand )
    282305                                $qtInit['buttons'] .= ',dfw';
    283306
    284307                        /**
     
    732755                        wp_enqueue_script('media-upload');
    733756                }
    734757
     758                if ( self::$expand ) {
     759                        wp_enqueue_script( 'editor-expand' );
     760                }
     761
    735762                /**
    736763                 * Fires when scripts and styles are enqueued for the editor.
    737764                 *
  • src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

     
    66                each = tinymce.each,
    77                iOS = tinymce.Env.iOS,
    88                toolbarIsHidden = true,
    9                 editorWrapParent = tinymce.$( '#postdivrich' ),
     9                editorWrap = tinymce.$( '#wp-content-wrap' ),
    1010                tb;
    1111
    1212        editor.addButton( 'wp_img_remove', {
     
    312312        }
    313313
    314314        DOM.bind( window, 'resize scroll', function() {
    315                 if ( ! toolbarIsHidden && editorWrapParent.hasClass( 'wp-editor-expand' ) ) {
     315                if ( ! toolbarIsHidden && editorWrap.hasClass( 'wp-editor-expand' ) ) {
    316316                        hide();
    317317                }
    318318        });