r57424 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57423‎ | r57424 | r57425 >
Date:12:55, 6 October 2009
Author:catrope
Status:ok
Tags:
Comment:
EditToolbar: (bug 21013, bug 21014, bug 21018) Fix some weird replacenext-related regressions from r57409
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.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)
  • /trunk/extensions/UsabilityInitiative/js/tests/wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -1257,6 +1257,7 @@
12581258 $textarea
12591259 .val( replaced )
12601260 .change()
 1261+ .focus()
12611262 .setSelection( start + corr, end + corr )
12621263 .scrollToCaretPosition();
12631264
@@ -1272,7 +1273,7 @@
12731274 start = text.indexOf( matches[0] );
12741275 var end = start + matches[0].length;
12751276 var newEnd = start + replaceStr.length;
1276 - $textarea.setSelection( start, end );
 1277+ $textarea.focus().setSelection( start, end );
12771278 if ( mode == 'replace' ) {
12781279 $textarea
12791280 .encapsulateSelection( '', replaceStr, '', false, true )
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 51;
 23+$wgEditToolbarStyleVersion = 52;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -123,9 +123,10 @@
124124 $(this)
125125 .focus( function() {
126126 var pos = $(this).data( 'wikiEditor-cursor' );
127 - if ( typeof pos != 'undefined' )
 127+ if ( pos )
128128 $(this).setSelection( pos[0], pos[1] );
129 - })
 129+ $(this).data( 'wikiEditor-cursor', false );
 130+ })
130131 .blur( function() {
131132 $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) );
132133 });
Index: trunk/extensions/UsabilityInitiative/js/tests/wikiEditor.toolbar.js
@@ -210,7 +210,7 @@
211211 }
212212 var messages = [ 'Running tests for wikiEditor API' ];
213213 var $target = $j( textareaId );
214 - var $ui = $target.data( 'context' ).$ui;
 214+ var $ui = $target.data( 'wikiEditor-context' ).$ui;
215215 var passes = 0;
216216 var tests = 0;
217217 for ( test in wikiEditorTests ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1265,9 +1265,10 @@
12661266 $(this)
12671267 .focus( function() {
12681268 var pos = $(this).data( 'wikiEditor-cursor' );
1269 - if ( typeof pos != 'undefined' )
 1269+ if ( pos )
12701270 $(this).setSelection( pos[0], pos[1] );
1271 - })
 1271+ $(this).data( 'wikiEditor-cursor', false );
 1272+ })
12721273 .blur( function() {
12731274 $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) );
12741275 });
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -83,8 +83,8 @@
8484 $.isOperaBroken=false;else
8585 $.isOperaBroken=true;div.remove();}
8686 if($.isOperaBroken)
87 -s=s.replace(/\n/g,"\r\n");return s;};$.fn.wikiEditor=function(){var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));$(this).focus(function(){var pos=$(this).data('wikiEditor-cursor');if(typeof pos!='undefined')
88 -$(this).setSelection(pos[0],pos[1]);}).blur(function(){$(this).data('wikiEditor-cursor',$(this).getCaretPosition(true));});context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
 87+s=s.replace(/\n/g,"\r\n");return s;};$.fn.wikiEditor=function(){var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));$(this).focus(function(){var pos=$(this).data('wikiEditor-cursor');if(pos)
 88+$(this).setSelection(pos[0],pos[1]);$(this).data('wikiEditor-cursor',false);}).blur(function(){$(this).data('wikiEditor-cursor',$(this).getCaretPosition(true));});context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
8989 if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}}
9090 if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}}}
9191 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}

Follow-up revisions

RevisionCommit summaryAuthorDate
r57719wmf-deployment: Merge babaco fixes from trunk...catrope20:20, 14 October 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57409EditToolbar: (bug 20900) Tables inserted on top regardless of cursor position...catrope21:43, 5 October 2009

Status & tagging log