Convert SimpleCaptcha to OOUI

Change-Id: Ic904b53b2ac489be572f4b6096ddc8c92c482a59
This commit is contained in:
Ed Sanders 2018-12-07 13:23:39 -05:00
parent 7951ce701e
commit 423234cb77
3 changed files with 37 additions and 15 deletions

View file

@ -122,21 +122,30 @@ class SimpleCaptcha {
$index = $this->storeCaptcha( $captcha );
return [
'html' => "<p><label for=\"wpCaptchaWord\">{$captcha['question']} = </label>" .
Xml::element( 'input', [
'name' => 'wpCaptchaWord',
'class' => 'mw-ui-input',
'id' => 'wpCaptchaWord',
'size' => 5,
'autocomplete' => 'off',
// tab in before the edit textarea
'tabindex' => $tabIndex ] ) .
"</p>\n" .
Xml::element( 'input', [
'type' => 'hidden',
'name' => 'wpCaptchaId',
'id' => 'wpCaptchaId',
'value' => $index ] )
'html' =>
new OOUI\FieldLayout(
new OOUI\NumberInputWidget( [
'name' => 'wpCaptchaWord',
'classes' => [ 'simplecaptcha-answer' ],
'id' => 'wpCaptchaWord',
'autocomplete' => 'off',
// tab in before the edit textarea
'tabIndex' => $tabIndex
] ),
[
'align' => 'left',
'label' => $captcha['question'] . ' = ',
'classes' => [ 'simplecaptcha-field' ],
]
) .
new OOUI\HiddenInputWidget( [
'name' => 'wpCaptchaId',
'id' => 'wpCaptchaId',
'value' => $index
] ),
'modulestyles' => [
'ext.confirmEdit.simpleCaptcha'
]
];
}

View file

@ -0,0 +1,10 @@
.simplecaptcha-field .oo-ui-fieldLayout-header {
/* stylelint-disable declaration-no-important */
width: auto !important;
padding-right: 1em !important;
/* stylelint-enable declaration-no-important */
}
.simplecaptcha-answer.oo-ui-textInputWidget {
width: 5em;
}

View file

@ -73,6 +73,9 @@
},
"ext.confirmEdit.visualEditor": {
"scripts": "ve-confirmedit/ve.init.mw.CaptchaSaveErrorHandler.js"
},
"ext.confirmEdit.simpleCaptcha": {
"styles": "../SimpleCaptcha/resources/ext.confirmEdit.simpleCaptcha.css"
}
},
"VisualEditorPluginModules": [