From 1121aad86ec7378505d21a7eaa46a244a5009387 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Tue, 26 Aug 2014 18:38:26 +0000 Subject: [PATCH] Editor scrolling: reduce the amount of height jumping on load. props avryl. fixes #29307. git-svn-id: https://develop.svn.wordpress.org/trunk@29628 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-advanced.php | 2 +- src/wp-admin/js/editor-expand.js | 3 ++- src/wp-includes/class-wp-editor.php | 2 +- src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index 4fa7e85e09..9356b1a245 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -496,7 +496,7 @@ if ( post_type_supports($post_type, 'editor') ) { 'dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', - 'editor_height' => 360, + 'editor_height' => 300, 'tinymce' => array( 'resize' => false, 'wp_autoresize_on' => ( ! empty( $_wp_autoresize_on ) && get_user_setting( 'editor_expand', 'on' ) === 'on' ), diff --git a/src/wp-admin/js/editor-expand.js b/src/wp-admin/js/editor-expand.js index b244059104..4e3dbf8541 100644 --- a/src/wp-admin/js/editor-expand.js +++ b/src/wp-admin/js/editor-expand.js @@ -34,6 +34,7 @@ jQuery( document ).ready( function($) { pageYOffsetAtTop = 130, pinnedToolsTop = 56, autoresizeMinHeight = 300, + initialMode = window.getUserSetting( 'editor' ), // These are corrected when adjust() runs, except on scrolling if already set. heights = { windowHeight: 0, @@ -119,7 +120,7 @@ jQuery( document ).ready( function($) { } function textEditorResize() { - if ( mceEditor && ! mceEditor.isHidden() ) { + if ( ( mceEditor && ! mceEditor.isHidden() ) || ( ! mceEditor && initialMode === 'tinymce' ) ) { return; } diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index 9659336fe9..200031bbdc 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -112,7 +112,7 @@ final class _WP_Editors { if ( empty( $set['editor_height'] ) ) return $set; - if ( 'content' === $editor_id ) { + if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) { // A cookie (set when a user resizes the editor) overrides the height. $cookie = (int) get_user_setting( 'ed_size' ); diff --git a/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js b/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js index 600c12335e..dc1f524437 100644 --- a/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js @@ -22,7 +22,7 @@ */ tinymce.PluginManager.add( 'wpautoresize', function( editor ) { var settings = editor.settings, - oldSize = 0, + oldSize = 300, isActive = false; function isFullscreen() {