Index: trunk/extensions/CodeEditor/modules/jquery.codeEditor.js |
— | — | @@ -75,8 +75,10 @@ |
76 | 76 | return; |
77 | 77 | }, |
78 | 78 | 'saveSelection': function() { |
| 79 | + mw.log('codeEditor stub function saveSelection called'); |
79 | 80 | }, |
80 | 81 | 'restoreSelection': function() { |
| 82 | + mw.log('codeEditor stub function restoreSelection called'); |
81 | 83 | }, |
82 | 84 | /** |
83 | 85 | * Sets up the iframe in place of the textarea to allow more advanced operations |
— | — | @@ -152,6 +154,7 @@ |
153 | 155 | */ |
154 | 156 | |
155 | 157 | 'getElementAtCursor': function() { |
| 158 | + mw.log('codeEditor stub function getElementAtCursor called'); |
156 | 159 | }, |
157 | 160 | |
158 | 161 | /** |
— | — | @@ -171,10 +174,10 @@ |
172 | 175 | var sel = context.codeEditor.getSelection(); |
173 | 176 | var range = sel.getRange(); |
174 | 177 | var selText = context.fn.getSelection(); |
175 | | - var selectAfter = false; |
| 178 | + var isSample = false; |
176 | 179 | if ( !selText ) { |
177 | 180 | selText = options.peri; |
178 | | - selectAfter = true; |
| 181 | + isSample = true; |
179 | 182 | } else if ( options.replace ) { |
180 | 183 | selText = options.peri; |
181 | 184 | } |
— | — | @@ -182,7 +185,7 @@ |
183 | 186 | text += selText; |
184 | 187 | text += options.post; |
185 | 188 | context.codeEditor.insert( text ); |
186 | | - if ( selectAfter ) { |
| 189 | + if ( isSample && options.selectPeri && !options.splitlines ) { |
187 | 190 | // May esplode if anything has newlines, be warned. :) |
188 | 191 | range.setStart( range.start.row, range.start.column + options.pre.length ); |
189 | 192 | range.setEnd( range.start.row, range.start.column + selText.length ); |
— | — | @@ -195,6 +198,7 @@ |
196 | 199 | * DO NOT CALL THIS DIRECTLY, use $.textSelection( 'functionname', options ) instead |
197 | 200 | */ |
198 | 201 | 'getCaretPosition': function( options ) { |
| 202 | + mw.log('codeEditor stub function getCaretPosition called'); |
199 | 203 | }, |
200 | 204 | /** |
201 | 205 | * Sets the selection of the content |
— | — | @@ -237,7 +241,7 @@ |
238 | 242 | * DO NOT CALL THIS DIRECTLY, use $.textSelection( 'functionname', options ) instead |
239 | 243 | */ |
240 | 244 | 'scrollToCaretPosition': function( options ) { |
241 | | - //context.fn.scrollToTop( context.fn.getElementAtCursor(), true ); |
| 245 | + mw.log('codeEditor stub function scrollToCaretPosition called'); |
242 | 246 | return context.$textarea; |
243 | 247 | }, |
244 | 248 | /** |
— | — | @@ -248,6 +252,7 @@ |
249 | 253 | * @param force If true, scroll the element even if it's already visible |
250 | 254 | */ |
251 | 255 | 'scrollToTop': function( $element, force ) { |
| 256 | + mw.log('codeEditor stub function scrollToTop called'); |
252 | 257 | } |
253 | 258 | } ); |
254 | 259 | |