https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113786
Revision: 113786
Author: reedy
Date: 2012-03-13 23:40:36 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
MFT r113775
Modified Paths:
--------------
branches/wmf/1.19wmf1/resources/jquery/jquery.textSelection.js
Property Changed:
----------------
branches/wmf/1.19wmf1/
Property changes on: branches/wmf/1.19wmf1
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111397,111427,111571,111574,111597,111658,111673,111695,111697,111750,111795,111802-111803,111827,111881,111920,111965-111967,112021,112034,112037,112045-112046,112049,112061-112063,112065-112066,112070-112071,112079,112100,112128,112132-112133,112141,112152,112169-112170,112172-112173,112179,112184,112259,112290,112347,112374,112378,112381,112383,112397,112408,112474,112526,112533-112534,112563,112566,112573,112700,112750,112839-112840,112843,112855,112866,112951,112995,113039,113085,113099,113169,113195,113312,113412
+ /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111397,111427,111571,111574,111597,111658,111673,111695,111697,111750,111795,111802-111803,111827,111881,111920,111965-111967,112021,112034,112037,112045-112046,112049,112061-112063,112065-112066,112070-112071,112079,112100,112128,112132-112133,112141,112152,112169-112170,112172-112173,112179,112184,112259,112290,112347,112374,112378,112381,112383,112397,112408,112474,112526,112533-112534,112563,112566,112573,112700,112750,112839-112840,112843,112855,112866,112951,112995,113039,113085,113099,113169,113195,113312,113412,113775
Modified: branches/wmf/1.19wmf1/resources/jquery/jquery.textSelection.js
===================================================================
--- branches/wmf/1.19wmf1/resources/jquery/jquery.textSelection.js
2012-03-13 23:20:25 UTC (rev 113785)
+++ branches/wmf/1.19wmf1/resources/jquery/jquery.textSelection.js
2012-03-13 23:40:36 UTC (rev 113786)
@@ -131,8 +131,58 @@
var isSample = false;
if ( this.style.display == 'none' ) {
// Do nothing
+ } else if ( document.selection &&
document.selection.createRange ) {
+ // IE
+
+ // Note that IE9 will trigger the next section unless
we check this first.
+ // See bug 35201.
+
+ activateElementOnIE( this );
+ 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();
+
+ checkSelectedText();
+ var insertText = pre + selText + post;
+ if ( options.splitlines ) {
+ insertText = doSplitLines( selText, pre, post );
+ }
+ if ( options.ownline && range.moveStart ) {
+ var range2 = document.selection.createRange();
+ range2.collapse();
+ range2.moveStart( 'character', -1 );
+ // FIXME: Which check is correct?
+ if ( range2.text != "\r" && range2.text != "\n"
&& range2.text != "" ) {
+ insertText = "\n" + insertText;
+ pre += "\n";
+ }
+ var range3 = document.selection.createRange();
+ range3.collapse( false );
+ range3.moveEnd( 'character', 1 );
+ if ( range3.text != "\r" && range3.text != "\n"
&& range3.text != "" ) {
+ insertText += "\n";
+ post += "\n";
+ }
+ }
+
+ range.text = insertText;
+ if ( isSample && options.selectPeri && range.moveStart
) {
+ range.moveStart( 'character', - post.length -
selText.length );
+ range.moveEnd( 'character', - post.length );
+ }
+ range.select();
+ // Restore the scroll position
+ this.scrollTop = scrollTop;
} else if ( this.selectionStart || this.selectionStart == '0' )
{
// Mozilla/Opera
+
$(this).focus();
if ( options.selectionStart !== undefined ) {
$(this).textSelection( 'setSelection', {
'start': options.selectionStart, 'end': options.selectionEnd } );
@@ -182,51 +232,6 @@
this.selectionStart = startPos +
insertText.length;
this.selectionEnd = this.selectionStart;
}
- } else if ( document.selection &&
document.selection.createRange ) {
- // IE
- activateElementOnIE( this );
- 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();
-
- checkSelectedText();
- var insertText = pre + selText + post;
- if ( options.splitlines ) {
- insertText = doSplitLines( selText, pre, post );
- }
- if ( options.ownline && range.moveStart ) {
- var range2 = document.selection.createRange();
- range2.collapse();
- range2.moveStart( 'character', -1 );
- // FIXME: Which check is correct?
- if ( range2.text != "\r" && range2.text != "\n"
&& range2.text != "" ) {
- insertText = "\n" + insertText;
- pre += "\n";
- }
- var range3 = document.selection.createRange();
- range3.collapse( false );
- range3.moveEnd( 'character', 1 );
- if ( range3.text != "\r" && range3.text != "\n"
&& range3.text != "" ) {
- insertText += "\n";
- post += "\n";
- }
- }
-
- range.text = insertText;
- if ( isSample && options.selectPeri && range.moveStart
) {
- range.moveStart( 'character', - post.length -
selText.length );
- range.moveEnd( 'character', - post.length );
- }
- range.select();
- // Restore the scroll position
- this.scrollTop = scrollTop;
}
$(this).trigger( 'encapsulateSelection', [ options.pre,
options.peri, options.post, options.ownline,
options.replace, options.spitlines ] );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs