Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -757,7 +757,7 @@ |
758 | 758 | <li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li>\ |
759 | 759 | <li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li>\ |
760 | 760 | </ul>\ |
761 | | - <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
| 761 | + <div id="edittoolbar-link-dialog-tab-int"><fieldset><table><tr>\ |
762 | 762 | <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
763 | 763 | <td>\ |
764 | 764 | <input type="text" id="edittoolbar-link-int-target" />\ |
— | — | @@ -766,14 +766,14 @@ |
767 | 767 | </tr><tr>\ |
768 | 768 | <td><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label></td>\ |
769 | 769 | <td><input type="text" id="edittoolbar-link-int-text" /></td>\ |
770 | | - </table></fieldset><input type="submit" style="display: none;" /></form></div>\ |
771 | | - <div id="edittoolbar-link-dialog-tab-ext"><form><fieldset><table><tr>\ |
| 770 | + </table></fieldset></div>\ |
| 771 | + <div id="edittoolbar-link-dialog-tab-ext"><fieldset><table><tr>\ |
772 | 772 | <td><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label></td>\ |
773 | 773 | <td><input type="text" id="edittoolbar-link-ext-target" /></td>\ |
774 | 774 | </tr><tr>\ |
775 | 775 | <td><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label></td>\ |
776 | 776 | <td><input type="text" id="edittoolbar-link-ext-text" /></td>\ |
777 | | - </table></fieldset><input type="submit" style="display: none;" /></form></div>\ |
| 777 | + </table></fieldset></div>\ |
778 | 778 | </div>', |
779 | 779 | init: function() { |
780 | 780 | // Updates the UI to show if the page title being inputed by the user exists or not |
— | — | @@ -838,15 +838,6 @@ |
839 | 839 | $j(this).find( '[rel]' ).each( function() { |
840 | 840 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
841 | 841 | }); |
842 | | - // Assign the proper action to the hidden submit buttons |
843 | | - // triggered when the user presses Enter |
844 | | - $j(this).find( 'form' ).submit( function( e ) { |
845 | | - e.preventDefault(); |
846 | | - $j(this) |
847 | | - .closest( '.ui-dialog' ) |
848 | | - .find( 'button:first' ) |
849 | | - .click(); |
850 | | - }); |
851 | 842 | // Build tabs |
852 | 843 | $j( '#edittoolbar-link-tabs' ).tabs(); |
853 | 844 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
— | — | @@ -1023,8 +1014,8 @@ |
1024 | 1015 | open: function() { |
1025 | 1016 | // Pre-fill the text fields based on the current selection |
1026 | 1017 | var selection = $j(this).data( 'context' ).$textarea.getSelection(); |
1027 | | - $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] ); |
1028 | | - $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] ); |
| 1018 | + $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] ); |
| 1019 | + $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] ); |
1029 | 1020 | if ( selection != '' ) { |
1030 | 1021 | var intText, intTarget, extText, extTarget; |
1031 | 1022 | var matches; |
— | — | @@ -1063,6 +1054,19 @@ |
1064 | 1055 | $j( '#edittoolbar-link-int-text' ).val() == $j( '#edittoolbar-link-int-target' ).val() |
1065 | 1056 | ); |
1066 | 1057 | $j( '#edittoolbar-link-int-target' ).suggestions(); |
| 1058 | + |
| 1059 | + if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
| 1060 | + $j(this).data( 'dialogkeypressset', true ); |
| 1061 | + // Execute the action associated with the first button |
| 1062 | + // when the user presses Enter |
| 1063 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1064 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1065 | + $j(this) |
| 1066 | + .find( 'button:first' ) |
| 1067 | + .click(); |
| 1068 | + } |
| 1069 | + }); |
| 1070 | + } |
1067 | 1071 | } |
1068 | 1072 | } |
1069 | 1073 | }, |
— | — | @@ -1070,7 +1074,7 @@ |
1071 | 1075 | titleMsg: 'edittoolbar-tool-table-title', |
1072 | 1076 | id: 'edittoolbar-table-dialog', |
1073 | 1077 | html: '\ |
1074 | | - <form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
| 1078 | + <fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
1075 | 1079 | <td><input type="checkbox" id="edittoolbar-table-dimensions-header" value="1" /></td>\ |
1076 | 1080 | <td class="label"><label for="edittoolbar-table-dimensions-header"\ |
1077 | 1081 | rel="edittoolbar-tool-table-dimensions-header"></label></td>\ |
— | — | @@ -1081,19 +1085,19 @@ |
1082 | 1086 | <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
1083 | 1087 | rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
1084 | 1088 | <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
1085 | | - </tr></table></fieldset><input type="submit" style="display: none;" /></form>', |
| 1089 | + </tr></table></fieldset>', |
1086 | 1090 | init: function() { |
1087 | 1091 | $j(this).find( '[rel]' ).each( function() { |
1088 | 1092 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1089 | 1093 | }); |
1090 | | - // Assign the proper action to the hidden submit buttons |
1091 | | - // triggered when the user presses Enter |
1092 | | - $j(this).find( 'form' ).submit( function( e ) { |
1093 | | - e.preventDefault(); |
1094 | | - $j(this) |
1095 | | - .closest( '.ui-dialog' ) |
1096 | | - .find( 'button:first' ) |
1097 | | - .click(); |
| 1094 | + // Execute the action associated with the first button |
| 1095 | + // when the user presses Enter |
| 1096 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1097 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1098 | + $j(this) |
| 1099 | + .find( 'button:first' ) |
| 1100 | + .click(); |
| 1101 | + } |
1098 | 1102 | }); |
1099 | 1103 | $j( '#edittoolbar-table-dimensions-rows' ).val( 2 ); |
1100 | 1104 | $j( '#edittoolbar-table-dimensions-columns' ).val( 2 ); |
— | — | @@ -1139,6 +1143,20 @@ |
1140 | 1144 | 'edittoolbar-tool-table-cancel': function() { |
1141 | 1145 | $j(this).dialog( 'close' ); |
1142 | 1146 | } |
| 1147 | + }, |
| 1148 | + open: function() { |
| 1149 | + if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
| 1150 | + $j(this).data( 'dialogkeypressset', true ); |
| 1151 | + // Execute the action associated with the first button |
| 1152 | + // when the user presses Enter |
| 1153 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1154 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1155 | + $j(this) |
| 1156 | + .find( 'button:first' ) |
| 1157 | + .click(); |
| 1158 | + } |
| 1159 | + }); |
| 1160 | + } |
1143 | 1161 | } |
1144 | 1162 | } |
1145 | 1163 | }, |
— | — | @@ -1146,7 +1164,7 @@ |
1147 | 1165 | titleMsg: 'edittoolbar-tool-replace-title', |
1148 | 1166 | id: 'edittoolbar-replace-dialog', |
1149 | 1167 | html: '\ |
1150 | | - <form><fieldset><table><tr>\ |
| 1168 | + <fieldset><table><tr>\ |
1151 | 1169 | <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
1152 | 1170 | <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
1153 | 1171 | </tr><tr>\ |
— | — | @@ -1161,19 +1179,19 @@ |
1162 | 1180 | </tr><tr>\ |
1163 | 1181 | <td><input type="checkbox" id="edittoolbar-replace-all" /></td>\ |
1164 | 1182 | <td><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></td>\ |
1165 | | - </tr></table></fieldset><input type="submit" style="display: none;" /></form>', |
| 1183 | + </tr></table></fieldset>', |
1166 | 1184 | init: function() { |
1167 | 1185 | $j(this).find( '[rel]' ).each( function() { |
1168 | 1186 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1169 | 1187 | }); |
1170 | | - // Assign the proper action to the hidden submit buttons |
1171 | | - // triggered when the user presses Enter |
1172 | | - $j(this).find( 'form' ).submit( function( e ) { |
1173 | | - e.preventDefault(); |
1174 | | - $j(this) |
1175 | | - .closest( '.ui-dialog' ) |
1176 | | - .find( 'button:first' ) |
1177 | | - .click(); |
| 1188 | + // Execute the action associated with the first button |
| 1189 | + // when the user presses Enter |
| 1190 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1191 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1192 | + $j(this) |
| 1193 | + .find( 'button:first' ) |
| 1194 | + .click(); |
| 1195 | + } |
1178 | 1196 | }); |
1179 | 1197 | }, |
1180 | 1198 | dialog: { |
— | — | @@ -1252,6 +1270,20 @@ |
1253 | 1271 | $j(this).dialog( 'close' ); |
1254 | 1272 | $j(this).data( 'context' ).$textarea.focus(); |
1255 | 1273 | } |
| 1274 | + }, |
| 1275 | + open: function() { |
| 1276 | + if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
| 1277 | + $j(this).data( 'dialogkeypressset', true ); |
| 1278 | + // Execute the action associated with the first button |
| 1279 | + // when the user presses Enter |
| 1280 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1281 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1282 | + $j(this) |
| 1283 | + .find( 'button:first' ) |
| 1284 | + .click(); |
| 1285 | + } |
| 1286 | + }); |
| 1287 | + } |
1256 | 1288 | } |
1257 | 1289 | } |
1258 | 1290 | } |
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 = 37; |
| 23 | +$wgEditToolbarStyleVersion = 38; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |