http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97466
Revision: 97466
Author: santhosh
Date: 2011-09-19 11:07:47 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Remove webkit specific slow code with generic approach with the help of
jquery.textselection encapsulateSelection method with optional selectionStart
and selectionEnd.
This patch was not applied Bug 30130 since a curser positioning issue was
found, but later found that the issue is there even without extension and
leaving it open.
Modified Paths:
--------------
trunk/extensions/Narayam/js/ext.narayam.core.js
Modified: trunk/extensions/Narayam/js/ext.narayam.core.js
===================================================================
--- trunk/extensions/Narayam/js/ext.narayam.core.js 2011-09-19 11:05:10 UTC
(rev 97465)
+++ trunk/extensions/Narayam/js/ext.narayam.core.js 2011-09-19 11:07:47 UTC
(rev 97466)
@@ -242,35 +242,14 @@
input = input.substring( divergingPos );
replacement = replacement.substring( divergingPos );
- // TODO: use better browser detection as $.browser may be moved
out
- // from jQuery core
- if ( $.browser.webkit ) {
- // Webkit browser have a bug:
- // https://bugs.webkit.org/show_bug.cgi?id=66630
- // TODO: remove when webkit bug is handled
- // in jQuery.textSelection.js
-
- replaceString($this, startPos - input.length + 1,
endPos, replacement);
- // Calculate new position for caret to be set
- var newCaretPosition = startPos - input.length + 1 +
replacement.length;
- // Update caret postion
- $this.textSelection( 'setSelection', {
- 'start': newCaretPosition,
- 'end': newCaretPosition
+ $this.textSelection( 'encapsulateSelection', {
+ 'peri': replacement,
+ 'replace': true,
+ 'selectPeri': false,
+ 'selectionStart': startPos - input.length + 1,
+ 'selectionEnd': endPos
+
} );
- }
- else {
- // Select and replace the text
- $this.textSelection( 'setSelection', {
- 'start': startPos - input.length + 1,
- 'end': endPos
- } );
- $this.textSelection( 'encapsulateSelection', {
- 'peri': replacement,
- 'replace': true,
- 'selectPeri': false
- } );
- }
e.stopPropagation();
return false;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs