Editor: prevent jumping when using the backspace button in the Text editor in Firefox and IE.

Fixes #37072.
Built from https://develop.svn.wordpress.org/trunk@37684


git-svn-id: http://core.svn.wordpress.org/trunk@37650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-06-11 05:15:27 +00:00
parent defe5e371b
commit f78dd6fe2e
3 changed files with 7 additions and 3 deletions

View File

@ -86,17 +86,21 @@
var length = textEditor.value.length; var length = textEditor.value.length;
var height = parseInt( textEditor.style.height, 10 ); var height = parseInt( textEditor.style.height, 10 );
var top = window.scrollTop;
if ( length < oldTextLength ) { if ( length < oldTextLength ) {
// textEditor.scrollHeight is not adjusted until the next line. // textEditor.scrollHeight is not adjusted until the next line.
textEditor.style.height = 'auto'; textEditor.style.height = 'auto';
if ( textEditor.scrollHeight >= autoresizeMinHeight ) { if ( textEditor.scrollHeight > autoresizeMinHeight ) {
textEditor.style.height = textEditor.scrollHeight + 'px'; textEditor.style.height = textEditor.scrollHeight + 'px';
} else { } else {
textEditor.style.height = autoresizeMinHeight + 'px'; textEditor.style.height = autoresizeMinHeight + 'px';
} }
// Prevent scroll-jumping in Firefox and IE.
window.scrollTop = top;
if ( textEditor.scrollHeight < height ) { if ( textEditor.scrollHeight < height ) {
adjust(); adjust();
} }

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37683'; $wp_version = '4.6-alpha-37684';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.