mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Editor: throttle scrolling of the main window when the editor is active and is being scrolled with the mouse wheel or a trackpad, see #27013
git-svn-id: https://develop.svn.wordpress.org/trunk@27368 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -276,7 +276,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
});
|
||||
|
||||
editor.on( 'init', function() {
|
||||
var env = tinymce.Env,
|
||||
var env = tinymce.Env, topx, reset,
|
||||
deltax = 0,
|
||||
bodyClass = ['mceContentBody'], // back-compat for themes that use this in editor-style.css...
|
||||
doc = editor.getDoc();
|
||||
|
||||
@@ -318,11 +319,16 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
if ( ! ( 'ontouchstart' in window ) ) {
|
||||
// When scrolling with mouse wheel or trackpad inside the editor, don't scroll the parent window
|
||||
editor.dom.bind( doc, 'onwheel' in doc ? 'wheel' : 'mousewheel', function( event ) {
|
||||
var delta, docElement = doc.documentElement;
|
||||
var delta, top,
|
||||
docElement = doc.documentElement;
|
||||
|
||||
if ( editor.settings.wp_fullscreen ) {
|
||||
return;
|
||||
}
|
||||
// Don't modify scrolling when the editor is not active.
|
||||
if ( typeof doc.hasFocus === 'function' && ! doc.hasFocus() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof event.deltaY !== 'undefined' ) {
|
||||
delta = event.deltaY;
|
||||
@@ -334,13 +340,34 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
delta = -event.wheelDelta;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( env.webkit ) {
|
||||
doc.body.scrollTop += delta;
|
||||
} else {
|
||||
docElement.scrollTop += delta;
|
||||
}
|
||||
|
||||
top = docElement.scrollTop || doc.body.scrollTop;
|
||||
|
||||
if ( topx === top ) {
|
||||
deltax += delta;
|
||||
|
||||
window.clearTimeout( reset );
|
||||
// Sensitivity: delay before resetting the count of over-scroll pixels
|
||||
reset = window.setTimeout( function() {
|
||||
deltax = 0;
|
||||
}, 1000 );
|
||||
} else {
|
||||
deltax = 0;
|
||||
}
|
||||
|
||||
topx = top;
|
||||
|
||||
// Sensitivity: scroll the parent window when over-scrolling by more than 1000px
|
||||
if ( deltax > 1000 || deltax < -1000 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '3.9-alpha-27234-src';
|
||||
$wp_version = '3.9-alpha-27368-src';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
@@ -18,7 +18,7 @@ $wp_db_version = 26691;
|
||||
*
|
||||
* @global string $tinymce_version
|
||||
*/
|
||||
$tinymce_version = '4016-20140211';
|
||||
$tinymce_version = '4016-20140302';
|
||||
|
||||
/**
|
||||
* Holds the required PHP version
|
||||
|
||||
Reference in New Issue
Block a user