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' => 73), |
| 20 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 74 ), |
21 | 21 | array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 6 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 77 ), |
| 24 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 78 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 77 ), |
| 27 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 78 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1442,15 +1442,15 @@ |
1443 | 1443 | 'wikieditor-toolbar-tool-reference-insert': function() { |
1444 | 1444 | var insertText = $j( '#wikieditor-toolbar-reference-text' ).val(); |
1445 | 1445 | var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' ); |
1446 | | - if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
| 1446 | + var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' ); |
1447 | 1447 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1448 | 1448 | $j( this ).data( 'context' ), |
1449 | 1449 | { |
1450 | 1450 | type: 'replace', |
1451 | 1451 | options: { |
1452 | | - pre: '<ref>', |
| 1452 | + pre: whitespace[0] + '<ref' + attributes + '>', |
1453 | 1453 | peri: insertText, |
1454 | | - post: '</ref>' |
| 1454 | + post: '</ref>' + whitespace[1] |
1455 | 1455 | } |
1456 | 1456 | }, |
1457 | 1457 | $j( this ) |
— | — | @@ -1472,13 +1472,14 @@ |
1473 | 1473 | .$textarea.textSelection( 'getSelection' ); |
1474 | 1474 | // set focus |
1475 | 1475 | $j( '#wikieditor-toolbar-reference-text' ).focus(); |
| 1476 | + $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] ); |
1476 | 1477 | if ( selection != '' ) { |
1477 | 1478 | var matches, text; |
1478 | | - if ( ( matches = selection.match( /^(\s*)(<ref\>)([^\<]+)?(<\/ref\>)(\s*)$/ ) ) ) { |
1479 | | - // <ref>foo</ref> |
| 1479 | + if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) { |
1480 | 1480 | text = matches[3]; |
1481 | 1481 | // Preserve whitespace when replacing |
1482 | | - $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
| 1482 | + $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace', [ matches[1], matches[4] ] ); |
| 1483 | + $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes', matches[2] ); |
1483 | 1484 | } else { |
1484 | 1485 | text = selection; |
1485 | 1486 | } |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -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');if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:'<ref>',peri:insertText,post:'</ref>'}},$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();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[5]]);}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.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;} |
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">\ |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -1393,15 +1393,15 @@ |
1394 | 1394 | 'wikieditor-toolbar-tool-reference-insert': function() { |
1395 | 1395 | var insertText = $j( '#wikieditor-toolbar-reference-text' ).val(); |
1396 | 1396 | var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' ); |
1397 | | - if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
| 1397 | + var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' ); |
1398 | 1398 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1399 | 1399 | $j( this ).data( 'context' ), |
1400 | 1400 | { |
1401 | 1401 | type: 'replace', |
1402 | 1402 | options: { |
1403 | | - pre: '<ref>', |
| 1403 | + pre: whitespace[0] + '<ref' + attributes + '>', |
1404 | 1404 | peri: insertText, |
1405 | | - post: '</ref>' |
| 1405 | + post: '</ref>' + whitespace[1] |
1406 | 1406 | } |
1407 | 1407 | }, |
1408 | 1408 | $j( this ) |
— | — | @@ -1423,13 +1423,14 @@ |
1424 | 1424 | .$textarea.textSelection( 'getSelection' ); |
1425 | 1425 | // set focus |
1426 | 1426 | $j( '#wikieditor-toolbar-reference-text' ).focus(); |
| 1427 | + $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] ); |
1427 | 1428 | if ( selection != '' ) { |
1428 | 1429 | var matches, text; |
1429 | | - if ( ( matches = selection.match( /^(\s*)(<ref\>)([^\<]+)?(<\/ref\>)(\s*)$/ ) ) ) { |
1430 | | - // <ref>foo</ref> |
| 1430 | + if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) { |
1431 | 1431 | text = matches[3]; |
1432 | 1432 | // Preserve whitespace when replacing |
1433 | | - $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
| 1433 | + $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace', [ matches[1], matches[4] ] ); |
| 1434 | + $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes', matches[2] ); |
1434 | 1435 | } else { |
1435 | 1436 | text = selection; |
1436 | 1437 | } |