| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
function TextParamMixin() { |
| 16 |
|
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
TextParamMixin.prototype.getApiValue = function () { |
| 23 |
return this.getValue(); |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
TextParamMixin.prototype.setApiValue = function ( newValue ) { |
| 30 |
if ( newValue === undefined ) { |
| 31 |
newValue = this.paramInfo.default; |
| 32 |
} |
| 33 |
this.setValue( newValue ); |
| 34 |
}; |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
TextParamMixin.prototype.apiCheckValid = function ( shouldSuppressErrors ) { |
| 45 |
const that = this; |
| 46 |
return this.getValidity().then( () => $.Deferred().resolve( true ).promise(), () => $.Deferred().resolve( false ).promise() ).done( ( ok ) => { |
| 47 |
ok = ok || shouldSuppressErrors; |
| 48 |
that.setIcon( ok ? null : 'alert' ); |
| 49 |
that.setTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() ); |
| 50 |
} ); |
| 51 |
}; |
| 52 |
|
| 53 |
module.exports = TextParamMixin; |