Ticket #29806: 29806.7.patch
File 29806.7.patch, 7.0 KB (added by , 11 years ago) |
---|
-
src/wp-admin/css/edit.css
363 363 background: transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom; 364 364 } 365 365 366 .wp-editor-expand #content-resize-handle {366 .wp-editor-expand + #post-status-info #content-resize-handle { 367 367 display: none; 368 368 } 369 369 … … 427 427 z-index: 1; 428 428 } 429 429 430 .wp-editor-expand #post-status-info {430 .wp-editor-expand + #post-status-info { 431 431 border-top: 1px solid #e5e5e5; 432 432 } 433 433 -
src/wp-admin/edit-form-advanced.php
11 11 die('-1'); 12 12 13 13 wp_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.020 *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 }30 14 31 15 if ( wp_is_mobile() ) 32 16 wp_enqueue_script( 'jquery-touch-punch' ); … … 509 493 510 494 if ( post_type_supports($post_type, 'editor') ) { 511 495 ?> 512 <div id="postdivrich" class="postarea <?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>">496 <div id="postdivrich" class="postarea"> 513 497 514 498 <?php wp_editor( $post->post_content, 'content', array( 515 499 'drag_drop_upload' => true, … … 517 501 'editor_height' => 300, 518 502 'tinymce' => array( 519 503 'resize' => false, 520 'wp_autoresize_on' => $_wp_editor_expand, 521 'add_unload_trigger' => false, 522 ), 504 'add_unload_trigger' => false 505 ) 523 506 ) ); ?> 524 507 <table id="post-status-info"><tbody><tr> 525 508 <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> -
src/wp-admin/js/editor-expand.js
8 8 9 9 /* Autoresize editor. */ 10 10 $( function() { 11 var $wrap = $( '#postdivrich' ), 12 $contentWrap = $( '#wp-content-wrap' ), 11 var $contentWrap = $( '#wp-content-wrap' ), 13 12 $tools = $( '#wp-content-editor-tools' ), 14 13 $visualTop = $(), 15 14 $visualEditor = $(), … … 297 296 $window.off( 'scroll.mce-float-panels' ); 298 297 }; 299 298 300 if ( $ wrap.hasClass( 'wp-editor-expand' ) ) {299 if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) { 301 300 // Adjust "immediately" 302 301 mceBind(); 303 302 initialResize( adjust ); … … 619 618 window.scrollTo( window.pageXOffset, 0 ); 620 619 } 621 620 622 $ wrap.addClass( 'wp-editor-expand' );621 $contentWrap.addClass( 'wp-editor-expand' ); 623 622 624 623 // Adjust when the window is scrolled or resized. 625 624 $window.on( 'scroll.editor-expand resize.editor-expand', function( event ) { … … 680 679 window.scrollTo( window.pageXOffset, 0 ); 681 680 } 682 681 683 $ wrap.removeClass( 'wp-editor-expand' );682 $contentWrap.removeClass( 'wp-editor-expand' ); 684 683 685 684 $window.off( '.editor-expand' ); 686 685 $document.off( '.editor-expand' ); … … 718 717 } 719 718 720 719 // Start on load 721 if ( $ wrap.hasClass( 'wp-editor-expand' ) ) {720 if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) { 722 721 on(); 723 722 724 723 // Ideally we need to resize just after CSS has fully loaded and QuickTags is ready. -
src/wp-admin/js/post.js
1005 1005 var editor, offset, mce, 1006 1006 $textarea = $('textarea#content'), 1007 1007 $handle = $('#post-status-info'), 1008 $postdivrich = $('# postdivrich');1008 $postdivrich = $('#wp-content-wrap'); 1009 1009 1010 1010 // No point for touch devices 1011 1011 if ( ! $textarea.length || 'ontouchstart' in window ) { -
src/wp-includes/class-wp-editor.php
25 25 private static $has_medialib = false; 26 26 private static $editor_buttons_css = true; 27 27 private static $drag_drop_upload = false; 28 private static $expand = false; 28 29 29 30 private function __construct() {} 30 31 … … 109 110 if ( self::$this_quicktags ) 110 111 self::$has_quicktags = true; 111 112 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 112 131 if ( empty( $set['editor_height'] ) ) 113 132 return $set; 114 133 115 if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] )) {134 if ( 'content' === $editor_id && ! $set['tinymce']['wp_autoresize_on'] ) { 116 135 // A cookie (set when a user resizes the editor) overrides the height. 117 136 $cookie = (int) get_user_setting( 'ed_size' ); 118 137 … … 187 206 $wrap_class .= ' has-dfw'; 188 207 } 189 208 209 if ( self::$expand === 'on' ) { 210 $wrap_class .= ' wp-editor-expand'; 211 } 212 190 213 echo '<div id="wp-' . $editor_id . '-wrap" class="' . $wrap_class . '">'; 191 214 192 215 if ( self::$editor_buttons_css ) { … … 278 301 if ( $set['dfw'] ) 279 302 $qtInit['buttons'] .= ',fullscreen'; 280 303 281 if ( $editor_id === 'content' && ! wp_is_mobile())304 if ( self::$expand ) 282 305 $qtInit['buttons'] .= ',dfw'; 283 306 284 307 /** … … 732 755 wp_enqueue_script('media-upload'); 733 756 } 734 757 758 if ( self::$expand ) { 759 wp_enqueue_script( 'editor-expand' ); 760 } 761 735 762 /** 736 763 * Fires when scripts and styles are enqueued for the editor. 737 764 * -
src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
6 6 each = tinymce.each, 7 7 iOS = tinymce.Env.iOS, 8 8 toolbarIsHidden = true, 9 editorWrap Parent = tinymce.$( '#postdivrich' ),9 editorWrap = tinymce.$( '#wp-content-wrap' ), 10 10 tb; 11 11 12 12 editor.addButton( 'wp_img_remove', { … … 312 312 } 313 313 314 314 DOM.bind( window, 'resize scroll', function() { 315 if ( ! toolbarIsHidden && editorWrap Parent.hasClass( 'wp-editor-expand' ) ) {315 if ( ! toolbarIsHidden && editorWrap.hasClass( 'wp-editor-expand' ) ) { 316 316 hide(); 317 317 } 318 318 });