Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | array( |
37 | 37 | 'src' => 'Modules/Toolbar/Toolbar.js', |
38 | 38 | 'class' => 'wikiEditor.config.toolbar', |
39 | | - 'version' => 24 |
| 39 | + 'version' => 25 |
40 | 40 | ), |
41 | 41 | array( |
42 | 42 | 'src' => 'Modules/TemplateEditor/TemplateEditor.js', |
— | — | @@ -44,10 +44,10 @@ |
45 | 45 | ), |
46 | 46 | ), |
47 | 47 | 'combined' => array( |
48 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 26 ), |
| 48 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 27 ), |
49 | 49 | ), |
50 | 50 | 'minified' => array( |
51 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 26 ), |
| 51 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 27 ), |
52 | 52 | ), |
53 | 53 | ); |
54 | 54 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1526,12 +1526,17 @@ |
1527 | 1527 | // when the user presses Enter |
1528 | 1528 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1529 | 1529 | if ( ( e.keyCode || e.which ) == 13 ) { |
1530 | | - $j(this) |
1531 | | - .find( 'button:first' ) |
1532 | | - .click(); |
| 1530 | + var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
| 1531 | + button.click(); |
1533 | 1532 | e.preventDefault(); |
1534 | 1533 | } |
1535 | 1534 | }); |
| 1535 | + |
| 1536 | + // Make tabbing to a button and pressing |
| 1537 | + // Enter do what people expect |
| 1538 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1539 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1540 | + }); |
1536 | 1541 | } |
1537 | 1542 | } |
1538 | 1543 | } |
— | — | @@ -1730,12 +1735,17 @@ |
1731 | 1736 | // when the user presses Enter |
1732 | 1737 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1733 | 1738 | if ( ( e.keyCode || e.which ) == 13 ) { |
1734 | | - $j(this) |
1735 | | - .find( 'button:first' ) |
1736 | | - .click(); |
| 1739 | + var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
| 1740 | + button.click(); |
1737 | 1741 | e.preventDefault(); |
1738 | 1742 | } |
1739 | 1743 | }); |
| 1744 | + |
| 1745 | + // Make tabbing to a button and pressing |
| 1746 | + // Enter do what people expect |
| 1747 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1748 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1749 | + }); |
1740 | 1750 | } |
1741 | 1751 | } |
1742 | 1752 | } |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $j('#wikieditor-toolbar-link-int-target').val(target).change();if(typeof type!='undefined') |
74 | 74 | $j('#wikieditor-toolbar-link-'+type).attr('checked','checked');} |
75 | 75 | $j('#wikieditor-toolbar-link-int-text').data('untouched',$j('#wikieditor-toolbar-link-int-text').val()==$j('#wikieditor-toolbar-link-int-target').val());$j('#wikieditor-toolbar-link-int-target').suggestions();$j('#wikieditor-toolbar-link-int-text, #wikiedit-toolbar-link-int-target').each(function(){if($j(this).val()=='') |
76 | | -$j(this).parent().find('label').show();});if(!($j(this).data('dialogkeypressset'))){$j(this).data('dialogkeypressset',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){$j(this).find('button:first').click();e.preventDefault();}});}}}},'insert-table':{titleMsg:'wikieditor-toolbar-tool-table-title',id:'wikieditor-toolbar-table-dialog',html:'\ |
| 76 | +$j(this).parent().find('label').show();});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':{titleMsg:'wikieditor-toolbar-tool-table-title',id:'wikieditor-toolbar-table-dialog',html:'\ |
77 | 77 | <fieldset><div class="wikieditor-toolbar-table-form">\ |
78 | 78 | <div class="wikieditor-toolbar-field-wrapper">\ |
79 | 79 | <input type="checkbox" id="wikieditor-toolbar-table-dimensions-header" checked />\ |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | 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')) |
142 | 142 | $j('#wikieditor-toolbar-table-dimensions-header').click();if(!$j('#wikieditor-toolbar-table-wikitable').is(':checked')) |
143 | 143 | $j('#wikieditor-toolbar-table-wikitable').click();if($j('#wikieditor-toolbar-table-sortable').is(':checked')) |
144 | | -$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){$j(this).find('button:first').click();e.preventDefault();}});}}}},'search-and-replace':{titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\ |
| 144 | +$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':{titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\ |
145 | 145 | <div id="wikieditor-toolbar-replace-message">\ |
146 | 146 | <div id="wikieditor-toolbar-replace-nomatch" rel="wikieditor-toolbar-tool-replace-nomatch"></div>\ |
147 | 147 | <div id="wikieditor-toolbar-replace-success"></div>\ |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -1445,12 +1445,17 @@ |
1446 | 1446 | // when the user presses Enter |
1447 | 1447 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1448 | 1448 | if ( ( e.keyCode || e.which ) == 13 ) { |
1449 | | - $j(this) |
1450 | | - .find( 'button:first' ) |
1451 | | - .click(); |
| 1449 | + var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
| 1450 | + button.click(); |
1452 | 1451 | e.preventDefault(); |
1453 | 1452 | } |
1454 | 1453 | }); |
| 1454 | + |
| 1455 | + // Make tabbing to a button and pressing |
| 1456 | + // Enter do what people expect |
| 1457 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1458 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1459 | + }); |
1455 | 1460 | } |
1456 | 1461 | } |
1457 | 1462 | } |
— | — | @@ -1649,12 +1654,17 @@ |
1650 | 1655 | // when the user presses Enter |
1651 | 1656 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1652 | 1657 | if ( ( e.keyCode || e.which ) == 13 ) { |
1653 | | - $j(this) |
1654 | | - .find( 'button:first' ) |
1655 | | - .click(); |
| 1658 | + var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
| 1659 | + button.click(); |
1656 | 1660 | e.preventDefault(); |
1657 | 1661 | } |
1658 | 1662 | }); |
| 1663 | + |
| 1664 | + // Make tabbing to a button and pressing |
| 1665 | + // Enter do what people expect |
| 1666 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1667 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1668 | + }); |
1659 | 1669 | } |
1660 | 1670 | } |
1661 | 1671 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -586,23 +586,29 @@ |
587 | 587 | if ( typeof selector == 'undefined' ) { |
588 | 588 | selector = '*'; |
589 | 589 | } |
| 590 | + |
| 591 | + // Start at the selection's start and traverse the DOM backwards |
| 592 | + // This is done by traversing an element's children first, then the element itself, then its parent |
590 | 593 | var e; |
591 | 594 | if ( context.$iframe[0].contentWindow.getSelection ) { |
592 | 595 | // Firefox and Opera |
593 | 596 | var selection = context.$iframe[0].contentWindow.getSelection(); |
594 | 597 | // On load, webkit seems to not have a valid selection |
595 | 598 | if ( selection.baseNode !== null ) { |
596 | | - // Start at the selection's start and traverse the DOM backwards |
597 | | - // This is done by traversing an element's children first, then the element itself, then its parent |
598 | 599 | e = selection.getRangeAt( 0 ).startContainer; |
599 | 600 | } else { |
600 | 601 | return $( [] ); |
601 | 602 | } |
602 | 603 | } else if ( context.$iframe[0].contentWindow.document.selection ) { |
603 | 604 | // IE |
604 | | - // TODO |
605 | | - return $( [] ); |
| 605 | + // range.startContainer or similar functionality is not available in IE, so we have to |
| 606 | + // traverse the DOM to find out which element the selection starts in |
| 607 | + var range = context.$iframe[0].contentWindow.document.selection.createRange(), |
| 608 | + preRange = context.$iframe[0].contentWindow.document.body.createTextRange(); |
| 609 | + preRange.setEndPoint( "EndToStart", range ); |
| 610 | + // TODO finish |
606 | 611 | } |
| 612 | + |
607 | 613 | if ( e.nodeName != '#text' ) { |
608 | 614 | // The selection is not in a textnode, but between two non-text nodes |
609 | 615 | // (usually inside the <body> between two <br>s). Go to the rightmost |