Merge "resourceloader: Remove support for $context === null in getContentObj"
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.CopyTextLayout.js
index 65e7eb7..56419ae 100644 (file)
@@ -54,7 +54,7 @@
 
                // Events
                this.button.connect( this, { click: 'onButtonClick' } );
-               this.textInput.$input.on( 'click', this.onInputClick.bind( this ) );
+               this.textInput.$input.on( 'focus', this.onInputFocus.bind( this ) );
 
                this.$element.addClass( 'mw-widget-copyTextLayout' );
        };
        };
 
        /**
-        * Handle button click events
+        * Handle text widget focus events
         */
-       mw.widgets.CopyTextLayout.prototype.onInputClick = function () {
-               this.selectText();
+       mw.widgets.CopyTextLayout.prototype.onInputFocus = function () {
+               if ( !this.selecting ) {
+                       this.selectText();
+               }
        };
 
        /**
                        scrollTop = input.scrollTop,
                        scrollLeft = input.scrollLeft;
 
+               this.selecting = true;
                this.textInput.select();
+               this.selecting = false;
 
                // Restore scroll position
                input.scrollTop = scrollTop;