jenkins-bot has submitted this change and it was merged.

Change subject: mw.UploadWizardLicenseInput: Use OOjs UI event handling for 
custom textarea
......................................................................


mw.UploadWizardLicenseInput: Use OOjs UI event handling for custom textarea

The error messages will now be updated more reliably (e.g. on right
click paste).

Also lower the user input timeout from 2 seconds to 0.5 seconds, same
as we use elsewhere (e.g. DescriptionDetailsWidget).

Change-Id: Ifbf4727133f561903413cd639cf424d34c4d9791
---
M resources/mw.UploadWizardLicenseInput.js
1 file changed, 5 insertions(+), 10 deletions(-)

Approvals:
  Matthias Mullie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mw.UploadWizardLicenseInput.js 
b/resources/mw.UploadWizardLicenseInput.js
index 59f092d..bafad1d 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -306,7 +306,7 @@
                 * @return {jQuery} Wrapped textarea
                 */
                createCustomWikiTextInterface: function ( $input, customDefault 
) {
-                       var keydownTimeout,
+                       var
                                input = this,
                                nameId = $input.attr( 'id' ) + '_custom',
                                textarea, button;
@@ -319,15 +319,10 @@
                        } );
                        textarea.$input.attr( 'id', nameId );
 
-                       textarea.$input
-                               .focus( function () { input.setInput( $input, 
true ); } )
-                               .keydown( function () {
-                                       window.clearTimeout( keydownTimeout );
-                                       keydownTimeout = window.setTimeout(
-                                               function () { input.emit( 
'change' ); },
-                                               2000
-                                       );
-                               } );
+                       // Select this radio when the user clicks on the text 
field
+                       textarea.$input.focus( function () { input.setInput( 
$input, true ); } );
+                       // Update displayed errors as the user is typing
+                       textarea.on( 'change', OO.ui.debounce( this.emit.bind( 
this, 'change' ), 500 ) );
 
                        button = new OO.ui.ButtonWidget( {
                                label: mw.message( 
'mwe-upwiz-license-custom-preview' ).text(),

-- 
To view, visit https://gerrit.wikimedia.org/r/321874
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifbf4727133f561903413cd639cf424d34c4d9791
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to