Remove containment of scrolling inside the editor for now. See #27013

git-svn-id: https://develop.svn.wordpress.org/trunk@27770 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-03-27 02:34:25 +00:00
parent 50d900aa5f
commit 1c0d6827f5
2 changed files with 0 additions and 106 deletions

View File

@ -1068,55 +1068,4 @@ jQuery(document).ready( function($) {
}
});
}
if ( ! ( 'ontouchstart' in window ) ) {
// When scrolling with mouse wheel or trackpad inside the Text editor, don't scroll the whole window
$content = $('#content').on( 'onwheel' in $document[0] ? 'wheel.text-editor-scroll' : 'mousewheel.text-editor-scroll', function( event ) {
var delta, top,
origEvent = event.originalEvent;
if ( wp.editor && wp.editor.fullscreen.settings.visible ) {
return;
}
// Don't modify scrolling when the Text editor is not active.
if ( document.activeElement && document.activeElement.id !== 'content' ) {
return;
}
if ( typeof origEvent.deltaY !== 'undefined' ) {
delta = origEvent.deltaY;
if ( typeof origEvent.deltaMode !== 'undefined' && origEvent.deltaMode === origEvent.DOM_DELTA_LINE ) {
delta *= 20;
}
} else {
delta = -origEvent.wheelDelta;
}
$content.scrollTop( $content.scrollTop() + delta );
top = $content.scrollTop();
if ( topx === top ) {
deltax += delta;
window.clearTimeout( reset );
reset = window.setTimeout( function() {
deltax = 0;
}, 1000 );
} else {
deltax = 0;
}
topx = top;
// Sensitivity: scroll the parent window when over-scrolling by more than 800px
if ( deltax > 1000 || deltax < -1000 ) {
return;
}
event.preventDefault();
});
}
});

View File

@ -311,61 +311,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
window.jQuery( document ).triggerHandler( 'tinymce-editor-init', [editor] );
}
if ( ! ( 'ontouchstart' in window ) ) {
// When scrolling with mouse wheel or trackpad inside the editor, don't scroll the parent window
dom.bind( doc, 'onwheel' in doc ? 'wheel' : 'mousewheel', function( event ) {
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;
if ( typeof event.deltaMode !== 'undefined' && event.deltaMode === event.DOM_DELTA_LINE ) {
delta *= 20;
}
} else {
delta = -event.wheelDelta;
}
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();
});
}
dom.bind( doc, 'dragstart dragend dragover drop', function( event ) {
if ( typeof window.jQuery !== 'undefined' ) {
// Trigger the jQuery handlers.