Changeset 27770
- Timestamp:
- 03/27/2014 02:34:25 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/post.js
r27728 r27770 1069 1069 }); 1070 1070 } 1071 1072 if ( ! ( 'ontouchstart' in window ) ) {1073 // When scrolling with mouse wheel or trackpad inside the Text editor, don't scroll the whole window1074 $content = $('#content').on( 'onwheel' in $document[0] ? 'wheel.text-editor-scroll' : 'mousewheel.text-editor-scroll', function( event ) {1075 var delta, top,1076 origEvent = event.originalEvent;1077 1078 if ( wp.editor && wp.editor.fullscreen.settings.visible ) {1079 return;1080 }1081 1082 // Don't modify scrolling when the Text editor is not active.1083 if ( document.activeElement && document.activeElement.id !== 'content' ) {1084 return;1085 }1086 1087 if ( typeof origEvent.deltaY !== 'undefined' ) {1088 delta = origEvent.deltaY;1089 1090 if ( typeof origEvent.deltaMode !== 'undefined' && origEvent.deltaMode === origEvent.DOM_DELTA_LINE ) {1091 delta *= 20;1092 }1093 } else {1094 delta = -origEvent.wheelDelta;1095 }1096 1097 $content.scrollTop( $content.scrollTop() + delta );1098 1099 top = $content.scrollTop();1100 1101 if ( topx === top ) {1102 deltax += delta;1103 1104 window.clearTimeout( reset );1105 reset = window.setTimeout( function() {1106 deltax = 0;1107 }, 1000 );1108 } else {1109 deltax = 0;1110 }1111 1112 topx = top;1113 1114 // Sensitivity: scroll the parent window when over-scrolling by more than 800px1115 if ( deltax > 1000 || deltax < -1000 ) {1116 return;1117 }1118 1119 event.preventDefault();1120 });1121 }1122 1071 }); -
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r27765 r27770 310 310 if ( typeof window.jQuery !== 'undefined' ) { 311 311 window.jQuery( document ).triggerHandler( 'tinymce-editor-init', [editor] ); 312 }313 314 if ( ! ( 'ontouchstart' in window ) ) {315 // When scrolling with mouse wheel or trackpad inside the editor, don't scroll the parent window316 dom.bind( doc, 'onwheel' in doc ? 'wheel' : 'mousewheel', function( event ) {317 var delta, top,318 docElement = doc.documentElement;319 320 if ( editor.settings.wp_fullscreen ) {321 return;322 }323 // Don't modify scrolling when the editor is not active.324 if ( typeof doc.hasFocus === 'function' && ! doc.hasFocus() ) {325 return;326 }327 328 if ( typeof event.deltaY !== 'undefined' ) {329 delta = event.deltaY;330 331 if ( typeof event.deltaMode !== 'undefined' && event.deltaMode === event.DOM_DELTA_LINE ) {332 delta *= 20;333 }334 } else {335 delta = -event.wheelDelta;336 }337 338 if ( env.webkit ) {339 doc.body.scrollTop += delta;340 } else {341 docElement.scrollTop += delta;342 }343 344 top = docElement.scrollTop || doc.body.scrollTop;345 346 if ( topx === top ) {347 deltax += delta;348 349 window.clearTimeout( reset );350 // Sensitivity: delay before resetting the count of over-scroll pixels351 reset = window.setTimeout( function() {352 deltax = 0;353 }, 1000 );354 } else {355 deltax = 0;356 }357 358 topx = top;359 360 // Sensitivity: scroll the parent window when over-scrolling by more than 1000px361 if ( deltax > 1000 || deltax < -1000 ) {362 return;363 }364 365 event.preventDefault();366 });367 312 } 368 313
Note: See TracChangeset
for help on using the changeset viewer.