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
This commit is contained in:
Helen Hou-Sandi 2014-08-26 18:38:26 +00:00
parent ad66613c02
commit 1121aad86e
4 changed files with 5 additions and 4 deletions

View File

@ -496,7 +496,7 @@ if ( post_type_supports($post_type, 'editor') ) {
'dfw' => true, 'dfw' => true,
'drag_drop_upload' => true, 'drag_drop_upload' => true,
'tabfocus_elements' => 'insert-media-button-1,save-post', 'tabfocus_elements' => 'insert-media-button-1,save-post',
'editor_height' => 360, 'editor_height' => 300,
'tinymce' => array( 'tinymce' => array(
'resize' => false, 'resize' => false,
'wp_autoresize_on' => ( ! empty( $_wp_autoresize_on ) && get_user_setting( 'editor_expand', 'on' ) === 'on' ), 'wp_autoresize_on' => ( ! empty( $_wp_autoresize_on ) && get_user_setting( 'editor_expand', 'on' ) === 'on' ),

View File

@ -34,6 +34,7 @@ jQuery( document ).ready( function($) {
pageYOffsetAtTop = 130, pageYOffsetAtTop = 130,
pinnedToolsTop = 56, pinnedToolsTop = 56,
autoresizeMinHeight = 300, autoresizeMinHeight = 300,
initialMode = window.getUserSetting( 'editor' ),
// These are corrected when adjust() runs, except on scrolling if already set. // These are corrected when adjust() runs, except on scrolling if already set.
heights = { heights = {
windowHeight: 0, windowHeight: 0,
@ -119,7 +120,7 @@ jQuery( document ).ready( function($) {
} }
function textEditorResize() { function textEditorResize() {
if ( mceEditor && ! mceEditor.isHidden() ) { if ( ( mceEditor && ! mceEditor.isHidden() ) || ( ! mceEditor && initialMode === 'tinymce' ) ) {
return; return;
} }

View File

@ -112,7 +112,7 @@ final class _WP_Editors {
if ( empty( $set['editor_height'] ) ) if ( empty( $set['editor_height'] ) )
return $set; 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. // A cookie (set when a user resizes the editor) overrides the height.
$cookie = (int) get_user_setting( 'ed_size' ); $cookie = (int) get_user_setting( 'ed_size' );

View File

@ -22,7 +22,7 @@
*/ */
tinymce.PluginManager.add( 'wpautoresize', function( editor ) { tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
var settings = editor.settings, var settings = editor.settings,
oldSize = 0, oldSize = 300,
isActive = false; isActive = false;
function isFullscreen() { function isFullscreen() {