Index: trunk/phase3/skins/common/edit.js |
— | — | @@ -1,3 +1,5 @@ |
| 2 | +var currentFocused; |
| 3 | + |
2 | 4 | // this function generates the actual toolbar buttons with localized text |
3 | 5 | // we use it to avoid creating the toolbar where javascript is not enabled |
4 | 6 | function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) { |
— | — | @@ -62,7 +64,7 @@ |
63 | 65 | function insertTags(tagOpen, tagClose, sampleText) { |
64 | 66 | var txtarea; |
65 | 67 | if (document.editform) { |
66 | | - txtarea = document.editform.wpTextbox1; |
| 68 | + txtarea = currentFocused; |
67 | 69 | } else { |
68 | 70 | // some alternate form? take the first one we can find |
69 | 71 | var areas = document.getElementsByTagName('textarea'); |
— | — | @@ -77,7 +79,7 @@ |
78 | 80 | var winScroll = document.documentElement.scrollTop |
79 | 81 | else if (document.body) |
80 | 82 | var winScroll = document.body.scrollTop; |
81 | | - //get current selection |
| 83 | + //get current selection |
82 | 84 | txtarea.focus(); |
83 | 85 | var range = document.selection.createRange(); |
84 | 86 | selText = range.text; |
— | — | @@ -88,10 +90,10 @@ |
89 | 91 | if (isSample && range.moveStart) { |
90 | 92 | if (window.opera) |
91 | 93 | tagClose = tagClose.replace(/\n/g,''); |
92 | | - range.moveStart('character', - tagClose.length - selText.length); |
93 | | - range.moveEnd('character', - tagClose.length); |
| 94 | + range.moveStart('character', - tagClose.length - selText.length); |
| 95 | + range.moveEnd('character', - tagClose.length); |
94 | 96 | } |
95 | | - range.select(); |
| 97 | + range.select(); |
96 | 98 | //restore window scroll position |
97 | 99 | if (document.documentElement && document.documentElement.scrollTop) |
98 | 100 | document.documentElement.scrollTop = winScroll |
— | — | @@ -122,7 +124,7 @@ |
123 | 125 | } |
124 | 126 | //restore textarea scroll position |
125 | 127 | txtarea.scrollTop = textScroll; |
126 | | - } |
| 128 | + } |
127 | 129 | |
128 | 130 | function checkSelectedText(){ |
129 | 131 | if (!selText) { |
— | — | @@ -131,7 +133,7 @@ |
132 | 134 | } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char |
133 | 135 | selText = selText.substring(0, selText.length - 1); |
134 | 136 | tagClose += ' ' |
135 | | - } |
| 137 | + } |
136 | 138 | } |
137 | 139 | |
138 | 140 | } |
— | — | @@ -148,9 +150,17 @@ |
149 | 151 | if( scrollTop.value ) |
150 | 152 | editBox.scrollTop = scrollTop.value; |
151 | 153 | addHandler( editForm, 'submit', function() { |
152 | | - document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; |
| 154 | + document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; |
153 | 155 | } ); |
154 | 156 | } |
155 | 157 | } |
156 | 158 | hookEvent( 'load', scrollEditBox ); |
157 | 159 | hookEvent( 'load', mwSetupToolbar ); |
| 160 | +hookEvent( 'load', function() { |
| 161 | + if ( document.editform ) { |
| 162 | + currentFocused = document.editform.wpTextbox1; |
| 163 | + document.editform.wpTextbox1.onfocus = function() { currentFocused = document.editform.wpTextbox1; }; |
| 164 | + document.editform.wpSummary.onfocus = function() { currentFocused = document.editform.wpSummary; }; |
| 165 | + } |
| 166 | +} ); |
| 167 | + |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | * New hook: MessageNotInMwNs to handle localised messages that aren't in the |
54 | 54 | Mediawiki Namespace, before checking the message files |
55 | 55 | * (bug 18466) Add note or warning when overruling a move (semi-)protection |
| 56 | +* (bug 18342) insertTags works in edit summary box |
56 | 57 | |
57 | 58 | === Bug fixes in 1.16 === |
58 | 59 | |