Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 9 ), |
75 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
| 75 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 28 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 179 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 52 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 54 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 369 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 370 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 369 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 370 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ), |
18 | 18 | array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ), |
19 | 19 | array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ), |
20 | | - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 78 ), |
| 20 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 79 ), |
21 | 21 | array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 6 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 82 ), |
| 24 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 83 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 82 ), |
| 27 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 83 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1390,6 +1390,7 @@ |
1391 | 1391 | } |
1392 | 1392 | // Preserve whitespace in selection when replacing |
1393 | 1393 | if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
| 1394 | + $j(this).dialog( 'close' ); |
1394 | 1395 | $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), { |
1395 | 1396 | type: 'replace', |
1396 | 1397 | options: { |
— | — | @@ -1400,7 +1401,6 @@ |
1401 | 1402 | // Blank form |
1402 | 1403 | $j( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' ).val( '' ); |
1403 | 1404 | $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).attr( 'checked', '' ); |
1404 | | - $j(this).dialog( 'close' ); |
1405 | 1405 | }, |
1406 | 1406 | 'wikieditor-toolbar-tool-link-cancel': function() { |
1407 | 1407 | $j(this).dialog( 'close' ); |
— | — | @@ -1515,6 +1515,8 @@ |
1516 | 1516 | var insertText = $j( '#wikieditor-toolbar-reference-text' ).val(); |
1517 | 1517 | var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' ); |
1518 | 1518 | var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' ); |
| 1519 | + // Close the dialog |
| 1520 | + $j( this ).dialog( 'close' ); |
1519 | 1521 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1520 | 1522 | $j( this ).data( 'context' ), |
1521 | 1523 | { |
— | — | @@ -1527,12 +1529,8 @@ |
1528 | 1530 | }, |
1529 | 1531 | $j( this ) |
1530 | 1532 | ); |
1531 | | - |
1532 | 1533 | // Restore form state |
1533 | 1534 | $j( '#wikieditor-toolbar-reference-text' ).val( "" ); |
1534 | | - // Close the dialog |
1535 | | - $j( this ).dialog( 'close' ); |
1536 | | - |
1537 | 1535 | }, |
1538 | 1536 | 'wikieditor-toolbar-tool-reference-cancel': function() { |
1539 | 1537 | $j( this ).dialog( 'close' ); |
— | — | @@ -1544,7 +1542,9 @@ |
1545 | 1543 | .$textarea.textSelection( 'getSelection' ); |
1546 | 1544 | // set focus |
1547 | 1545 | $j( '#wikieditor-toolbar-reference-text' ).focus(); |
1548 | | - $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] ); |
| 1546 | + $j( '#wikieditor-toolbar-reference-dialog' ) |
| 1547 | + .data( 'whitespace', [ '', '' ] ) |
| 1548 | + .data( 'attributes', '' ); |
1549 | 1549 | if ( selection != '' ) { |
1550 | 1550 | var matches, text; |
1551 | 1551 | if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) { |
— | — | @@ -1761,6 +1761,7 @@ |
1762 | 1762 | if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) ) |
1763 | 1763 | classes.push( 'sortable' ); |
1764 | 1764 | var classStr = classes.length > 0 ? ' class="' + classes.join( ' ' ) + '"' : ''; |
| 1765 | + $j(this).dialog( 'close' ); |
1765 | 1766 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1766 | 1767 | $j(this).data( 'context' ), |
1767 | 1768 | { |
— | — | @@ -1786,8 +1787,6 @@ |
1787 | 1788 | $j( '#wikieditor-toolbar-table-wikitable' ).click(); |
1788 | 1789 | if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) ) |
1789 | 1790 | $j( '#wikieditor-toolbar-table-sortable' ).click(); |
1790 | | - $j(this).dialog( 'close' ); |
1791 | | - |
1792 | 1791 | }, |
1793 | 1792 | 'wikieditor-toolbar-tool-table-cancel': function() { |
1794 | 1793 | $j(this).dialog( 'close' ); |
— | — | @@ -1965,7 +1964,9 @@ |
1966 | 1965 | 'end': newEnd } ); |
1967 | 1966 | } |
1968 | 1967 | $textarea.textSelection( 'scrollToCaretPosition' ); |
1969 | | - $j(this).data( 'offset', mode == 'replace' ? newEnd : end ); |
| 1968 | + $textarea.textSelection( 'setSelection', { 'start': start, |
| 1969 | + 'end': mode == 'replace' ? newEnd : end } ); |
| 1970 | + $j( this ).data( 'offset', mode == 'replace' ? newEnd : end ); |
1970 | 1971 | var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea; |
1971 | 1972 | textbox.focus(); |
1972 | 1973 | } |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | insertText=escTarget;else if(text=='') |
69 | 69 | insertText='['+escTarget+']';else |
70 | 70 | insertText='['+escTarget+' '+escText+']';} |
71 | | -if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target').change();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
| 71 | +if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target').change();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
72 | 72 | if(typeof text!='undefined') |
73 | 73 | $j('#wikieditor-toolbar-link-int-text').val(text).change();if(typeof target!='undefined') |
74 | 74 | $j('#wikieditor-toolbar-link-int-target').val(target).change();if(typeof type!='undefined') |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | <input type="text" id="wikieditor-toolbar-reference-text" />\ |
85 | 85 | </div>\ |
86 | 86 | </div></fieldset>\ |
87 | | - </div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});},dialog:{dialogClass:'wikiEditor-toolbar-dialog',width:590,buttons:{'wikieditor-toolbar-tool-reference-insert':function(){var insertText=$j('#wikieditor-toolbar-reference-text').val();var whitespace=$j('#wikieditor-toolbar-reference-dialog').data('whitespace');var attributes=$j('#wikieditor-toolbar-reference-dialog').data('attributes');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:whitespace[0]+'<ref'+attributes+'>',peri:insertText,post:'</ref>'+whitespace[1]}},$j(this));$j('#wikieditor-toolbar-reference-text').val("");$j(this).dialog('close');},'wikieditor-toolbar-tool-reference-cancel':function(){$j(this).dialog('close');}},open:function(){var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-reference-text').focus();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var matches,text;if((matches=selection.match(/^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/))){text=matches[3];$j('#wikieditor-toolbar-reference-dialog').data('whitespace',[matches[1],matches[4]]);$j('#wikieditor-toolbar-reference-dialog').data('attributes',matches[2]);}else{text=selection;} |
| 87 | + </div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});},dialog:{dialogClass:'wikiEditor-toolbar-dialog',width:590,buttons:{'wikieditor-toolbar-tool-reference-insert':function(){var insertText=$j('#wikieditor-toolbar-reference-text').val();var whitespace=$j('#wikieditor-toolbar-reference-dialog').data('whitespace');var attributes=$j('#wikieditor-toolbar-reference-dialog').data('attributes');$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:whitespace[0]+'<ref'+attributes+'>',peri:insertText,post:'</ref>'+whitespace[1]}},$j(this));$j('#wikieditor-toolbar-reference-text').val("");},'wikieditor-toolbar-tool-reference-cancel':function(){$j(this).dialog('close');}},open:function(){var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-reference-text').focus();$j('#wikieditor-toolbar-reference-dialog').data('whitespace',['','']).data('attributes','');if(selection!=''){var matches,text;if((matches=selection.match(/^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/))){text=matches[3];$j('#wikieditor-toolbar-reference-dialog').data('whitespace',[matches[1],matches[4]]);$j('#wikieditor-toolbar-reference-dialog').data('attributes',matches[2]);}else{text=selection;} |
88 | 88 | $j('#wikieditor-toolbar-reference-text').val(text);} |
89 | 89 | 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();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}}}},'insert-table':{filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-table-title',id:'wikieditor-toolbar-table-dialog',html:'\ |
90 | 90 | <div class="wikieditor-toolbar-dialog-wrapper">\ |
— | — | @@ -151,10 +151,10 @@ |
152 | 152 | table=table.substr(0,table.length-1)+"\n";} |
153 | 153 | var classes=[];if($j('#wikieditor-toolbar-table-wikitable').is(':checked')) |
154 | 154 | classes.push('wikitable');if($j('#wikieditor-toolbar-table-sortable').is(':checked')) |
155 | | -classes.push('sortable');var classStr=classes.length>0?' class="'+classes.join(' ')+'"':'';$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:'{|'+classStr+"\n",peri:table,post:'|}',ownline:true}},$j(this));$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);if(!$j('#wikieditor-toolbar-table-dimensions-header').is(':checked')) |
| 155 | +classes.push('sortable');var classStr=classes.length>0?' class="'+classes.join(' ')+'"':'';$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:'{|'+classStr+"\n",peri:table,post:'|}',ownline:true}},$j(this));$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);if(!$j('#wikieditor-toolbar-table-dimensions-header').is(':checked')) |
156 | 156 | $j('#wikieditor-toolbar-table-dimensions-header').click();if(!$j('#wikieditor-toolbar-table-wikitable').is(':checked')) |
157 | 157 | $j('#wikieditor-toolbar-table-wikitable').click();if($j('#wikieditor-toolbar-table-sortable').is(':checked')) |
158 | | -$j('#wikieditor-toolbar-table-sortable').click();$j(this).dialog('close');},'wikieditor-toolbar-tool-table-cancel':function(){$j(this).dialog('close');}},open:function(){$j('#wikieditor-toolbar-table-dimensions-rows').focus();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();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}}}},'search-and-replace':{'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]}},filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\ |
| 158 | +$j('#wikieditor-toolbar-table-sortable').click();},'wikieditor-toolbar-tool-table-cancel':function(){$j(this).dialog('close');}},open:function(){$j('#wikieditor-toolbar-table-dimensions-rows').focus();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();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}}}},'search-and-replace':{'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]}},filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\ |
159 | 159 | <div id="wikieditor-toolbar-replace-message">\ |
160 | 160 | <div id="wikieditor-toolbar-replace-nomatch" rel="wikieditor-toolbar-tool-replace-nomatch"></div>\ |
161 | 161 | <div id="wikieditor-toolbar-replace-success"></div>\ |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | if(!match){$j('#wikieditor-toolbar-replace-nomatch').show();}else if(mode=='replaceAll'){var index;for(var i=0;i<match.length;i++){index=s.indexOf(match[i]);if(index==-1){break;} |
190 | 190 | s=s.substr(index+match[i].length);var start=index+offset;var end=start+match[i].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end}).textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});offset=newEnd;} |
191 | 191 | $j('#wikieditor-toolbar-replace-success').text(u.getMsg('wikieditor-toolbar-tool-replace-success',match.length)).show();$j(this).data('offset',0);}else{var start=match.index+offset;var end=start+match[0].length;var newEnd=start+replaceStr.length;var context=$j(this).data('context');$textarea.textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});} |
192 | | -$textarea.textSelection('scrollToCaretPosition');$j(this).data('offset',mode=='replace'?newEnd:end);var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow:$textarea;textbox.focus();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-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);});} |
| 192 | +$textarea.textSelection('scrollToCaretPosition');$textarea.textSelection('setSelection',{'start':start,'end':mode=='replace'?newEnd:end});$j(this).data('offset',mode=='replace'?newEnd:end);var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow:$textarea;textbox.focus();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-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);});} |
193 | 193 | var dialog=$j(this).closest('.ui-dialog');var that=this;var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).unbind('keypress.srdialog');$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;} |
194 | 194 | if(wgNamespaceNumber==10){return true;} |
195 | 195 | if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}}); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -1341,6 +1341,7 @@ |
1342 | 1342 | } |
1343 | 1343 | // Preserve whitespace in selection when replacing |
1344 | 1344 | if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
| 1345 | + $j(this).dialog( 'close' ); |
1345 | 1346 | $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), { |
1346 | 1347 | type: 'replace', |
1347 | 1348 | options: { |
— | — | @@ -1351,7 +1352,6 @@ |
1352 | 1353 | // Blank form |
1353 | 1354 | $j( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' ).val( '' ); |
1354 | 1355 | $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).attr( 'checked', '' ); |
1355 | | - $j(this).dialog( 'close' ); |
1356 | 1356 | }, |
1357 | 1357 | 'wikieditor-toolbar-tool-link-cancel': function() { |
1358 | 1358 | $j(this).dialog( 'close' ); |
— | — | @@ -1466,6 +1466,8 @@ |
1467 | 1467 | var insertText = $j( '#wikieditor-toolbar-reference-text' ).val(); |
1468 | 1468 | var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' ); |
1469 | 1469 | var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' ); |
| 1470 | + // Close the dialog |
| 1471 | + $j( this ).dialog( 'close' ); |
1470 | 1472 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1471 | 1473 | $j( this ).data( 'context' ), |
1472 | 1474 | { |
— | — | @@ -1478,12 +1480,8 @@ |
1479 | 1481 | }, |
1480 | 1482 | $j( this ) |
1481 | 1483 | ); |
1482 | | - |
1483 | 1484 | // Restore form state |
1484 | 1485 | $j( '#wikieditor-toolbar-reference-text' ).val( "" ); |
1485 | | - // Close the dialog |
1486 | | - $j( this ).dialog( 'close' ); |
1487 | | - |
1488 | 1486 | }, |
1489 | 1487 | 'wikieditor-toolbar-tool-reference-cancel': function() { |
1490 | 1488 | $j( this ).dialog( 'close' ); |
— | — | @@ -1495,7 +1493,9 @@ |
1496 | 1494 | .$textarea.textSelection( 'getSelection' ); |
1497 | 1495 | // set focus |
1498 | 1496 | $j( '#wikieditor-toolbar-reference-text' ).focus(); |
1499 | | - $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] ); |
| 1497 | + $j( '#wikieditor-toolbar-reference-dialog' ) |
| 1498 | + .data( 'whitespace', [ '', '' ] ) |
| 1499 | + .data( 'attributes', '' ); |
1500 | 1500 | if ( selection != '' ) { |
1501 | 1501 | var matches, text; |
1502 | 1502 | if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) { |
— | — | @@ -1712,6 +1712,7 @@ |
1713 | 1713 | if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) ) |
1714 | 1714 | classes.push( 'sortable' ); |
1715 | 1715 | var classStr = classes.length > 0 ? ' class="' + classes.join( ' ' ) + '"' : ''; |
| 1716 | + $j(this).dialog( 'close' ); |
1716 | 1717 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1717 | 1718 | $j(this).data( 'context' ), |
1718 | 1719 | { |
— | — | @@ -1737,8 +1738,6 @@ |
1738 | 1739 | $j( '#wikieditor-toolbar-table-wikitable' ).click(); |
1739 | 1740 | if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) ) |
1740 | 1741 | $j( '#wikieditor-toolbar-table-sortable' ).click(); |
1741 | | - $j(this).dialog( 'close' ); |
1742 | | - |
1743 | 1742 | }, |
1744 | 1743 | 'wikieditor-toolbar-tool-table-cancel': function() { |
1745 | 1744 | $j(this).dialog( 'close' ); |
— | — | @@ -1916,7 +1915,9 @@ |
1917 | 1916 | 'end': newEnd } ); |
1918 | 1917 | } |
1919 | 1918 | $textarea.textSelection( 'scrollToCaretPosition' ); |
1920 | | - $j(this).data( 'offset', mode == 'replace' ? newEnd : end ); |
| 1919 | + $textarea.textSelection( 'setSelection', { 'start': start, |
| 1920 | + 'end': mode == 'replace' ? newEnd : end } ); |
| 1921 | + $j( this ).data( 'offset', mode == 'replace' ? newEnd : end ); |
1921 | 1922 | var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea; |
1922 | 1923 | textbox.focus(); |
1923 | 1924 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -227,7 +227,10 @@ |
228 | 228 | } else if ( document.body.createTextRange ) { |
229 | 229 | var selection = document.body.createTextRange(); |
230 | 230 | selection.moveToElementText( this ); |
231 | | - var length = selection.text.length; |
| 231 | + var length = this.value.length; |
| 232 | + // IE doesn't count \n when computing the offset, so we won't either |
| 233 | + var newLines = this.value.match( /\n/g ); |
| 234 | + if ( newLines) length = length - newLines.length; |
232 | 235 | selection.moveStart( 'character', options.start ); |
233 | 236 | selection.moveEnd( 'character', -length + options.end ); |
234 | 237 | selection.select(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -15,10 +15,7 @@ |
16 | 16 | 'browsers': { |
17 | 17 | // Left-to-right languages |
18 | 18 | 'ltr': { |
19 | | - // HORRIBLE HACK |
20 | | - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea |
21 | | - 'msie': false, |
22 | | - // END OF HORRIBLE HACK |
| 19 | + 'msie': [['>=', 7]], |
23 | 20 | // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4 |
24 | 21 | 'firefox': [ |
25 | 22 | ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4'] |
— | — | @@ -29,10 +26,7 @@ |
30 | 27 | }, |
31 | 28 | // Right-to-left languages |
32 | 29 | 'rtl': { |
33 | | - // HORRIBLE HACK |
34 | | - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea |
35 | | - 'msie': false, |
36 | | - // END OF HORRIBLE HACK |
| 30 | + 'msie': [['>=', 7]], |
37 | 31 | // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4 |
38 | 32 | 'firefox': [ |
39 | 33 | ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4'] |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6394,7 +6394,10 @@ |
6395 | 6395 | } else if ( document.body.createTextRange ) { |
6396 | 6396 | var selection = document.body.createTextRange(); |
6397 | 6397 | selection.moveToElementText( this ); |
6398 | | - var length = selection.text.length; |
| 6398 | + var length = this.value.length; |
| 6399 | + // IE doesn't count \n when computing the offset, so we won't either |
| 6400 | + var newLines = this.value.match( /\n/g ); |
| 6401 | + if ( newLines) length = length - newLines.length; |
6399 | 6402 | selection.moveStart( 'character', options.start ); |
6400 | 6403 | selection.moveEnd( 'character', -length + options.end ); |
6401 | 6404 | selection.select(); |
— | — | @@ -8375,10 +8378,7 @@ |
8376 | 8379 | 'browsers': { |
8377 | 8380 | // Left-to-right languages |
8378 | 8381 | 'ltr': { |
8379 | | - // HORRIBLE HACK |
8380 | | - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea |
8381 | | - 'msie': false, |
8382 | | - // END OF HORRIBLE HACK |
| 8382 | + 'msie': [['>=', 7]], |
8383 | 8383 | // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4 |
8384 | 8384 | 'firefox': [ |
8385 | 8385 | ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4'] |
— | — | @@ -8389,10 +8389,7 @@ |
8390 | 8390 | }, |
8391 | 8391 | // Right-to-left languages |
8392 | 8392 | 'rtl': { |
8393 | | - // HORRIBLE HACK |
8394 | | - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea |
8395 | | - 'msie': false, |
8396 | | - // END OF HORRIBLE HACK |
| 8393 | + 'msie': [['>=', 7]], |
8397 | 8394 | // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4 |
8398 | 8395 | 'firefox': [ |
8399 | 8396 | ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4'] |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -430,7 +430,7 @@ |
431 | 431 | if(!postFinished){if(postRange.compareEndPoints("StartToEnd",postRange)==0){postFinished=true;}else{postRange.moveEnd("character",-1) |
432 | 432 | if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;endPos=caretPos+rawPeriText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;endPos=e.selectionEnd;} |
433 | 433 | return options.startAndEnd?[caretPos,endPos]:caretPos;} |
434 | | -return getCaret(this.get(0));},setSelection:function(options){return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){if(options.start>this.selectionEnd){this.selectionEnd=options.end;this.selectionStart=options.start;}else{this.selectionStart=options.start;this.selectionEnd=options.end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',options.start);selection.moveEnd('character',-length+options.end);selection.select();}});},scrollToCaretPosition:function(options){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
| 434 | +return getCaret(this.get(0));},setSelection:function(options){return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){if(options.start>this.selectionEnd){this.selectionEnd=options.end;this.selectionStart=options.start;}else{this.selectionStart=options.start;this.selectionEnd=options.end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=this.value.length;var newLines=this.value.match(/\n/g);if(newLines)length=length-newLines.length;selection.moveStart('character',options.start);selection.moveEnd('character',-length+options.end);selection.select();}});},scrollToCaretPosition:function(options){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
435 | 435 | function getCaretScrollPosition(e){var text=e.value.replace(/\r/g,"");var caret=$(e).textSelection('getCaretPosition');var lineLength=getLineLength(e);var row=0;var charInLine=0;var lastSpaceInLine=0;for(i=0;i<caret;i++){charInLine++;if(text.charAt(i)==" "){lastSpaceInLine=charInLine;}else if(text.charAt(i)=="\n"){lastSpaceInLine=0;charInLine=0;row++;} |
436 | 436 | if(charInLine>lineLength){if(lastSpaceInLine>0){charInLine=charInLine-lastSpaceInLine;lastSpaceInLine=0;row++;}}} |
437 | 437 | var nextSpace=0;for(j=caret;j<caret+lineLength;j++){if(text.charAt(j)==" "||text.charAt(j)=="\n"||caret==text.length){nextSpace=j;break;}} |
— | — | @@ -580,7 +580,7 @@ |
581 | 581 | var args=$.makeArray(arguments);if(typeof context.$iframe==='undefined'&&args[0]=='addModule'&&typeof args[1]!='undefined'){var modules=args[1];if(typeof modules!="object"){modules={};modules[args[1]]='';} |
582 | 582 | for(module in modules){if(module in $.wikiEditor.modules&&$.wikiEditor.isSupported($.wikiEditor.modules[module])&&$.wikiEditor.isRequired($.wikiEditor.modules[module],'iframe')){context.fn.setupIframe();break;}}} |
583 | 583 | if(args.length>0){var call=args.shift();if(call in context.api){context.api[call](context,typeof args[0]=='undefined'?{}:args[0]);}} |
584 | | -return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={'browsers':{'ltr':{'msie':false,'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':false,'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]}},api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} |
| 584 | +return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]}},api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} |
585 | 585 | mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(mod in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[mod];var filtered=false;if(typeof module.filters!='undefined'){for(var i=0;i<module.filters.length;i++){if($(module.filters[i]).length==0){filtered=true;break;}}} |
586 | 586 | if(!filtered&&$.wikiEditor.isSupported(module)&&$('#'+module.id).size()==0){if(typeof context.$iframe=='undefined'&&$.wikiEditor.isRequired(module,'iframe')){context.fn.setupIframe();} |
587 | 587 | var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |