Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1257,6 +1257,7 @@ |
1258 | 1258 | $textarea |
1259 | 1259 | .val( replaced ) |
1260 | 1260 | .change() |
| 1261 | + .focus() |
1261 | 1262 | .setSelection( start + corr, end + corr ) |
1262 | 1263 | .scrollToCaretPosition(); |
1263 | 1264 | |
— | — | @@ -1272,7 +1273,7 @@ |
1273 | 1274 | start = text.indexOf( matches[0] ); |
1274 | 1275 | var end = start + matches[0].length; |
1275 | 1276 | var newEnd = start + replaceStr.length; |
1276 | | - $textarea.setSelection( start, end ); |
| 1277 | + $textarea.focus().setSelection( start, end ); |
1277 | 1278 | if ( mode == 'replace' ) { |
1278 | 1279 | $textarea |
1279 | 1280 | .encapsulateSelection( '', replaceStr, '', false, true ) |
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 = 51; |
| 23 | +$wgEditToolbarStyleVersion = 52; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -123,9 +123,10 @@ |
124 | 124 | $(this) |
125 | 125 | .focus( function() { |
126 | 126 | var pos = $(this).data( 'wikiEditor-cursor' ); |
127 | | - if ( typeof pos != 'undefined' ) |
| 127 | + if ( pos ) |
128 | 128 | $(this).setSelection( pos[0], pos[1] ); |
129 | | - }) |
| 129 | + $(this).data( 'wikiEditor-cursor', false ); |
| 130 | + }) |
130 | 131 | .blur( function() { |
131 | 132 | $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) ); |
132 | 133 | }); |
Index: trunk/extensions/UsabilityInitiative/js/tests/wikiEditor.toolbar.js |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | } |
212 | 212 | var messages = [ 'Running tests for wikiEditor API' ]; |
213 | 213 | var $target = $j( textareaId ); |
214 | | - var $ui = $target.data( 'context' ).$ui; |
| 214 | + var $ui = $target.data( 'wikiEditor-context' ).$ui; |
215 | 215 | var passes = 0; |
216 | 216 | var tests = 0; |
217 | 217 | for ( test in wikiEditorTests ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1265,9 +1265,10 @@ |
1266 | 1266 | $(this) |
1267 | 1267 | .focus( function() { |
1268 | 1268 | var pos = $(this).data( 'wikiEditor-cursor' ); |
1269 | | - if ( typeof pos != 'undefined' ) |
| 1269 | + if ( pos ) |
1270 | 1270 | $(this).setSelection( pos[0], pos[1] ); |
1271 | | - }) |
| 1271 | + $(this).data( 'wikiEditor-cursor', false ); |
| 1272 | + }) |
1272 | 1273 | .blur( function() { |
1273 | 1274 | $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) ); |
1274 | 1275 | }); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -83,8 +83,8 @@ |
84 | 84 | $.isOperaBroken=false;else |
85 | 85 | $.isOperaBroken=true;div.remove();} |
86 | 86 | 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);}} |
89 | 89 | 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];}}}}} |
90 | 90 | 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]);}}} |
91 | 91 | 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];} |