Index: trunk/extensions/Narayam/js/ext.narayam.core.js |
— | — | @@ -242,35 +242,14 @@ |
243 | 243 | input = input.substring( divergingPos ); |
244 | 244 | replacement = replacement.substring( divergingPos ); |
245 | 245 | |
246 | | - // TODO: use better browser detection as $.browser may be moved out |
247 | | - // from jQuery core |
248 | | - if ( $.browser.webkit ) { |
249 | | - // Webkit browser have a bug: |
250 | | - // https://bugs.webkit.org/show_bug.cgi?id=66630 |
251 | | - // TODO: remove when webkit bug is handled |
252 | | - // in jQuery.textSelection.js |
253 | | - |
254 | | - replaceString($this, startPos - input.length + 1, endPos, replacement); |
255 | | - // Calculate new position for caret to be set |
256 | | - var newCaretPosition = startPos - input.length + 1 + replacement.length; |
257 | | - // Update caret postion |
258 | | - $this.textSelection( 'setSelection', { |
259 | | - 'start': newCaretPosition, |
260 | | - 'end': newCaretPosition |
| 246 | + $this.textSelection( 'encapsulateSelection', { |
| 247 | + 'peri': replacement, |
| 248 | + 'replace': true, |
| 249 | + 'selectPeri': false, |
| 250 | + 'selectionStart': startPos - input.length + 1, |
| 251 | + 'selectionEnd': endPos |
| 252 | + |
261 | 253 | } ); |
262 | | - } |
263 | | - else { |
264 | | - // Select and replace the text |
265 | | - $this.textSelection( 'setSelection', { |
266 | | - 'start': startPos - input.length + 1, |
267 | | - 'end': endPos |
268 | | - } ); |
269 | | - $this.textSelection( 'encapsulateSelection', { |
270 | | - 'peri': replacement, |
271 | | - 'replace': true, |
272 | | - 'selectPeri': false |
273 | | - } ); |
274 | | - } |
275 | 254 | |
276 | 255 | e.stopPropagation(); |
277 | 256 | return false; |