', {
class: 'elementor-controls-popover'
});
child.$el.before(this.$popover);
this.$popover.append(child.$el);
this.popoverToggleView = child._parent.children.findByIndex(child._index - 1);
// Add the "Typography" header to the popover
if ('typography' === this.child.model.attributes.groupType) {
this.createPopoverHeader();
}
}
(0, _createClass2.default)(ControlsPopover, [{
key: "addChild",
value: function addChild(child) {
this.$popover.append(child.$el);
}
}, {
key: "createPopoverHeader",
value: function createPopoverHeader() {
var _this = this;
var $popoverToggleControl = this.$popover.prev(),
// Get the existing reset button.
$resetLabel = $popoverToggleControl.find('.elementor-control-popover-toggle-reset-label');
this.$popoverHeader = jQuery('
', {
class: 'e-group-control-header'
}).html('
' + __('Typography', 'elementor') + '');
this.$headerControlsWrapper = jQuery('
', {
class: 'e-control-tools'
});
// Give the reset button the control tool styling, and add a click event so clicking on it closes the popover.
$resetLabel.addClass('e-control-tool').on('click', function () {
return _this.onResetButtonClick();
});
// Move the popover toggle reset button into the popover header.
this.$headerControlsWrapper.append($resetLabel);
this.$popoverHeader.append(this.$headerControlsWrapper);
var globalConfig = this.popoverToggleView.model.get('global');
if (globalConfig !== null && globalConfig !== void 0 && globalConfig.active) {
this.createAddButton();
}
this.$popover.prepend(this.$popoverHeader).addClass('e-controls-popover--typography');
}
}, {
key: "onResetButtonClick",
value: function onResetButtonClick() {
this.$popover.hide();
var groupControlName = this.child.model.get('groupPrefix') + 'typography',
args = {
container: this.child.options.container,
settings: (0, _defineProperty2.default)({}, groupControlName, '')
};
if (this.child.options.container.globals.get(groupControlName)) {
// The Disable Globals command applies global settings locally,
// so disabling the global shouldn't actually change the appearance of the widget.
$e.run('document/globals/disable', args);
} else {
$e.run('document/elements/settings', args);
}
}
}, {
key: "onAddButtonClick",
value: function onAddButtonClick() {
this.popoverToggleView.onAddGlobalButtonClick();
}
}, {
key: "createAddButton",
value: function createAddButton() {
var _this2 = this;
this.$addButton = jQuery('