Page MenuHomeWickedGov Phorge

LinkTypeField.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

LinkTypeField.js

/**
* @class
* @extends OO.ui.FieldLayout
* @mixes OO.EventEmitter
* @constructor
*/
function LinkTypeField() {
// Mixin constructor
OO.EventEmitter.call( this );
this.radioInt = new OO.ui.RadioOptionWidget( {
label: mw.msg( 'wikieditor-toolbar-tool-link-int' )
} );
this.radioExt = new OO.ui.RadioOptionWidget( {
label: mw.msg( 'wikieditor-toolbar-tool-link-ext' )
} );
var radioSelect = new OO.ui.RadioSelectWidget( {
items: [
this.radioInt,
this.radioExt
]
} );
radioSelect.connect( this, {
choose: this.onRadioChoose
} );
var config = {
align: 'top',
classes: [ 'mw-wikiEditor-InsertLink-LinkTypeField' ]
};
LinkTypeField.super.call( this, radioSelect, config );
}
OO.inheritClass( LinkTypeField, OO.ui.FieldLayout );
OO.mixinClass( LinkTypeField, OO.EventEmitter );
LinkTypeField.static.LINK_MODE_INTERNAL = 'internal';
LinkTypeField.static.LINK_MODE_EXTERNAL = 'external';
/**
* Select the 'external link' radio.
*
* @param {boolean} isExternal
*/
LinkTypeField.prototype.setIsExternal = function ( isExternal ) {
this.getField().selectItem( isExternal ? this.radioExt : this.radioInt );
};
/**
* Is the 'internal link' radio currently selected?
*
* @return {boolean}
*/
LinkTypeField.prototype.isInternal = function () {
return this.radioInt.isSelected();
};
/**
* Emit a 'change' event when the radio selection changes.
*
* @private
*/
LinkTypeField.prototype.onRadioChoose = function () {
this.emit( 'change', this.radioExt.isSelected() );
};
module.exports = LinkTypeField;

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 19, 07:32 (2 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
04/51/e4e4b3fda7dcbc0d85b07e0d769f
Default Alt Text
LinkTypeField.js (1 KB)

Event Timeline