r62709 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62708‎ | r62709 | r62710 >
Date:15:58, 19 February 2010
Author:adam
Status:ok
Tags:
Comment:
Follow up to r62685, incorporating Roan's comments
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 143 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 144 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 34 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 49 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 17 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 270 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 271 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 270 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 271 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -308,11 +308,15 @@
309309 'keydown': function( event ) {
310310 switch ( event.which ) {
311311 case 90: // z
312 - if ( ( event.ctrlKey || event.metaKey ) && context.history.length ) {
 312+ case 89: // y
 313+ if ( event.which == 89 && !$.browser.msie ) {
 314+ // only handle y events for IE
 315+ return true;
 316+ } else if ( ( event.ctrlKey || event.metaKey ) && context.history.length ) {
313317 // HistoryPosition is a negative number between -1 and -context.history.length, in other words
314318 // it's the number of steps backwards from the latest state.
315319 var newPosition;
316 - if ( event.shiftKey ) {
 320+ if ( event.shiftKey || event.which == 89 ) {
317321 // Redo
318322 newPosition = context.historyPosition + 1;
319323 } else {
@@ -342,32 +346,6 @@
343347 return false;
344348 }
345349 break;
346 - case 89: //y
347 - // ctrl + y handler for IE
348 - if ( ( event.ctrlKey || event.metaKey ) && context.history.length && $.browser.msie ) {
349 - newPosition = context.historyPosition + 1;
350 - // Only act if we are switching to a valid state
351 - if ( newPosition >= ( context.history.length * -1 ) && newPosition < 0 ) {
352 - // Make sure we run the history storing code before we make this change
353 - context.fn.updateHistory( context.oldDelayedHTML != context.$content.html() );
354 - context.oldDelayedHistoryPosition = context.historyPosition;
355 - context.historyPosition = newPosition;
356 - // Change state
357 - // FIXME: Destroys event handlers, will be a problem with template folding
358 - context.$content.html(
359 - context.history[context.history.length + context.historyPosition].html
360 - );
361 - context.fn.purgeOffsets();
362 - if( context.history[context.history.length + context.historyPosition].sel ) {
363 - context.fn.setSelection( {
364 - start: context.history[context.history.length + context.historyPosition].sel[0],
365 - end: context.history[context.history.length + context.historyPosition].sel[1]
366 - } );
367 - }
368 - }
369 - }
370 - return false;
371 - break;
372350 // Intercept all tab events to provide consisten behavior across browsers
373351 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
374352 case 9: //tab
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6741,11 +6741,15 @@
67426742 'keydown': function( event ) {
67436743 switch ( event.which ) {
67446744 case 90: // z
6745 - if ( ( event.ctrlKey || event.metaKey ) && context.history.length ) {
 6745+ case 89: // y
 6746+ if ( event.which == 89 && !$.browser.msie ) {
 6747+ // only handle y events for IE
 6748+ return true;
 6749+ } else if ( ( event.ctrlKey || event.metaKey ) && context.history.length ) {
67466750 // HistoryPosition is a negative number between -1 and -context.history.length, in other words
67476751 // it's the number of steps backwards from the latest state.
67486752 var newPosition;
6749 - if ( event.shiftKey ) {
 6753+ if ( event.shiftKey || event.which == 89 ) {
67506754 // Redo
67516755 newPosition = context.historyPosition + 1;
67526756 } else {
@@ -6775,32 +6779,6 @@
67766780 return false;
67776781 }
67786782 break;
6779 - case 89: //y
6780 - // ctrl + y handler for IE
6781 - if ( ( event.ctrlKey || event.metaKey ) && context.history.length && $.browser.msie ) {
6782 - newPosition = context.historyPosition + 1;
6783 - // Only act if we are switching to a valid state
6784 - if ( newPosition >= ( context.history.length * -1 ) && newPosition < 0 ) {
6785 - // Make sure we run the history storing code before we make this change
6786 - context.fn.updateHistory( context.oldDelayedHTML != context.$content.html() );
6787 - context.oldDelayedHistoryPosition = context.historyPosition;
6788 - context.historyPosition = newPosition;
6789 - // Change state
6790 - // FIXME: Destroys event handlers, will be a problem with template folding
6791 - context.$content.html(
6792 - context.history[context.history.length + context.historyPosition].html
6793 - );
6794 - context.fn.purgeOffsets();
6795 - if( context.history[context.history.length + context.historyPosition].sel ) {
6796 - context.fn.setSelection( {
6797 - start: context.history[context.history.length + context.historyPosition].sel[0],
6798 - end: context.history[context.history.length + context.historyPosition].sel[1]
6799 - } );
6800 - }
6801 - }
6802 - }
6803 - return false;
6804 - break;
68056783 // Intercept all tab events to provide consisten behavior across browsers
68066784 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
68076785 case 9: //tab
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -446,11 +446,10 @@
447447 return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);}
448448 var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'oldDelayedSel':null,'savedSelection':null,'history':[],'historyPosition':-1,'oldDelayedHistoryPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;}
449449 for(var module in modules){if(typeof module=='string'&&$.wikiEditor.isSupported(module)){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
450 -if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 90:if((event.ctrlKey||event.metaKey)&&context.history.length){var newPosition;if(event.shiftKey){newPosition=context.historyPosition+1;}else{newPosition=context.historyPosition-1;}
 450+if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 90:case 89:if(event.which==89&&!$.browser.msie){return true;}else if((event.ctrlKey||event.metaKey)&&context.history.length){var newPosition;if(event.shiftKey||event.which==89){newPosition=context.historyPosition+1;}else{newPosition=context.historyPosition-1;}
451451 if(newPosition>=(context.history.length*-1)&&newPosition<0){context.fn.updateHistory(context.oldDelayedHTML!=context.$content.html());context.oldDelayedHistoryPosition=context.historyPosition;context.historyPosition=newPosition;context.$content.html(context.history[context.history.length+context.historyPosition].html);context.fn.purgeOffsets();if(context.history[context.history.length+context.historyPosition].sel){context.fn.setSelection({start:context.history[context.history.length+context.historyPosition].sel[0],end:context.history[context.history.length+context.historyPosition].sel[1]});}}
452452 return false;}
453 -break;case 89:if((event.ctrlKey||event.metaKey)&&context.history.length&&$.browser.msie){newPosition=context.historyPosition+1;if(newPosition>=(context.history.length*-1)&&newPosition<0){context.fn.updateHistory(context.oldDelayedHTML!=context.$content.html());context.oldDelayedHistoryPosition=context.historyPosition;context.historyPosition=newPosition;context.$content.html(context.history[context.history.length+context.historyPosition].html);context.fn.purgeOffsets();if(context.history[context.history.length+context.historyPosition].sel){context.fn.setSelection({start:context.history[context.history.length+context.historyPosition].sel[0],end:context.history[context.history.length+context.historyPosition].sel[1]});}}}
454 -return false;break;case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
 453+break;case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
455454 return false;}
456455 break;case 86:if(event.ctrlKey){context.evt.paste(event);}
457456 break;}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62685WikiEditor - adding a ctrl+y handler for REDO in IEadam00:49, 19 February 2010

Status & tagging log