1 const HighlightColorPickerWidget = require( './HighlightColorPickerWidget.js' );
3 * A popup containing a color picker, for setting highlight colors.
5 * @class mw.rcfilters.ui.HighlightPopupWidget
7 * @extends OO.ui.PopupWidget
9 * @param {mw.rcfilters.Controller} controller RCFilters controller
10 * @param {Object} [config] Configuration object
12 const HighlightPopupWidget = function MwRcfiltersUiHighlightPopupWidget( controller, config ) {
13 config = config || {};
16 HighlightPopupWidget.super.call( this, Object.assign( {
21 horizontalPosition: 'end',
25 this.colorPicker = new HighlightColorPickerWidget( controller );
27 this.colorPicker.connect( this, { chooseColor: 'onChooseColor' } );
29 this.$body.append( this.colorPicker.$element );
34 OO.inheritClass( HighlightPopupWidget, OO.ui.PopupWidget );
39 * Set the button (or other widget) that this popup should hang off.
41 * @param {OO.ui.Widget} widget Widget the popup should orient itself to
43 HighlightPopupWidget.prototype.setAssociatedButton = function ( widget ) {
44 this.setFloatableContainer( widget.$element );
45 this.$autoCloseIgnore = widget.$element;
49 * Set the filter item that this popup should control the highlight color for.
51 * @param {mw.rcfilters.dm.FilterItem} item
53 HighlightPopupWidget.prototype.setFilterItem = function ( item ) {
54 this.colorPicker.setFilterItem( item );
58 * When the user chooses a color in the color picker, close the popup.
60 HighlightPopupWidget.prototype.onChooseColor = function () {
64 module.exports = HighlightPopupWidget;