Merge "Login-related messages should get the URL as a parameter"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 7 Dec 2018 20:09:06 +0000 (20:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 7 Dec 2018 20:09:06 +0000 (20:09 +0000)
includes/jobqueue/jobs/CategoryMembershipChangeJob.php
resources/Resources.php
resources/src/jquery/jquery.textSelection.js

index 1c7647c..b64c87a 100644 (file)
@@ -47,7 +47,7 @@ class CategoryMembershipChangeJob extends Job {
        private $parserCache;
 
        /**
-        * @param Title $title The title of the page for which to update category emmbership.
+        * @param Title $title The title of the page for which to update category membership.
         * @param string $revisionTimestamp The timestamp of the new revision that triggered the job.
         * @return JobSpecification
         */
@@ -66,6 +66,9 @@ class CategoryMembershipChangeJob extends Job {
        /**
         * Constructor for use by the Job Queue infrastructure.
         * @note Don't call this when queueing a new instance, use newSpec() instead.
+        * @param ParserCache $parserCache Cache outputs of PHP parser.
+        * @param Title $title Title of the categorized page.
+        * @param array $params Such latest revision instance of the categorized page.
         */
        public function __construct( ParserCache $parserCache, Title $title, array $params ) {
                parent::__construct( 'categoryMembershipChange', $title, $params );
index d12f89d..317385d 100644 (file)
@@ -1181,6 +1181,7 @@ return [
                        'jquery.suggestions',
                        'jquery.getAttrs',
                        'mediawiki.api',
+                       'user.options',
                ],
        ],
        'mediawiki.storage' => [
@@ -1786,6 +1787,7 @@ return [
                        'mediawiki.jqueryMsg',
                        'mediawiki.Uri',
                        'mediawiki.user',
+                       'user.options',
                ],
                'messages' => [
                        'quotation-marks',
index 6b4ab97..cbbed99 100644 (file)
                        setContents: function ( content ) {
                                return this.each( function () {
                                        var scrollTop = this.scrollTop;
-                                       $( this ).val( content );
+                                       this.select();
+                                       if ( !document.execCommand( 'insertText', false, content ) ) {
+                                               $( this ).val( content );
+                                       }
                                        // Setting this.value may scroll the textarea, restore the scroll position
                                        this.scrollTop = scrollTop;
                                } );
                                return this.each( function () {
                                        var allText, currSelection, startPos, endPos;
 
-                                       allText = $( this ).textSelection( 'getContents' );
-                                       currSelection = $( this ).textSelection( 'getCaretPosition', { startAndEnd: true } );
-                                       startPos = currSelection[ 0 ];
-                                       endPos = currSelection[ 1 ];
+                                       if ( !document.execCommand( 'insertText', false, value ) ) {
+                                               allText = $( this ).textSelection( 'getContents' );
+                                               currSelection = $( this ).textSelection( 'getCaretPosition', { startAndEnd: true } );
+                                               startPos = currSelection[ 0 ];
+                                               endPos = currSelection[ 1 ];
 
-                                       $( this ).textSelection( 'setContents', allText.slice( 0, startPos ) + value +
-                                               allText.slice( endPos ) );
-                                       $( this ).textSelection( 'setSelection', {
-                                               start: startPos,
-                                               end: startPos + value.length
-                                       } );
+                                               $( this ).textSelection( 'setContents', allText.slice( 0, startPos ) + value +
+                                                       allText.slice( endPos ) );
+                                               $( this ).textSelection( 'setSelection', {
+                                                       start: startPos,
+                                                       end: startPos + value.length
+                                               } );
+                                       }
                                } );
                        },