r62198 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62197‎ | r62198 | r62199 >
Date:21:30, 9 February 2010
Author:nimishg
Status:ok (Comments)
Tags:
Comment:
bind ctrl+v to paste for IE
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -304,7 +304,7 @@
305305 break;
306306 // Intercept all tab events to provide consisten behavior across browsers
307307 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
308 - case 9:
 308+ case 9: //tab
309309 // if any modifier keys are pressed, allow the browser to do it's thing
310310 if ( event.ctrlKey || event.altKey || event.shiftKey ) {
311311 return true;
@@ -321,6 +321,12 @@
322322 return false;
323323 }
324324 break;
 325+ case 86: //v
 326+ if ( event.ctrlKey ){
 327+ //paste, intercepted for IE
 328+ context.evt.paste( event );
 329+ }
 330+ break;
325331 }
326332 return true;
327333 },
@@ -1290,10 +1296,10 @@
12911297 .bind( 'paste', function( event ) {
12921298 return context.fn.trigger( 'paste', event );
12931299 } )
1294 - .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 1300+ .bind( 'keyup paste mouseup cut encapsulateSelection', function( event ) {
12951301 return context.fn.trigger( 'change', event );
12961302 } )
1297 - .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 1303+ .delayedBind( 250, 'keyup paste mouseup cut encapsulateSelection', function( event ) {
12981304 context.fn.trigger( 'delayedChange', event );
12991305 } );
13001306 } );

Comments

#Comment by Catrope (talk | contribs)   11:31, 10 February 2010

Is this done because IE doesn't throw the paste event when Ctrl+V is pressed? How does this work with right-clicking in the edit box and choosing paste?

#Comment by Nimish Gautam (talk | contribs)   18:04, 10 February 2010

Yeah, IE doesn't send "paste", and right-click paste or menu bar paste will have the same problems

Status & tagging log