From 1c0d6827f5d7019e03f18c451cf1a4c6c740f997 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 27 Mar 2014 02:34:25 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/post.js | 51 ----------------- .../js/tinymce/plugins/wordpress/plugin.js | 55 ------------------- 2 files changed, 106 deletions(-) diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js index 3dcebfe9a0..df43fd957e 100644 --- a/src/wp-admin/js/post.js +++ b/src/wp-admin/js/post.js @@ -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(); - }); - } }); diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 25362cc63a..b0e1905268 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -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.