All files / src/ui/widgets ve.ui.AlignWidget.js

25% Statements 2/8
0% Branches 0/4
0% Functions 0/1
25% Lines 2/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                                1x                                                                   1x  
/*!
 * VisualEditor UserInterface AlignWidget class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * Widget that lets the user edit alignment of an object
 *
 * @class
 * @extends OO.ui.ButtonSelectWidget
 *
 * @constructor
 * @param {Object} [config] Configuration options
 * @param {string} [config.dir='ltr'] Interface directionality
 */
ve.ui.AlignWidget = function VeUiAlignWidget( config ) {
	config = config || {};
 
	// Parent constructor
	ve.ui.AlignWidget.super.call( this, config );
 
	let alignButtons = [
		new OO.ui.ButtonOptionWidget( {
			data: 'left',
			icon: 'alignLeft',
			label: ve.msg( 'visualeditor-align-widget-left' )
		} ),
		new OO.ui.ButtonOptionWidget( {
			data: 'center',
			icon: 'alignCenter',
			label: ve.msg( 'visualeditor-align-widget-center' )
		} ),
		new OO.ui.ButtonOptionWidget( {
			data: 'right',
			icon: 'alignRight',
			label: ve.msg( 'visualeditor-align-widget-right' )
		} )
	];
 
	if ( config.dir === 'rtl' ) {
		alignButtons = alignButtons.reverse();
	}
 
	this.addItems( alignButtons, 0 );
 
};
 
/* Inheritance */
 
OO.inheritClass( ve.ui.AlignWidget, OO.ui.ButtonSelectWidget );