http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97602

Revision: 97602
Author:   catrope
Date:     2011-09-20 08:36:34 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
1.17wmf1: MFT r96579

Modified Paths:
--------------
    branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js

Property Changed:
----------------
    branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js

Modified: branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js
===================================================================
--- branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js      
2011-09-20 08:18:20 UTC (rev 97601)
+++ branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js      
2011-09-20 08:36:34 UTC (rev 97602)
@@ -72,11 +72,23 @@
                } else if ( this.selectionStart || this.selectionStart == '0' ) 
{
                        // Mozilla/Opera
                        $(this).focus();
+                       if ( options.selectionStart !== undefined ) {
+                               $(this).textSelection( 'setSelection', { 
'start': options.selectionStart, 'end': options.selectionEnd } );
+                       }
+                       
                        var selText = $(this).textSelection( 'getSelection' );
                        var startPos = this.selectionStart;
                        var endPos = this.selectionEnd;
                        var scrollTop = this.scrollTop;
                        checkSelectedText();
+                       if ( options.selectionStart !== undefined
+                                       && endPos - startPos != 
options.selectionEnd - options.selectionStart )
+                       {
+                               // This means there is a difference in the 
selection range returned by browser and what we passed.
+                               // This happens for Chrome in the case of 
composite characters. Ref bug #30130
+                               // Set the startPos to the correct position.
+                               startPos = options.selectionStart;
+                       }
                        if ( options.ownline ) {
                                if ( startPos != 0 && this.value.charAt( 
startPos - 1 ) != "\n" ) {
                                        options.pre = "\n" + options.pre;
@@ -108,6 +120,10 @@
                        if ( context ) {
                                context.fn.restoreCursorAndScrollTop();
                        }
+                       if ( options.selectionStart !== undefined ) {
+                               $(this).textSelection( 'setSelection', { 
'start': options.selectionStart, 'end': options.selectionEnd } );
+                       }
+                       
                        var selText = $(this).textSelection( 'getSelection' );
                        var scrollTop = this.scrollTop;
                        var range = document.selection.createRange();
@@ -366,7 +382,9 @@
                                'post': '', // Text to insert after the 
cursor/selection
                                'ownline': false, // Put the inserted text on a 
line of its own
                                'replace': false, // If there is a selection, 
replace it with peri instead of leaving it alone
-                               'selectPeri': true // Select the peri text if 
it was inserted (but not if there was a selection and replace==false)
+                               'selectPeri': true, // Select the peri text if 
it was inserted (but not if there was a selection and replace==false)
+                               'selectionStart': undefined, // Position to 
start selection at
+                               'selectionEnd': undefined // Position to end 
selection at. Defaults to start
                        }, options );
                        break;
                case 'getCaretPosition':


Property changes on: 
branches/wmf/1.17wmf1/resources/jquery/jquery.textSelection.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/resources/jquery/jquery.textSelection.js:51646
/branches/new-installer/phase3/resources/jquery/jquery.textSelection.js:43664-66004
/branches/sqlite/resources/jquery/jquery.textSelection.js:58211-58321
/branches/wmf/1.16wmf4/resources/jquery/jquery.textSelection.js:67177,69199,76243,77266
/branches/wmf-deployment/resources/jquery/jquery.textSelection.js:60970
/trunk/phase3/resources/jquery/jquery.textSelection.js:79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81833,83212,83590,84384
   + /branches/REL1_15/phase3/resources/jquery/jquery.textSelection.js:51646
/branches/new-installer/phase3/resources/jquery/jquery.textSelection.js:43664-66004
/branches/sqlite/resources/jquery/jquery.textSelection.js:58211-58321
/branches/wmf/1.16wmf4/resources/jquery/jquery.textSelection.js:67177,69199,76243,77266
/branches/wmf-deployment/resources/jquery/jquery.textSelection.js:60970
/trunk/phase3/resources/jquery/jquery.textSelection.js:79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81833,83212,83590,84384,96579


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to