Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1138,7 +1138,7 @@ |
1139 | 1139 | $j(this).data( 'articlePathRegex', new RegExp( |
1140 | 1140 | '^' + RegExp.escape( wgServer + wgArticlePath ) |
1141 | 1141 | .replace( /\\\$1/g, '(.*)' ) + '$' |
1142 | | - ) ); |
| 1142 | + ) ); |
1143 | 1143 | // Pre-fill the text fields based on the current selection |
1144 | 1144 | var selection = $j(this).data( 'context' ).$textarea.getSelection(); |
1145 | 1145 | $j( '#edittoolbar-link-int-target' ).focus(); |
— | — | @@ -1516,8 +1516,8 @@ |
1517 | 1517 | $j(this).data( 'offset', 0 ); |
1518 | 1518 | $j( '#edittoolbar-replace-search' ).focus(); |
1519 | 1519 | $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1520 | | - if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
1521 | | - $j(this).data( 'dialogkeypressset', true ); |
| 1520 | + if ( !( $j(this).data( 'onetimeonlystuff' ) ) ) { |
| 1521 | + $j(this).data( 'onetimeonlystuff', true ); |
1522 | 1522 | // Execute the action associated with the first button |
1523 | 1523 | // when the user presses Enter |
1524 | 1524 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
— | — | @@ -1527,6 +1527,11 @@ |
1528 | 1528 | e.preventDefault(); |
1529 | 1529 | } |
1530 | 1530 | }); |
| 1531 | + // Make tabbing to a button and pressing |
| 1532 | + // Enter do what people expect |
| 1533 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1534 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1535 | + }); |
1531 | 1536 | } |
1532 | 1537 | var dialog = $j(this).closest( '.ui-dialog' ); |
1533 | 1538 | $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.min.js |
— | — | @@ -151,5 +151,5 @@ |
152 | 152 | matches=text.match(regex);if(!matches) |
153 | 153 | $j('#edittoolbar-replace-nomatch').show();else if(mode=='replaceAll'){var start=text.lastIndexOf(matches[matches.length-1]);var end=start+replaceStr.length;var replaced=text.replace(regex,replaceStr);var corr=replaced.length-text.length-replaceStr.length+matches[matches.length-1].length;$textarea.val(replaced).change().focus().setSelection(start+corr,end+corr).scrollToCaretPosition();$j('#edittoolbar-replace-success').text(gM('edittoolbar-tool-replace-success',matches.length)).show();$j(this).data('offset',0);}else{var start=text.indexOf(matches[0],$j(this).data('offset'));if(start==-1) |
154 | 154 | start=text.indexOf(matches[0]);var end=start+matches[0].length;var newEnd=start+replaceStr.length;$textarea.focus().setSelection(start,end);if(mode=='replace'){$textarea.encapsulateSelection('',replaceStr,'',false,true).setSelection(start,newEnd);} |
155 | | -$textarea.scrollToCaretPosition();$j(this).data('offset',mode=='replace'?newEnd:end);}});},dialog:{buttons:{'edittoolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'edittoolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'edittoolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'edittoolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#edittoolbar-replace-search').focus();$j('#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex').hide();if(!($j(this).data('dialogkeypressset'))){$j(this).data('dialogkeypressset',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});} |
| 155 | +$textarea.scrollToCaretPosition();$j(this).data('offset',mode=='replace'?newEnd:end);}});},dialog:{buttons:{'edittoolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'edittoolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'edittoolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'edittoolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#edittoolbar-replace-search').focus();$j('#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});} |
156 | 156 | var dialog=$j(this).closest('.ui-dialog');$j(this).data('context').$textarea.bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}});},close:function(){$j(this).data('context').$textarea.unbind('keypress.srdialog').focus();$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}}); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 70; |
| 23 | +$wgEditToolbarStyleVersion = 71; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |