mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
VE integration: Fix the "Refresh" button
Previously, clicking it would change the image, but the widget would still expect the user to fill in the original CAPTCHA. Change-Id: I24a963e760951427f6d233302429c1baf1fb299f
This commit is contained in:
parent
da4c75e387
commit
601b1fff84
|
@ -22,6 +22,9 @@ $( document ).on( 'click', '.fancycaptcha-reload', function () {
|
|||
// now do the same with a selector that works for pre-1.27 login forms
|
||||
$root.find( '[name="wpCaptchaId"]' ).val( captchaIndex );
|
||||
$root.find( '[name="wpCaptchaWord"]' ).val( '' ).trigger( 'focus' );
|
||||
|
||||
// and make it accessible for other tools, e.g. VisualEditor
|
||||
$captchaImage.data( 'captchaId', captchaIndex );
|
||||
}
|
||||
} )
|
||||
.always( function () {
|
||||
|
|
|
@ -44,7 +44,8 @@ mw.libs.ve.targetLoader.addPlugin( function () {
|
|||
|
||||
// Register extra fields
|
||||
target.saveFields.wpCaptchaId = function () {
|
||||
return captchaData.id;
|
||||
// 'ext.confirmEdit.fancyCaptcha' can update this value if the "Refresh" button is used
|
||||
return $captchaImg ? $captchaImg.data( 'captchaId' ) : captchaData.id;
|
||||
};
|
||||
target.saveFields.wpCaptchaWord = function () {
|
||||
return captchaInput.getValue();
|
||||
|
@ -71,6 +72,7 @@ mw.libs.ve.targetLoader.addPlugin( function () {
|
|||
$captchaParagraph.append( mw.message( 'fancycaptcha-edit' ).parseDom() );
|
||||
$captchaImg = $( '<img>' )
|
||||
.attr( 'src', captchaData.url )
|
||||
.data( 'captchaId', captchaData.id )
|
||||
.addClass( 'fancycaptcha-image' )
|
||||
.on( 'load', onCaptchaLoad );
|
||||
$captchaDiv.append(
|
||||
|
|
Loading…
Reference in a new issue