mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-03 10:26:37 +00:00
cf237b882e
A tool to add special characters and diacritics to text. Also added a new button type ve.ui.GroupButtonWidget that includes a group of PushButtonWidget objects and returna the individual button's value upon click Wikis can edit <visualeditor-specialcharinspector-characterlist-insert>, a JSON string, to include their own desird special characters to insert through the tool. Bug: 50296 Change-Id: I26d1f437feef1c8b61ed3be5f74ef524b33baf49
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface GroupButtonWidget class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.GroupButtonWidget object.
|
|
*
|
|
* @class
|
|
* @extends OO.ui.Widget
|
|
*
|
|
* @param {Object} [config] Configuration options
|
|
* @cfg {Object} [group] Button group parameters organized by { 'label': returnValue }
|
|
* where 'returnValue' is the value associated with the button
|
|
*/
|
|
ve.ui.GroupButtonWidget = function VeUiGroupButtonWidget( config ) {
|
|
var item, button, arrButtons = [];
|
|
|
|
// Parent constructor
|
|
OO.ui.Widget.call( this, config );
|
|
|
|
// Mixin constructors
|
|
OO.ui.GroupElement.call( this, this.$( '<div>' ), config );
|
|
|
|
// Initialization
|
|
this.value = null;
|
|
this.group = config.group;
|
|
this.buttons = {};
|
|
// Set up the buttons
|
|
for ( item in this.group ) {
|
|
button = new OO.ui.PushButtonWidget( {
|
|
'label': item,
|
|
} );
|
|
// store value
|
|
button.returnValue = this.group[item];
|
|
arrButtons.push( button );
|
|
}
|
|
|
|
this.addItems( arrButtons );
|
|
|
|
this.$element.append( this.$group.addClass( 've-ui-groupButtonWidget' ) );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.GroupButtonWidget, OO.ui.Widget );
|
|
|
|
OO.mixinClass( ve.ui.GroupButtonWidget, OO.ui.GroupElement );
|