', {
class: 'elementor-tags-list__group-title'
}).text(group.title);
$tagsListInner.append($groupTitle);
groupTags.forEach(function (tag) {
var $tag = jQuery('
', {
class: 'elementor-tags-list__item'
});
$tag.text(tag.title).attr('data-tag-name', tag.name);
$tagsListInner.append($tag);
});
});
// Create and inject pro dynamic teaser template if Pro is not installed
if (!elementor.helpers.hasPro() && Object.keys(tags).length) {
var proTeaser = Marionette.Renderer.render('#tmpl-elementor-dynamic-tags-promo', {
promotionUrl: elementor.config.dynamicPromotionURL.replace('%s', this.view.model.get('name'))
});
$tagsListInner.append(proTeaser);
}
$tagsListInner.on('click', '.elementor-tags-list__item', this.onTagsListItemClick.bind(this));
elementorCommon.elements.$body.append($tagsList);
},
getTagsList: function getTagsList() {
if (!this.ui.tagsList) {
this.createTagsList();
}
return this.ui.tagsList;
},
toggleTagsList: function toggleTagsList() {
var $tagsList = this.getTagsList();
if ($tagsList.is(':visible')) {
$tagsList.hide();
return;
}
var direction = elementorCommon.config.isRTL ? 'left' : 'right';
$tagsList.show().position({
my: "".concat(direction, " top"),
at: "".concat(direction, " bottom+5"),
of: this.ui.dynamicSwitcher
});
},
setTagView: function setTagView(id, name, settings) {
if (this.tagView) {
this.tagView.destroy();
}
var tagView = this.tagView = new TagPanelView({
id: id,
name: name,
settings: settings,
controlName: this.view.model.get('name'),
dynamicSettings: this.getOption('dynamicSettings')
}),
elementContainer = this.view.options.container,
tagViewLabel = elementContainer.controls[tagView.options.controlName].label;
tagView.options.container = new elementorModules.editor.Container({
type: 'dynamic',
id: id,
model: tagView.model,
settings: tagView.model,
view: tagView,
parent: elementContainer,
label: elementContainer.label + ' ' + tagViewLabel,
controls: tagView.model.options.controls,
renderer: elementContainer
});
tagView.render();
this.$el.find('.elementor-control-tag-area').after(tagView.el);
this.listenTo(tagView, 'remove', this.onTagViewRemove.bind(this));
},
setDefaultTagView: function setDefaultTagView() {
var tagData = elementor.dynamicTags.tagTextToTagData(this.getDynamicValue());
this.setTagView(tagData.id, tagData.name, tagData.settings);
},
tagViewToTagText: function tagViewToTagText() {
var tagView = this.tagView;
return elementor.dynamicTags.tagDataToTagText(tagView.getOption('id'), tagView.getOption('name'), tagView.model);
},
getDynamicValue: function getDynamicValue() {
return this.view.container.dynamic.get(this.view.model.get('name'));
},
destroyTagView: function destroyTagView() {
if (this.tagView) {
this.tagView.destroy();
this.tagView = null;
}
},
showPromotion: function showPromotion() {
var hasProAndNotConnected = elementor.helpers.hasProAndNotConnected(),
dialogOptions = {
title: __('Dynamic Content', 'elementor'),
content: __('Create more personalized and dynamic sites by populating data from various sources with dozens of dynamic tags to choose from.', 'elementor'),
targetElement: this.ui.dynamicSwitcher,
position: {
blockStart: '-10'
},
actionButton: {
url: hasProAndNotConnected ? elementorProEditorConfig.urls.connect : elementor.config.dynamicPromotionURL.replace('%s', this.view.model.get('name')),
text: hasProAndNotConnected ? __('Connect & Activate', 'elementor') : __('Upgrade', 'elementor')
}
};
elementor.promotion.showDialog(dialogOptions);
},
onRender: function onRender() {
this.$el.addClass('elementor-control-dynamic');
this.renderTools();
this.toggleDynamicClass();
if (this.isDynamicMode()) {
this.setDefaultTagView();
}
},
onDynamicSwitcherClick: function onDynamicSwitcherClick(event) {
event.stopPropagation();
if (this.getOption('tags').length) {
this.toggleTagsList();
} else {
this.showPromotion();
}
},
onTagsListItemClick: function onTagsListItemClick(event) {
var $tag = jQuery(event.currentTarget);
this.setTagView(elementorCommon.helpers.getUniqueId(), $tag.data('tagName'), {});
// If an element has an active global value, disable it before applying the dynamic value.
if (this.view.getGlobalKey()) {
this.view.triggerMethod('unset:global:value');
}
if (this.isDynamicMode()) {
$e.run('document/dynamic/settings', {
container: this.view.options.container,
settings: (0, _defineProperty2.default)({}, this.view.model.get('name'), this.tagViewToTagText())
});
} else {
$e.run('document/dynamic/enable', {
container: this.view.options.container,
settings: (0, _defineProperty2.default)({}, this.view.model.get('name'), this.tagViewToTagText())
});
}
this.toggleDynamicClass();
this.toggleTagsList();
if (this.tagView.getTagConfig().settings_required) {
this.tagView.showSettingsPopup();
}
},
onTagViewRemove: function onTagViewRemove() {
$e.run('document/dynamic/disable', {
container: this.view.options.container,
settings: (0, _defineProperty2.default)({}, this.view.model.get('name'), this.tagViewToTagText())
});
this.toggleDynamicClass();
},
onAfterExternalChange: function onAfterExternalChange() {
this.destroyTagView();
if (this.isDynamicMode()) {
this.setDefaultTagView();
}
this.toggleDynamicClass();
},
onDestroy: function onDestroy() {
this.destroyTagView();
if (this.ui.tagsList) {
this.ui.tagsList.remove();
}
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/dynamic-tags/manager.js":
/*!******************************************************************!*\
!*** ../assets/dev/js/editor/components/dynamic-tags/manager.js ***!
\******************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
module.exports = elementorModules.Module.extend({
CACHE_KEY_NOT_FOUND_ERROR: 'Cache key not found',
tags: {
Base: __webpack_require__(/*! elementor-dynamic-tags/tag */ "../assets/dev/js/editor/components/dynamic-tags/tag.js")
},
cache: {},
cacheRequests: {},
cacheCallbacks: [],
addCacheRequest: function addCacheRequest(tag) {
this.cacheRequests[this.createCacheKey(tag)] = true;
},
createCacheKey: function createCacheKey(tag) {
return btoa(tag.getOption('name')) + '-' + btoa(encodeURIComponent(JSON.stringify(tag.model)));
},
loadTagDataFromCache: function loadTagDataFromCache(tag) {
var cacheKey = this.createCacheKey(tag);
if (undefined !== this.cache[cacheKey]) {
return this.cache[cacheKey];
}
if (!this.cacheRequests[cacheKey]) {
this.addCacheRequest(tag);
}
},
loadCacheRequests: function loadCacheRequests() {
var _this = this;
var cacheRequests = this.cacheRequests,
cacheCallbacks = this.cacheCallbacks;
this.cacheRequests = {};
this.cacheCallbacks = [];
elementorCommon.ajax.addRequest('render_tags', {
data: {
post_id: elementor.config.document.id,
tags: Object.keys(cacheRequests)
},
success: function success(data) {
_this.cache = _objectSpread(_objectSpread({}, _this.cache), data);
cacheCallbacks.forEach(function (callback) {
callback();
});
}
});
},
refreshCacheFromServer: function refreshCacheFromServer(callback) {
this.cacheCallbacks.push(callback);
this.loadCacheRequests();
},
getConfig: function getConfig(key) {
return this.getItems(elementor.config.dynamicTags, key);
},
parseTagsText: function parseTagsText(text, settings, parseCallback) {
var self = this;
if ('object' === settings.returnType) {
return self.parseTagText(text, settings, parseCallback);
}
return text.replace(/\[elementor-tag[^\]]+]/g, function (tagText) {
return self.parseTagText(tagText, settings, parseCallback);
});
},
parseTagText: function parseTagText(tagText, settings, parseCallback) {
var tagData = this.tagTextToTagData(tagText);
if (!tagData) {
if ('object' === settings.returnType) {
return {};
}
return '';
}
return parseCallback(tagData.id, tagData.name, tagData.settings);
},
tagTextToTagData: function tagTextToTagData(tagText) {
var tagIDMatch = tagText.match(/id="(.*?(?="))"/),
tagNameMatch = tagText.match(/name="(.*?(?="))"/),
tagSettingsMatch = tagText.match(/settings="(.*?(?="]))/);
if (!tagIDMatch || !tagNameMatch || !tagSettingsMatch) {
return false;
}
return {
id: tagIDMatch[1],
name: tagNameMatch[1],
settings: JSON.parse(decodeURIComponent(tagSettingsMatch[1]))
};
},
createTag: function createTag(tagID, tagName, tagSettings) {
var tagConfig = this.getConfig('tags.' + tagName);
if (!tagConfig) {
return;
}
var TagClass = this.tags[tagName] || this.tags.Base,
model = new elementorModules.editor.elements.models.BaseSettings(tagSettings, {
controls: tagConfig.controls
});
return new TagClass({
id: tagID,
name: tagName,
model: model
});
},
getTagDataContent: function getTagDataContent(tagID, tagName, tagSettings) {
var tag = this.createTag(tagID, tagName, tagSettings);
if (!tag) {
return;
}
return tag.getContent();
},
tagDataToTagText: function tagDataToTagText(tagID, tagName, tagSettings) {
tagSettings = encodeURIComponent(JSON.stringify(tagSettings && tagSettings.toJSON({
remove: ['default']
}) || {}));
return '[elementor-tag id="' + tagID + '" name="' + tagName + '" settings="' + tagSettings + '"]';
},
tagContainerToTagText: function tagContainerToTagText( /** Container*/container) {
return elementor.dynamicTags.tagDataToTagText(container.view.getOption('id'), container.view.getOption('name'), container.view.model);
},
cleanCache: function cleanCache() {
this.cache = {};
},
onInit: function onInit() {
this.loadCacheRequests = _.debounce(this.loadCacheRequests, 300);
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack-empty.js":
/*!***********************************************************************************!*\
!*** ../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack-empty.js ***!
\***********************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Marionette.ItemView.extend({
className: 'elementor-tag-controls-stack-empty',
template: '#tmpl-elementor-tag-controls-stack-empty'
});
/***/ }),
/***/ "../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack.js":
/*!*****************************************************************************!*\
!*** ../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack.js ***!
\*****************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var EmptyView = __webpack_require__(/*! elementor-dynamic-tags/tag-controls-stack-empty */ "../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack-empty.js");
module.exports = elementorModules.editor.views.ControlsStack.extend({
activeTab: 'content',
template: _.noop,
emptyView: EmptyView,
isEmpty: function isEmpty() {
// Ignore the section control
return this.collection.length < 2;
},
childViewOptions: function childViewOptions() {
return {
container: this.options.container
};
},
getNamespaceArray: function getNamespaceArray() {
var currentPageView = elementor.getPanelView().getCurrentPageView(),
eventNamespace = currentPageView.getNamespaceArray();
eventNamespace.push(currentPageView.activeSection);
eventNamespace.push(this.getOption('controlName'));
eventNamespace.push(this.getOption('name'));
return eventNamespace;
},
onRenderTemplate: function onRenderTemplate() {
this.activateFirstSection();
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/dynamic-tags/tag-panel-view.js":
/*!*************************************************************************!*\
!*** ../assets/dev/js/editor/components/dynamic-tags/tag-panel-view.js ***!
\*************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TagControlsStack = __webpack_require__(/*! elementor-dynamic-tags/tag-controls-stack */ "../assets/dev/js/editor/components/dynamic-tags/tag-controls-stack.js");
module.exports = Marionette.ItemView.extend({
className: 'elementor-dynamic-cover e-input-style',
tagControlsStack: null,
templateHelpers: function templateHelpers() {
var helpers = {};
if (this.model) {
helpers.controls = this.model.options.controls;
}
return helpers;
},
ui: {
remove: '.elementor-dynamic-cover__remove'
},
events: function events() {
var events = {
'click @ui.remove': 'onRemoveClick'
};
if (this.hasSettings()) {
events.click = 'onClick';
}
return events;
},
getTemplate: function getTemplate() {
var config = this.getTagConfig(),
templateFunction = Marionette.TemplateCache.get('#tmpl-elementor-control-dynamic-cover'),
renderedTemplate = Marionette.Renderer.render(templateFunction, {
hasSettings: this.hasSettings(),
isRemovable: !this.getOption('dynamicSettings').default,
title: config.title,
content: config.panel_template
});
return Marionette.TemplateCache.prototype.compileTemplate(renderedTemplate.trim());
},
getTagConfig: function getTagConfig() {
return elementor.dynamicTags.getConfig('tags.' + this.getOption('name'));
},
initSettingsPopup: function initSettingsPopup() {
var settingsPopupOptions = {
className: 'elementor-tag-settings-popup',
position: {
my: 'left top+5',
at: 'left bottom',
of: this.$el,
autoRefresh: true
},
hide: {
ignore: '.select2-container'
}
};
var settingsPopup = elementorCommon.dialogsManager.createWidget('buttons', settingsPopupOptions);
this.getSettingsPopup = function () {
return settingsPopup;
};
},
hasSettings: function hasSettings() {
return !!Object.values(this.getTagConfig().controls).length;
},
showSettingsPopup: function showSettingsPopup() {
if (!this.tagControlsStack) {
this.initTagControlsStack();
}
var settingsPopup = this.getSettingsPopup();
if (settingsPopup.isVisible()) {
return;
}
settingsPopup.show();
},
initTagControlsStack: function initTagControlsStack() {
this.tagControlsStack = new TagControlsStack({
model: this.model,
controls: this.model.controls,
name: this.options.name,
controlName: this.options.controlName,
container: this.options.container,
el: this.getSettingsPopup().getElements('message')[0]
});
this.tagControlsStack.render();
},
initModel: function initModel() {
this.model = new elementorModules.editor.elements.models.BaseSettings(this.getOption('settings'), {
controls: this.getTagConfig().controls
});
},
initialize: function initialize() {
// The `model` should always be available.
this.initModel();
if (!this.hasSettings()) {
return;
}
this.initSettingsPopup();
this.listenTo(this.model, 'change', this.render);
},
onClick: function onClick() {
this.showSettingsPopup();
},
onRemoveClick: function onRemoveClick(event) {
event.stopPropagation();
this.destroy();
this.trigger('remove');
},
onDestroy: function onDestroy() {
if (this.hasSettings()) {
this.getSettingsPopup().destroy();
}
if (this.tagControlsStack) {
this.tagControlsStack.destroy();
}
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/dynamic-tags/tag.js":
/*!**************************************************************!*\
!*** ../assets/dev/js/editor/components/dynamic-tags/tag.js ***!
\**************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Marionette.ItemView.extend({
hasTemplate: true,
tagName: 'span',
className: function className() {
return 'elementor-tag';
},
getTemplate: function getTemplate() {
if (!this.hasTemplate) {
return false;
}
return Marionette.TemplateCache.get('#tmpl-elementor-tag-' + this.getOption('name') + '-content');
},
initialize: function initialize() {
try {
this.getTemplate();
} catch (e) {
this.hasTemplate = false;
}
},
getConfig: function getConfig(key) {
var config = elementor.dynamicTags.getConfig('tags.' + this.getOption('name'));
if (key) {
return config[key];
}
return config;
},
getContent: function getContent() {
var contentType = this.getConfig('content_type'),
data;
if (!this.hasTemplate) {
data = elementor.dynamicTags.loadTagDataFromCache(this);
if (undefined === data) {
throw new Error(elementor.dynamicTags.CACHE_KEY_NOT_FOUND_ERROR);
}
}
if ('ui' === contentType) {
this.render();
if (this.hasTemplate) {
return this.el.outerHTML;
}
if (this.getConfig('wrapped_tag')) {
data = jQuery(data).html();
}
this.$el.html(data);
}
return data;
},
onRender: function onRender() {
this.el.id = 'elementor-tag-' + this.getOption('id');
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/hotkeys/component.js":
/*!***************************************************************!*\
!*** ../assets/dev/js/editor/components/hotkeys/component.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _componentModalBase = _interopRequireDefault(__webpack_require__(/*! elementor-api/modules/component-modal-base */ "../modules/web-cli/assets/js/modules/component-modal-base.js"));
var _modalLayout = _interopRequireDefault(__webpack_require__(/*! ./modal-layout */ "../assets/dev/js/editor/components/hotkeys/modal-layout.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Component = /*#__PURE__*/function (_ComponentModalBase) {
(0, _inherits2.default)(Component, _ComponentModalBase);
var _super = _createSuper(Component);
function Component() {
(0, _classCallCheck2.default)(this, Component);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Component, [{
key: "getNamespace",
value: function getNamespace() {
return 'shortcuts';
}
}, {
key: "defaultShortcuts",
value: function defaultShortcuts() {
return {
'': {
keys: 'ctrl+?, shift+?',
exclude: ['input']
}
};
}
}, {
key: "getModalLayout",
value: function getModalLayout() {
return _modalLayout.default;
}
}]);
return Component;
}(_componentModalBase.default);
exports["default"] = Component;
/***/ }),
/***/ "../assets/dev/js/editor/components/hotkeys/hotkeys.js":
/*!*************************************************************!*\
!*** ../assets/dev/js/editor/components/hotkeys/hotkeys.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _component = _interopRequireDefault(__webpack_require__(/*! ./component */ "../assets/dev/js/editor/components/hotkeys/component.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_elementorModules$Mod) {
(0, _inherits2.default)(_default, _elementorModules$Mod);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "onInit",
value: function onInit() {
$e.components.register(new _component.default({
manager: this
}));
}
}]);
return _default;
}(elementorModules.Module);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/hotkeys/modal-content.js":
/*!*******************************************************************!*\
!*** ../assets/dev/js/editor/components/hotkeys/modal-content.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _environment = _interopRequireDefault(__webpack_require__(/*! elementor-common/utils/environment */ "../core/common/assets/js/utils/environment.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_Marionette$LayoutVie) {
(0, _inherits2.default)(_default, _Marionette$LayoutVie);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "id",
value: function id() {
return 'elementor-hotkeys';
}
}, {
key: "templateHelpers",
value: function templateHelpers() {
return {
environment: _environment.default
};
}
}, {
key: "getTemplate",
value: function getTemplate() {
return '#tmpl-elementor-hotkeys';
}
}]);
return _default;
}(Marionette.LayoutView);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/hotkeys/modal-layout.js":
/*!******************************************************************!*\
!*** ../assets/dev/js/editor/components/hotkeys/modal-layout.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get3 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _modalContent = _interopRequireDefault(__webpack_require__(/*! ./modal-content */ "../assets/dev/js/editor/components/hotkeys/modal-content.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_elementorModules$com) {
(0, _inherits2.default)(_default, _elementorModules$com);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "getModalOptions",
value: function getModalOptions() {
return {
id: 'elementor-hotkeys__modal'
};
}
}, {
key: "getLogoOptions",
value: function getLogoOptions() {
return {
title: __('Keyboard Shortcuts', 'elementor')
};
}
}, {
key: "initialize",
value: function initialize() {
var _get2;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
(_get2 = (0, _get3.default)((0, _getPrototypeOf2.default)(_default.prototype), "initialize", this)).call.apply(_get2, [this].concat(args));
this.showLogo();
this.showContentView();
}
}, {
key: "showContentView",
value: function showContentView() {
this.modalContent.show(new _modalContent.default());
}
}]);
return _default;
}(elementorModules.common.views.modal.Layout);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/classes/icon-library.js":
/*!********************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/classes/icon-library.js ***!
\********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _default = /*#__PURE__*/function () {
function _default() {
var _this = this;
(0, _classCallCheck2.default)(this, _default);
(0, _defineProperty2.default)(this, "loaded", {});
(0, _defineProperty2.default)(this, "notifyCallback", null);
(0, _defineProperty2.default)(this, "fetchIcons", function (library) {
fetch(library.fetchJson, {
mode: 'cors'
}).then(function (res) {
return res.json();
}).then(function (json) {
library.icons = json.icons;
return _this.normalizeIconList(library);
});
});
(0, _defineProperty2.default)(this, "runCallback", function (library) {
if ('function' !== typeof _this.notifyCallback) {
return library;
}
return _this.notifyCallback(library);
});
(0, _defineProperty2.default)(this, "initIconType", function (libraryConfig, callback) {
_this.notifyCallback = callback;
var store = elementor.iconManager.store;
if (_this.loaded[libraryConfig.name]) {
libraryConfig.icons = store.getIcons(libraryConfig);
return _this.runCallback(libraryConfig);
}
// Enqueue CSS
if (libraryConfig.enqueue) {
libraryConfig.enqueue.forEach(function (assetURL) {
elementor.helpers.enqueueEditorStylesheet(assetURL);
});
}
if (libraryConfig.url) {
elementor.helpers.enqueueEditorStylesheet(libraryConfig.url);
}
// Already saved an stored
if (store.isValid(libraryConfig)) {
var data = store.get(store.getKey(libraryConfig));
return _this.normalizeIconList(data);
}
// Comes with icons
if (libraryConfig.icons && libraryConfig.icons.length) {
return _this.normalizeIconList(libraryConfig);
}
// Get icons from via ajax
if (libraryConfig.fetchJson) {
return _this.fetchIcons(libraryConfig);
}
// @todo: error handling
});
}
(0, _createClass2.default)(_default, [{
key: "normalizeIconList",
value: function normalizeIconList(library) {
var icons = {};
var name;
jQuery.each(library.icons, function (index, icon) {
name = icon;
if ('object' === (0, _typeof2.default)(name)) {
name = Object.entries(name)[0][0];
}
if (!name) {
return;
}
icons[name] = {
prefix: library.prefix,
selector: library.prefix + name.trim(':'),
name: elementorCommon.helpers.upperCaseWords(name).trim(':').split('-').join(' '),
filter: name.trim(':'),
displayPrefix: library.displayPrefix || library.prefix.replace('-', '')
};
});
if (Object.keys(icons).length) {
library.icons = icons;
this.loaded[library.name] = true;
elementor.iconManager.store.save(library);
this.runCallback(library);
}
}
}]);
return _default;
}();
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/classes/store.js":
/*!*************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/classes/store.js ***!
\*************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var Store = /*#__PURE__*/function () {
function Store() {
(0, _classCallCheck2.default)(this, Store);
}
(0, _createClass2.default)(Store, [{
key: "save",
value: function save(library) {
elementorCommon.storage.set(Store.getKey(library), library);
}
}, {
key: "getIcons",
value: function getIcons(library) {
var data = this.get(Store.getKey(library));
if (data && data.icons) {
return data.icons;
}
return false;
}
}, {
key: "get",
value: function get(key) {
return elementorCommon.storage.get(key);
}
}, {
key: "isValid",
value: function isValid(library) {
var saved = this.get(Store.getKey(library));
if (!saved) {
return false;
}
if (saved.ver !== library.ver) {
// @todo: delete from localStorage if version is invalid
return false;
}
return saved.icons && saved.icons.length;
}
}], [{
key: "getKey",
value: function getKey(library) {
var name = library.name ? library.name : library;
return "elementor_".concat(name, "_icons");
}
}]);
return Store;
}();
var _default = Store;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/components/icon-list.js":
/*!********************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/components/icon-list.js ***!
\********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "../node_modules/prop-types/index.js"));
var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var LazyIconList = /*#__PURE__*/function (_Component) {
(0, _inherits2.default)(LazyIconList, _Component);
var _super = _createSuper(LazyIconList);
function LazyIconList() {
var _this;
(0, _classCallCheck2.default)(this, LazyIconList);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
itemSize: {
width: 0,
height: 0
},
wrapperSize: {
width: 0,
height: 0
},
firstRowInView: 0
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectors", {
item: '.elementor-icons-manager__tab__item',
wrapper: 'elementor-icons-manager__tab__wrapper'
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "attachScrollListener", function () {
var element = document.getElementById(_this.selectors.wrapper);
if (element) {
element.addEventListener('scroll', _this.handleScroll);
}
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "maybeMeasureItem", function () {
if (_this.state.itemSize.width) {
return;
}
// CSS Item Padding
var itemPadding = 20,
testElement = document.querySelector(_this.selectors.item);
if (!testElement) {
return;
}
var wrapper = document.getElementById(_this.selectors.wrapper);
var newState = {
itemSize: {
width: testElement.offsetWidth + itemPadding,
height: testElement.offsetHeight + itemPadding
},
wrapperSize: {
width: wrapper.offsetWidth,
height: wrapper.clientHeight
}
};
return _this.setState(newState, function () {
_this.maybeScrollToSelected();
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "maybeScrollToSelected", function () {
if (!_this.hasSelected()) {
return;
}
var selectedIndex = _this.props.selectedIndex,
_this$state = _this.state,
wrapperSize = _this$state.wrapperSize,
itemSize = _this$state.itemSize,
itemsInRow = Math.floor(wrapperSize.width / itemSize.width),
selectedItemRow = Math.ceil(selectedIndex / itemsInRow) - 1,
scrollTop = selectedItemRow * itemSize.height;
setTimeout(function () {
_this.props.parentRef.current.scrollTo({
top: scrollTop,
left: 0,
behavior: 'auto'
});
}, 0);
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleScroll", function () {
_this.clearDebounceScrollCallback();
_this._debounce = setTimeout(function () {
var element = document.getElementById(_this.selectors.wrapper);
var itemSize = _this.state.itemSize;
_this.setState({
firstRowInView: Math.floor(element.scrollTop / itemSize.height)
});
}, 10);
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "render", function () {
var _this$state2 = _this.state,
itemSize = _this$state2.itemSize,
wrapperSize = _this$state2.wrapperSize;
var firstRowInView = _this.state.firstRowInView;
if (!itemSize.width) {
return _this.renderFirstElementForMeasurement();
}
var items = _this.props.items,
itemsInRow = Math.floor(wrapperSize.width / itemSize.width),
totalRows = Math.ceil(items.length / itemsInRow),
spareRows = 4;
var rowsInView = Math.ceil(wrapperSize.height / itemSize.height) + spareRows;
if (rowsInView > totalRows) {
rowsInView = totalRows;
}
// Prevent scroll overflow
if (firstRowInView > totalRows - rowsInView) {
firstRowInView = totalRows - rowsInView;
}
var tailRows = totalRows - firstRowInView - rowsInView,
firstItemIndexInWindow = firstRowInView * itemsInRow,
lastItemIndexInWindow = (firstRowInView + rowsInView) * itemsInRow - 1,
itemsInView = items.slice(firstItemIndexInWindow, lastItemIndexInWindow + 1),
offsetStyle = {
height: "".concat(firstRowInView * itemSize.height, "px")
},
tailStyle = {
height: "".concat(tailRows * itemSize.height, "px")
};
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
className: 'elementor-icons-manager__tab__content__offset',
style: offsetStyle
}), /*#__PURE__*/_react.default.createElement("div", {
id: 'elementor-icons-manager__tab__content'
}, itemsInView), /*#__PURE__*/_react.default.createElement("div", {
className: 'elementor-icons-manager__tab__content__tail',
style: tailStyle
}));
});
return _this;
}
(0, _createClass2.default)(LazyIconList, [{
key: "componentDidMount",
value: function componentDidMount() {
this.attachScrollListener();
this.maybeMeasureItem();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.clearDebounceScrollCallback();
var element = document.getElementById(this.selectors.wrapper);
if (element) {
element.removeEventListener('scroll', this.handleScroll);
}
}
}, {
key: "clearDebounceScrollCallback",
value: function clearDebounceScrollCallback() {
clearTimeout(this._debounce);
}
}, {
key: "renderFirstElementForMeasurement",
value: function renderFirstElementForMeasurement() {
return /*#__PURE__*/_react.default.createElement("div", {
id: 'elementor-icons-manager__tab__content'
}, this.props.items[0]);
}
}, {
key: "hasSelected",
value: function hasSelected() {
return -1 !== this.props.selectedIndex;
}
}]);
return LazyIconList;
}(_react.Component);
var _default = LazyIconList;
exports["default"] = _default;
LazyIconList.propTypes = {
items: _propTypes.default.array,
selectedIndex: _propTypes.default.number,
parentRef: _propTypes.default.any
};
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/components/icon-manager.js":
/*!***********************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/components/icon-manager.js ***!
\***********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.renderIconManager = exports["default"] = void 0;
var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "../node_modules/@babel/runtime/helpers/extends.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "../node_modules/prop-types/index.js"));
var _react2 = _interopRequireDefault(__webpack_require__(/*! elementor-utils/react */ "../assets/dev/js/utils/react.js"));
var _tab = _interopRequireDefault(__webpack_require__(/*! ./tab */ "../assets/dev/js/editor/components/icons-manager/components/tab.js"));
var _iconsGoPro = _interopRequireDefault(__webpack_require__(/*! ./icons-go-pro */ "../assets/dev/js/editor/components/icons-manager/components/icons-go-pro.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var IconsManager = /*#__PURE__*/function (_Component) {
(0, _inherits2.default)(IconsManager, _Component);
var _super = _createSuper(IconsManager);
function IconsManager() {
var _this;
(0, _classCallCheck2.default)(this, IconsManager);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scrollViewRef", (0, _react.createRef)());
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
activeTab: _this.props.activeTab,
selected: {
library: '',
value: ''
},
iconTabs: elementor.config.icons.libraries,
loaded: _this.props.loaded,
filter: ''
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cache", {});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "loadAllTabs", function () {
var loaded = _this.state.loaded;
var icons = _this.props.icons;
icons.forEach(function (tabSettings) {
if (loaded[tabSettings.name]) {
return;
}
if (-1 < ['all', 'recommended'].indexOf(tabSettings.name)) {
return;
}
elementor.iconManager.library.initIconType(_objectSpread({}, tabSettings), function (library) {
_this.cache[library.name] = library;
loaded[tabSettings.name] = true;
});
});
loaded.all = true;
loaded.recommended = true;
_this.setState({
loaded: loaded
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getActiveTab", function () {
var activeTab = _this.state.activeTab;
var loaded = _this.state.loaded,
icons = _this.props.icons;
if (!activeTab) {
if (_this.props.activeTab) {
activeTab = _this.props.activeTab;
}
}
if ('GoPro' === activeTab) {
return activeTab;
}
if (!loaded[activeTab]) {
return false;
}
var tabSettings = _objectSpread({}, icons.filter(function (tab) {
return tab.name === activeTab;
})[0]);
if (loaded[activeTab]) {
return _objectSpread({}, tabSettings);
}
if ('all' === tabSettings.name && !loaded.all) {
return _this.loadAllTabs();
}
elementor.iconManager.library.initIconType(_objectSpread({}, tabSettings), function (library) {
_this.cache[library.name] = library;
_this.updateLoaded(library.name);
});
return false;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getIconTabsLinks", function () {
var native = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
return _this.props.icons.map(function (tab) {
if (native ^ _this.isNativeTab(tab)) {
return '';
}
var isCurrentTab = tab.name === _this.state.activeTab;
var className = 'elementor-icons-manager__tab-link';
if (isCurrentTab) {
className += ' elementor-active';
}
return (
/*#__PURE__*/
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
_react.default.createElement("div", {
className: className,
key: tab.name,
onClick: function onClick() {
if (isCurrentTab) {
return;
}
_this.setState({
activeTab: tab.name
});
}
}, /*#__PURE__*/_react.default.createElement("i", {
className: tab.labelIcon
}), tab.label)
);
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getActiveTabIcons", function (activeTab) {
if (activeTab.name) {
return _this.getActiveTabIcons(activeTab.name);
}
if (_this.cache[activeTab]) {
return _this.cache[activeTab].icons;
}
if ('recommended' === activeTab) {
return _this.state.iconTabs[0].icons;
}
if ('all' === activeTab) {
return _this.getAllIcons();
}
if (!_this.state.loaded[activeTab]) {
var librarySettings = _this.props.icons.filter(function (library) {
return activeTab === library.name;
});
return elementor.iconManager.library.initIconType(_objectSpread({}, librarySettings[0]), function (library) {
_this.cache[library.name] = library;
_this.updateLoaded(library.name);
});
}
return elementor.iconManager.store.getIcons(activeTab);
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAllIcons", function () {
if (_this.cache.all) {
return _this.cache.all.icons;
}
var icons = {};
_this.props.icons.forEach(function (tabSettings) {
if ('all' === tabSettings.name || 'recommended' === tabSettings.name) {
return;
}
icons[tabSettings.name] = _this.getActiveTabIcons(tabSettings.name);
});
_this.cache.all = {
icons: icons
};
return icons;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSearch", function (event) {
var filter = event.target.value;
if (filter && '' !== filter) {
filter = filter.toLocaleLowerCase();
if (_this.state.filter === filter) {
return;
}
} else {
filter = '';
}
_this.setState({
filter: filter
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setSelected", function (selected) {
elementor.iconManager.setSettings('selectedIcon', selected);
_this.setState({
selected: selected
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSelected", function () {
var selected = _this.state.selected;
if ('' === selected.value && _this.props.selected && _this.props.selected.value) {
selected = {
value: _this.props.selected.value,
library: _this.props.selected.library
};
}
return selected;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "render", function () {
var activeTab = _this.getActiveTab(),
activeTabName = activeTab.name ? activeTab.name : activeTab,
_this$props$showSearc = _this.props.showSearch,
showSearch = _this$props$showSearc === void 0 ? true : _this$props$showSearc,
filter = _this.state.filter;
if ('GoPro' !== activeTab) {
if (!activeTabName || !_this.state.loaded[activeTabName]) {
return 'Loading';
}
if (activeTab) {
activeTab.icons = _this.getActiveTabIcons(activeTab);
}
}
var selected = _this.getSelected();
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__sidebar",
className: 'elementor-templates-modal__sidebar'
}, /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__tab-links"
}, _this.getIconTabsLinks(), _this.getUploadCustomButton(), _this.getIconTabsLinks(false))), /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__main",
className: 'elementor-templates-modal__content'
}, 'GoPro' === activeTabName ? /*#__PURE__*/_react.default.createElement(_iconsGoPro.default, null) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, showSearch ? _this.getSearchHTML() : '', /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__tab__wrapper",
ref: _this.scrollViewRef
}, /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__tab__title"
}, activeTab.label), /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__tab__content_wrapper"
}, /*#__PURE__*/_react.default.createElement("input", {
type: "hidden",
name: "icon_value",
id: "icon_value",
value: selected.value
}), /*#__PURE__*/_react.default.createElement("input", {
type: "hidden",
name: "icon_type",
id: "icon_type",
value: selected.library
}), _this.state.loaded[activeTab.name] ? /*#__PURE__*/_react.default.createElement(_tab.default, (0, _extends2.default)({
setSelected: _this.setSelected,
selected: selected,
filter: filter,
key: activeTab.name,
parentRef: _this.scrollViewRef
}, activeTab)) : 'Loading')))));
});
return _this;
}
(0, _createClass2.default)(IconsManager, [{
key: "updateLoaded",
value: function updateLoaded(libraryName) {
var loaded = this.state.loaded;
loaded[libraryName] = true;
this.setState({
loaded: loaded
});
}
}, {
key: "isNativeTab",
value: function isNativeTab(tab) {
return ('all' === tab.name || 'recommended' === tab.name || 'fa-' === tab.name.substr(0, 3)) && tab.native;
}
}, {
key: "getUploadCustomButton",
value: function getUploadCustomButton() {
var _this2 = this;
var onClick = function onClick() {
if ('GoPro' === _this2.state.activeTab) {
return;
}
_this2.setState({
activeTab: 'GoPro'
});
};
if (this.props.customIconsURL) {
onClick = function onClick() {
window.open(_this2.props.customIconsURL, '_blank');
};
}
return /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__upload"
}, /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__upload__title"
}, __('My Libraries', 'elementor')), /*#__PURE__*/_react.default.createElement("button", {
id: "elementor-icons-manager__upload__button",
className: "elementor-button",
onClick: onClick
}, __('Upload', 'elementor')));
}
}, {
key: "getSearchHTML",
value: function getSearchHTML() {
return /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__search"
}, /*#__PURE__*/_react.default.createElement("input", {
placeholder: 'Filter by name...',
onInput: this.handleSearch
}), /*#__PURE__*/_react.default.createElement("i", {
className: 'eicon-search'
}));
}
}]);
return IconsManager;
}(_react.Component);
var _default = IconsManager;
exports["default"] = _default;
var renderIconManager = function renderIconManager(props) {
var containerElement = document.querySelector('#elementor-icons-manager-modal .dialog-content');
return _react2.default.render( /*#__PURE__*/_react.default.createElement(IconsManager, (0, _extends2.default)({}, props, {
containerElement: containerElement
})), containerElement);
};
exports.renderIconManager = renderIconManager;
IconsManager.propTypes = {
activeTab: _propTypes.default.any,
customIconsURL: _propTypes.default.string,
icons: _propTypes.default.any,
loaded: _propTypes.default.any,
modalView: _propTypes.default.any,
recommended: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
selected: _propTypes.default.any,
showSearch: _propTypes.default.bool
};
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/components/icon.js":
/*!***************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/components/icon.js ***!
\***************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "../node_modules/prop-types/index.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Icon = /*#__PURE__*/function (_Component) {
(0, _inherits2.default)(Icon, _Component);
var _super = _createSuper(Icon);
function Icon() {
var _this;
(0, _classCallCheck2.default)(this, Icon);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setSelected", function () {
_this.props.setSelectedHandler({
value: _this.props.data.displayPrefix + ' ' + _this.props.data.selector,
library: _this.props.library
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "render", function () {
return (
/*#__PURE__*/
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
_react.default.createElement("div", {
className: _this.props.containerClass,
key: _this.props.keyID,
onClick: _this.setSelected,
filter: _this.props.data.filter
}, /*#__PURE__*/_react.default.createElement("div", {
className: "elementor-icons-manager__tab__item__content"
}, /*#__PURE__*/_react.default.createElement("i", {
className: 'elementor-icons-manager__tab__item__icon ' + _this.props.className
}), /*#__PURE__*/_react.default.createElement("div", {
className: 'elementor-icons-manager__tab__item__name',
title: _this.props.data.name
}, _this.props.data.name)))
);
});
return _this;
}
return (0, _createClass2.default)(Icon);
}(_react.Component);
exports["default"] = Icon;
Icon.propTypes = {
className: _propTypes.default.string,
containerClass: _propTypes.default.string,
data: _propTypes.default.object,
keyID: _propTypes.default.string,
library: _propTypes.default.string,
selector: _propTypes.default.string,
setSelectedHandler: _propTypes.default.func
};
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/components/icons-go-pro.js":
/*!***********************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/components/icons-go-pro.js ***!
\***********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var IconsGoPro = /*#__PURE__*/function (_Component) {
(0, _inherits2.default)(IconsGoPro, _Component);
var _super = _createSuper(IconsGoPro);
function IconsGoPro() {
var _this;
(0, _classCallCheck2.default)(this, IconsGoPro);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "render", function () {
return /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__promotion"
}, /*#__PURE__*/_react.default.createElement("i", {
id: "elementor-icons-manager__promotion__icon",
className: "eicon-nerd"
}), /*#__PURE__*/_react.default.createElement("div", {
id: "elementor-icons-manager__promotion__text"
}, __('Become a Pro user to upload unlimited font icon folders to your website.', 'elementor')), /*#__PURE__*/_react.default.createElement("a", {
href: elementor.config.icons.goProURL,
id: "elementor-icons-manager__promotion__link",
className: "elementor-button go-pro",
target: "_blank",
rel: "noopener noreferrer"
}, __('Upgrade Now', 'elementor')));
});
return _this;
}
return (0, _createClass2.default)(IconsGoPro);
}(_react.Component);
var _default = IconsGoPro;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/components/tab.js":
/*!**************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/components/tab.js ***!
\**************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js"));
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "../node_modules/prop-types/index.js"));
var _iconList = _interopRequireDefault(__webpack_require__(/*! ./icon-list */ "../assets/dev/js/editor/components/icons-manager/components/icon-list.js"));
var _icon = _interopRequireDefault(__webpack_require__(/*! ./icon */ "../assets/dev/js/editor/components/icons-manager/components/icon.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Tab = /*#__PURE__*/function (_Component) {
(0, _inherits2.default)(Tab, _Component);
var _super = _createSuper(Tab);
function Tab() {
var _this;
(0, _classCallCheck2.default)(this, Tab);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidMount", function () {
if (_this.props.selected && _this.props.selected.value) {
setTimeout(function () {
var element = document.querySelector('.elementor-selected');
if (element) {
element.scrollIntoView(false);
}
}, 0);
}
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFullIconList", function () {
var fullIconList = [];
Object.entries(_this.props.icons).forEach(function (library) {
if ('recommended' !== library[0]) {
fullIconList = [].concat((0, _toConsumableArray2.default)(fullIconList), (0, _toConsumableArray2.default)(_this.getIconsOfType(library[0], library[1])));
}
});
return fullIconList.sort(function (a, b) {
return a.filter === b.filter ? 0 : +(a.filter > b.filter) || -1;
});
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getLibrary", function (libraryName) {
var icons = elementor.config.icons.libraries.filter(function (library) {
return libraryName === library.name;
});
return icons;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRecommendedList", function () {
var recommendedIconList = [];
Object.entries(_this.props.icons).forEach(function (library) {
var iconLibrary = _this.getLibrary(library[0]),
iconsOfType = iconLibrary[0].icons,
recommendedIconsOfType = {};
library[1].forEach(function (iconName) {
if (iconsOfType[iconName]) {
recommendedIconsOfType[iconName] = iconsOfType[iconName];
}
});
recommendedIconList = [].concat((0, _toConsumableArray2.default)(recommendedIconList), (0, _toConsumableArray2.default)(_this.getIconsOfType(library[0], recommendedIconsOfType)));
});
return recommendedIconList;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getIconsComponentList", function () {
var iconsToShow = [];
var _this$props = _this.props,
name = _this$props.name,
icons = _this$props.icons,
filter = _this$props.filter;
switch (name) {
case 'all':
iconsToShow = _this.handleFullIconList();
break;
case 'recommended':
iconsToShow = _this.handleRecommendedList();
break;
default:
iconsToShow = _this.getIconsOfType(name, icons);
break;
}
if (filter) {
iconsToShow = Object.values(iconsToShow).filter(function (icon) {
return icon.props.data.name.toLowerCase().indexOf(filter) > -1;
});
}
return iconsToShow;
});
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "render", function () {
var icons = _this.getIconsComponentList();
var selectedIndex = -1;
var _iterator = _createForOfIteratorHelper(icons.entries()),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
index = _step$value[0],
icon = _step$value[1];
if (icon.props.containerClass.includes('elementor-selected')) {
selectedIndex = index;
break;
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return /*#__PURE__*/_react.default.createElement(_iconList.default, {
selectedIndex: selectedIndex,
items: icons,
parentRef: _this.props.parentRef
});
});
return _this;
}
(0, _createClass2.default)(Tab, [{
key: "getIconsOfType",
value: function getIconsOfType(type, icons) {
var _this2 = this;
var _this$props2 = this.props,
selected = _this$props2.selected,
filter = _this$props2.filter;
return Object.entries(icons).map(function (icon) {
var iconData = icon[1],
iconName = icon[0],
className = iconData.displayPrefix + ' ' + iconData.selector;
var containerClass = 'elementor-icons-manager__tab__item';
if (selected.value === className) {
containerClass += ' elementor-selected';
}
var key = containerClass + type + '-' + iconName + filter;
return /*#__PURE__*/_react.default.createElement(_icon.default, {
key: key,
library: type,
keyID: iconName,
containerClass: containerClass,
className: className,
setSelectedHandler: _this2.props.setSelected,
data: iconData
});
});
}
}]);
return Tab;
}(_react.Component);
Tab.propTypes = {
data: _propTypes.default.any,
filter: _propTypes.default.any,
icons: _propTypes.default.object,
name: _propTypes.default.string,
selected: _propTypes.default.object,
setSelected: _propTypes.default.func,
parentRef: _propTypes.default.any
};
var _default = Tab;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/icons-manager.js":
/*!*************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/icons-manager.js ***!
\*************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _modalLayout = _interopRequireDefault(__webpack_require__(/*! ./modal-layout */ "../assets/dev/js/editor/components/icons-manager/modal-layout.js"));
var _iconManager = __webpack_require__(/*! ./components/icon-manager */ "../assets/dev/js/editor/components/icons-manager/components/icon-manager.js");
var _iconLibrary = _interopRequireDefault(__webpack_require__(/*! ./classes/icon-library */ "../assets/dev/js/editor/components/icons-manager/classes/icon-library.js"));
var _store = _interopRequireDefault(__webpack_require__(/*! ./classes/store */ "../assets/dev/js/editor/components/icons-manager/classes/store.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_elementorModules$Mod) {
(0, _inherits2.default)(_default, _elementorModules$Mod);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "onInit",
value: function onInit() {
// Init icon library helper
this.library = new _iconLibrary.default();
// Init Icon library Storage helper
this.store = new _store.default();
// Fetch fa4 to fa5 migration data
elementor.helpers.fetchFa4ToFa5Mapping();
this.cache = {};
}
}, {
key: "getLayout",
value: function getLayout() {
var _this = this;
if (!this.layout) {
this.layout = new _modalLayout.default();
var layoutModal = this.layout.getModal();
layoutModal.addButton({
name: 'insert_icon',
text: __('Insert', 'elementor'),
classes: 'elementor-button e-primary',
callback: function callback() {
_this.updateControlValue();
_this.unMountIconManager();
}
});
layoutModal.on('show', this.onPickerShow.bind(this)).on('hide', this.unMountIconManager.bind(this));
}
return this.layout;
}
}, {
key: "getDefaultSettings",
value: function getDefaultSettings() {
return {
selectedIcon: {}
};
}
}, {
key: "unMountIconManager",
value: function unMountIconManager() {
this.unmount();
}
}, {
key: "loadIconLibraries",
value: function loadIconLibraries() {
if (!this.cache.loaded) {
elementor.config.icons.libraries.forEach(function (library) {
if ('all' === library.name) {
return;
}
elementor.iconManager.library.initIconType(library);
});
this.cache.loaded = true;
}
}
}, {
key: "onPickerShow",
value: function onPickerShow() {
var controlView = this.getSettings('controlView'),
loaded = {
GoPro: true
},
iconManagerConfig = {
recommended: controlView.model.get('recommended') || false
};
var selected = controlView.getControlValue(),
icons = elementor.config.icons.libraries;
if (!selected.library || !selected.value) {
selected = {
value: '',
library: ''
};
}
iconManagerConfig.selected = selected;
this.setSettings('selectedIcon', selected);
if (iconManagerConfig.recommended) {
var hasRecommended = false;
icons.forEach(function (library, index) {
if ('recommended' === library.name) {
hasRecommended = true;
icons[index].icons = iconManagerConfig.recommended;
}
});
if (!hasRecommended) {
icons.unshift({
name: 'recommended',
label: 'Recommended',
icons: iconManagerConfig.recommended,
labelIcon: 'eicon-star-o',
native: true
});
}
} else {
icons = icons.filter(function (library) {
return 'recommended' !== library.name;
});
}
icons.forEach(function (tab, index) {
if (-1 === ['all', 'recommended'].indexOf(tab.name)) {
elementor.iconManager.library.initIconType(tab, function (lib) {
icons[index] = lib;
});
}
loaded[tab.name] = true;
});
iconManagerConfig.loaded = loaded;
iconManagerConfig.icons = icons;
// Set active tab
var activeTab = selected.library || icons[0].name;
if ('svg' === selected.library) {
activeTab = icons[0].name;
}
// Selected Library exists
if (!Object.keys(icons).some(function (library) {
return library === activeTab;
})) {
activeTab = icons[0].name;
}
// Show recommended tab if selected from it
if (iconManagerConfig.recommended && '' !== selected.library && '' !== selected.value && Object.prototype.hasOwnProperty.call(iconManagerConfig.recommended, selected.library)) {
var iconLibrary = icons.filter(function (library) {
return selected.library === library.name;
});
var selectedIconName = selected.value.replace(iconLibrary[0].displayPrefix + ' ' + iconLibrary[0].prefix, '');
if (iconManagerConfig.recommended[selected.library].some(function (icon) {
return -1 < icon.indexOf(selectedIconName);
})) {
activeTab = icons[0].name;
}
}
iconManagerConfig.customIconsURL = elementor.config.customIconsURL;
iconManagerConfig.activeTab = activeTab;
var _renderIconManager = (0, _iconManager.renderIconManager)(iconManagerConfig),
unmount = _renderIconManager.unmount;
this.unmount = unmount;
}
}, {
key: "updateControlValue",
value: function updateControlValue() {
var settings = this.getSettings();
settings.controlView.setValue(settings.selectedIcon);
settings.controlView.applySavedValue();
}
}, {
key: "show",
value: function show(options) {
this.setSettings('controlView', options.view);
this.getLayout().showModal(options);
}
}]);
return _default;
}(elementorModules.Module);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/icons-manager/modal-layout.js":
/*!************************************************************************!*\
!*** ../assets/dev/js/editor/components/icons-manager/modal-layout.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get3 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _layout = _interopRequireDefault(__webpack_require__(/*! elementor-common/views/modal/layout */ "../core/common/assets/js/views/modal/layout.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_BaseModalLayout) {
(0, _inherits2.default)(_default, _BaseModalLayout);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "getModalOptions",
value: function getModalOptions() {
return {
id: 'elementor-icons-manager-modal'
};
}
}, {
key: "getLogoOptions",
value: function getLogoOptions() {
return {
title: __('Icon Library', 'elementor')
};
}
}, {
key: "initialize",
value: function initialize() {
var _get2;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
(_get2 = (0, _get3.default)((0, _getPrototypeOf2.default)(_default.prototype), "initialize", this)).call.apply(_get2, [this].concat(args));
this.showLogo();
}
}]);
return _default;
}(_layout.default);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/preview/commands/drop.js":
/*!*******************************************************************!*\
!*** ../assets/dev/js/editor/components/preview/commands/drop.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.Drop = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Drop = /*#__PURE__*/function (_$e$modules$CommandBa) {
(0, _inherits2.default)(Drop, _$e$modules$CommandBa);
var _super = _createSuper(Drop);
function Drop() {
(0, _classCallCheck2.default)(this, Drop);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Drop, [{
key: "validateArgs",
value: function validateArgs() {
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.requireContainer(args);
this.requireArgumentType('model', 'object', args);
}
}, {
key: "apply",
value: function apply() {
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _args$containers = args.containers,
containers = _args$containers === void 0 ? [args.container] : _args$containers,
_args$options = args.options,
options = _args$options === void 0 ? {} : _args$options,
result = [];
containers.forEach(function (container) {
result.push(container.view.createElementFromModel(args.model, options));
});
if (1 === containers.length) {
return result[0];
}
return result;
}
}]);
return Drop;
}($e.modules.CommandBase);
exports.Drop = Drop;
/***/ }),
/***/ "../assets/dev/js/editor/components/preview/commands/index.js":
/*!********************************************************************!*\
!*** ../assets/dev/js/editor/components/preview/commands/index.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "Drop", ({
enumerable: true,
get: function get() {
return _drop.Drop;
}
}));
Object.defineProperty(exports, "Reload", ({
enumerable: true,
get: function get() {
return _reload.Reload;
}
}));
var _drop = __webpack_require__(/*! ./drop */ "../assets/dev/js/editor/components/preview/commands/drop.js");
var _reload = __webpack_require__(/*! ./reload */ "../assets/dev/js/editor/components/preview/commands/reload.js");
/***/ }),
/***/ "../assets/dev/js/editor/components/preview/commands/reload.js":
/*!*********************************************************************!*\
!*** ../assets/dev/js/editor/components/preview/commands/reload.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.Reload = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Reload = /*#__PURE__*/function (_$e$modules$CommandBa) {
(0, _inherits2.default)(Reload, _$e$modules$CommandBa);
var _super = _createSuper(Reload);
function Reload() {
(0, _classCallCheck2.default)(this, Reload);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Reload, [{
key: "apply",
value: function apply() {
elementor.reloadPreview();
}
}]);
return Reload;
}($e.modules.CommandBase);
exports.Reload = Reload;
/***/ }),
/***/ "../assets/dev/js/editor/components/preview/component.js":
/*!***************************************************************!*\
!*** ../assets/dev/js/editor/components/preview/component.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var commands = _interopRequireWildcard(__webpack_require__(/*! ./commands/ */ "../assets/dev/js/editor/components/preview/commands/index.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Component = /*#__PURE__*/function (_$e$modules$Component) {
(0, _inherits2.default)(Component, _$e$modules$Component);
var _super = _createSuper(Component);
function Component() {
(0, _classCallCheck2.default)(this, Component);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Component, [{
key: "getNamespace",
value: function getNamespace() {
return 'preview';
}
}, {
key: "defaultCommands",
value: function defaultCommands() {
return this.importCommands(commands);
}
}]);
return Component;
}($e.modules.ComponentBase);
exports["default"] = Component;
/***/ }),
/***/ "../assets/dev/js/editor/components/selection/manager.js":
/*!***************************************************************!*\
!*** ../assets/dev/js/editor/components/selection/manager.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* @typedef {import('../../container/container')} Container
*/
var Manager = /*#__PURE__*/function (_elementorModules$edi) {
(0, _inherits2.default)(Manager, _elementorModules$edi);
var _super = _createSuper(Manager);
/**
* Manager constructor.
*
* @return {Manager} manager
*/
function Manager() {
var _this;
(0, _classCallCheck2.default)(this, Manager);
_this = _super.call(this);
// Using a Proxy in order to use update methods only once on external invocations, but internally the `add` or
// `remove` methods may be executed many times, when update methods will be used only once.
/**
* Selected elements.
*
* The list of the selected elements.
*
* @type {{}}
*/
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "elements", {});
/**
* Selected elements type.
*
* Represents the common type of multiple selected elements, or false when the selected elements are of different
* types.
*
* @type {string|boolean}
*/
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", false);
return (0, _possibleConstructorReturn2.default)(_this, new Proxy((0, _assertThisInitialized2.default)(_this), {
get: function get(target, prop) {
if (['add', 'remove'].includes(prop)) {
return function () {
var result = target[prop].apply(target, arguments);
target.updateType();
target.updateSortable();
target.updatePanelPage();
target.updateNavigator();
return result;
};
}
return Reflect.get.apply(Reflect, arguments);
}
}));
}
/**
* Get selection elements.
*
* Get the list of selected elements as an array of containers. If a fallback element container specified, it will
* be returned when there are no selected elements.
*
* @param {Container[]|Container} fallback
* @return {Container[]} selection elements
*/
(0, _createClass2.default)(Manager, [{
key: "getElements",
value: function getElements() {
var fallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var result = Object.values(this.elements);
if (!result.length && fallback) {
result = Array.isArray(fallback) ? fallback : [fallback];
}
return result;
}
/**
* Add elements to selection.
*
* Add new elements to selection by their container, and clear the currently selected elements unless appending is
* active, in which case the new elements are just added to the current selection.
*
* @param {Container[]|Container} containers
* @param {boolean} append
*/
}, {
key: "add",
value: function add(containers) {
var append = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
containers = Array.isArray(containers) ? containers : [containers];
// If command/ctrl+click not clicked, clear selected elements.
if (!append) {
this.remove([], true);
}
var _iterator = _createForOfIteratorHelper(containers),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var container = _step.value;
this.elements[container.id] = container;
container.view.select();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
/**
* Remove elements from selection.
*
* Remove elements from selection by their container, unless the parameter for clearing all selected elements is
* active, in which case the the whole selection is cleared.
*
* @param {Container[]|Container} containers
* @param {boolean} all
*/
}, {
key: "remove",
value: function remove(containers) {
var all = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
containers = Array.isArray(containers) ? containers : [containers];
if (all) {
containers = this.getElements();
}
var _iterator2 = _createForOfIteratorHelper(containers),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var container = _step2.value;
delete this.elements[container.id];
container.view.deselect();
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
}
/**
* Does element selected.
*
* Check whether an element container exists in the selected elements.
*
* @param {Container} container
* @return {boolean} true if the container exists in the selected elements
*/
}, {
key: "has",
value: function has(container) {
return this.getElements().includes(container);
}
/**
* Update selected elements type.
*
* Resolve the common type of all selected elements and assign it as class property. When the selected objects are
* of different types, `false` is assigned.
*/
}, {
key: "updateType",
value: function updateType() {
var elements = this.getElements();
this.type = Boolean(elements.length) && elements.reduce(function (previous, current) {
if (previous === current.type) {
return current.type;
}
return false;
}, elements[0].type);
}
/**
* Update sortable state.
*
* In case more than one element is selected, currently sorting supposed to be disabled, and vice-versa.
*/
}, {
key: "updateSortable",
value: function updateSortable() {
elementor.toggleSortableState(!this.isMultiple());
}
/**
* Update the panel page.
*
* Selected elements affect the panel panel in a way that when element is selected - its settings page is displayed,
* and when the element is blurred (unfocused) - the the default page opened. When more than one element selected,
* the default page should appear.
*/
}, {
key: "updatePanelPage",
value: function updatePanelPage() {
var elements = this.getElements();
if (1 === elements.length) {
$e.run('panel/editor/open', {
model: elements[0].model,
view: elements[0].view
});
} else {
$e.internal('panel/open-default', {
autoFocusSearch: false
});
}
}
/**
* Update navigator selections.
*
* Any change in the document selected elements should be reflected in the navigator, this method is responsible for
* updating the navigator.
*/
}, {
key: "updateNavigator",
value: function updateNavigator() {
if (!$e.components.get('document/elements').utils.showNavigator()) {
return;
}
elementor.navigator.getLayout().elements.currentView.recursiveChildInvoke('updateSelection');
}
/**
* Is multiple selection.
*
* Check whether multiple elements were selected.
*
* @return {boolean} true if multiple elements were selected
*/
}, {
key: "isMultiple",
value: function isMultiple() {
return this.getElements().length > 1;
}
/**
* Is selection of same type.
*
* Check whether the selected elements are of same type.
*
* @return {boolean} true if the selected elements are of same type
*/
}, {
key: "isSameType",
value: function isSameType() {
return !this.getElements().length || Boolean(this.type);
}
}]);
return Manager;
}(elementorModules.editor.utils.Module);
exports["default"] = Manager;
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/base/manager.js":
/*!*******************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/base/manager.js ***!
\*******************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var ControlsCSSParser = __webpack_require__(/*! elementor-editor-utils/controls-css-parser */ "../assets/dev/js/editor/utils/controls-css-parser.js");
module.exports = elementorModules.ViewModule.extend({
model: null,
hasChange: false,
changeCallbacks: {},
addChangeCallback: function addChangeCallback(attribute, callback) {
this.changeCallbacks[attribute] = callback;
},
bindEvents: function bindEvents() {
elementor.on('document:loaded', this.onElementorDocumentLoaded);
this.model.on('change', this.onModelChange);
},
unbindEvents: function unbindEvents() {
elementor.off('document:loaded', this.onElementorDocumentLoaded);
},
addPanelPage: function addPanelPage() {
var name = this.getSettings('name');
elementor.getPanelView().addPage(name + '_settings', {
view: elementor.settings.panelPages[name] || elementor.settings.panelPages.base,
title: this.getSettings('panelPage.title'),
options: {
editedView: this.getEditedView(),
model: this.model,
controls: this.model.controls,
name: name
}
});
},
getContainerType: function getContainerType() {
return this.getSettings('name') + '_settings';
},
/**
* @deprecated since 3.7.0, use `getContainerType()` instead.
*/
getContainerId: function getContainerId() {
elementorDevTools.deprecation.deprecated('getContainerId()', '3.7.0', 'getContainerType()');
return this.getContainerType();
},
// Emulate an element view/model structure with the parts needed for a container.
getEditedView: function getEditedView() {
var documentElementType = elementor.elementsManager.getElementTypeClass('document'),
ModelClass = documentElementType.getModel(),
type = this.getContainerType(),
editModel = new ModelClass({
id: type,
elType: type,
settings: this.model
});
var container = new elementorModules.editor.Container({
type: type,
id: type,
model: editModel,
settings: editModel.get('settings'),
view: false,
parent: false,
label: this.getSettings('panelPage').title,
controls: this.model.controls,
document: this.getDocument(),
renderer: false
});
return {
getContainer: function getContainer() {
return container;
},
getEditModel: function getEditModel() {
return editModel;
},
model: editModel,
container: container
};
},
getDocument: function getDocument() {
return false;
},
updateStylesheet: function updateStylesheet(keepOldEntries) {
var controlsCSS = this.getControlsCSS();
if (!keepOldEntries) {
controlsCSS.stylesheet.empty();
}
this.model.handleRepeaterData(this.model.attributes);
controlsCSS.addStyleRules(this.model.getStyleControls(), this.model.attributes, this.model.controls, [/{{WRAPPER}}/g], [this.getSettings('cssWrapperSelector')]);
controlsCSS.addStyleToDocument({
// Ensures we don't override default global style
at: 'before',
of: '#elementor-style-e-global-style'
});
},
initModel: function initModel() {
this.model = new elementorModules.editor.elements.models.BaseSettings(this.getSettings('settings'), {
controls: this.getSettings('controls')
});
},
getStyleId: function getStyleId() {
return this.getSettings('name');
},
initControlsCSSParser: function initControlsCSSParser() {
var controlsCSS;
this.destroyControlsCSS = function () {
controlsCSS.removeStyleFromDocument();
};
this.getControlsCSS = function () {
if (!controlsCSS) {
controlsCSS = new ControlsCSSParser({
id: this.getStyleId(),
settingsModel: this.model,
context: this.getEditedView()
});
}
return controlsCSS;
};
},
getDataToSave: function getDataToSave(data) {
return data;
},
save: function save(callback) {
var _this = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var self, settings, data;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
self = _this;
if (self.hasChange) {
_context.next = 3;
break;
}
return _context.abrupt("return");
case 3:
settings = _this.model.toJSON({
remove: ['default']
}), data = _this.getDataToSave({
data: settings
});
NProgress.start();
return _context.abrupt("return", elementorCommon.ajax.addRequest('save_' + _this.getSettings('name') + '_settings', {
data: data,
success: function success() {
NProgress.done();
self.setSettings('settings', settings);
self.hasChange = false;
if (callback) {
callback.apply(self, arguments);
}
},
error: function error() {
// eslint-disable-next-line no-alert
alert('An error occurred.');
}
}));
case 6:
case "end":
return _context.stop();
}
}, _callee);
}))();
},
onInit: function onInit() {
this.initModel();
this.initControlsCSSParser();
this.addPanelMenuItem();
this.debounceSave = _.debounce(this.save, 3000);
elementorModules.ViewModule.prototype.onInit.apply(this, arguments);
},
/**
* BC for custom settings without a JS component.
*/
addPanelMenuItem: function addPanelMenuItem() {
var menuSettings = this.getSettings('panelPage.menu');
if (!menuSettings) {
return;
}
var namespace = 'panel/' + this.getSettings('name') + '-settings',
menuItemOptions = {
icon: menuSettings.icon,
title: this.getSettings('panelPage.title'),
type: 'page',
pageName: this.getSettings('name') + '_settings',
callback: function callback() {
return $e.route("".concat(namespace, "/settings"));
}
};
$e.bc.ensureTab(namespace, 'settings', menuItemOptions.pageName);
elementor.modules.layouts.panel.pages.menu.Menu.addItem(menuItemOptions, 'settings', menuSettings.beforeItem);
},
onModelChange: function onModelChange(model) {
var self = this;
self.hasChange = true;
this.getControlsCSS().stylesheet.empty();
_.each(model.changed, function (value, key) {
if (self.changeCallbacks[key]) {
self.changeCallbacks[key].call(self, value);
}
});
self.updateStylesheet(true);
self.debounceSave();
},
onElementorDocumentLoaded: function onElementorDocumentLoaded() {
this.updateStylesheet();
this.addPanelPage();
},
destroy: function destroy() {
this.unbindEvents();
this.model.destroy();
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/base/panel.js":
/*!*****************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/base/panel.js ***!
\*****************************************************************/
/***/ ((module) => {
"use strict";
module.exports = elementorModules.editor.views.ControlsStack.extend({
id: function id() {
return 'elementor-panel-' + this.getOption('name') + '-settings';
},
getTemplate: function getTemplate() {
return '#tmpl-elementor-panel-' + this.getOption('name') + '-settings';
},
childViewContainer: function childViewContainer() {
return '#elementor-panel-' + this.getOption('name') + '-settings-controls';
},
childViewOptions: function childViewOptions() {
return {
container: this.getOption('editedView').getContainer()
};
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/editor-preferences/manager.js":
/*!*********************************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/editor-preferences/manager.js ***!
\*********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _manager = _interopRequireDefault(__webpack_require__(/*! ../base/manager */ "../assets/dev/js/editor/components/settings/base/manager.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_BaseManager) {
(0, _inherits2.default)(_default, _BaseManager);
var _super = _createSuper(_default);
function _default() {
var _this;
(0, _classCallCheck2.default)(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.changeCallbacks = {
ui_theme: _this.onUIThemeChanged,
panel_width: _this.onPanelWidthChanged,
edit_buttons: _this.onEditButtonsChanged,
show_hidden_elements: _this.onShowHiddenElementsChange
};
return _this;
}
(0, _createClass2.default)(_default, [{
key: "getDefaultSettings",
value: function getDefaultSettings() {
return {
darkModeLinkID: 'elementor-editor-dark-mode-css'
};
}
}, {
key: "onUIThemeChanged",
value: function onUIThemeChanged(newValue) {
var $lightUi = jQuery('#e-theme-ui-light-css');
var $darkUi = jQuery('#e-theme-ui-dark-css');
if ('auto' === newValue) {
$lightUi.attr('media', '(prefers-color-scheme: light)');
$darkUi.attr('media', '(prefers-color-scheme: dark)');
return;
}
if ('light' === newValue) {
$lightUi.attr('media', 'all');
$darkUi.attr('media', 'none');
} else {
$lightUi.attr('media', 'none');
$darkUi.attr('media', 'all');
}
}
}, {
key: "onPanelWidthChanged",
value: function onPanelWidthChanged(newValue) {
elementor.panel.saveSize({
width: newValue.size + newValue.unit
});
elementor.panel.setSize();
}
}, {
key: "onEditButtonsChanged",
value: function onEditButtonsChanged() {
// Let the button change before the high-performance action of rendering the entire page
setTimeout(function () {
return elementor.getPreviewView()._renderChildren();
}, 300);
}
}, {
key: "onShowHiddenElementsChange",
value: function onShowHiddenElementsChange() {
elementorFrontend.elements.$body.toggleClass('e-preview--show-hidden-elements');
}
}]);
return _default;
}(_manager.default);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/page/component.js":
/*!*********************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/page/component.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _componentBase = _interopRequireDefault(__webpack_require__(/*! elementor-editor/component-base */ "../assets/dev/js/editor/component-base.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Component = /*#__PURE__*/function (_ComponentBase) {
(0, _inherits2.default)(Component, _ComponentBase);
var _super = _createSuper(Component);
function Component() {
(0, _classCallCheck2.default)(this, Component);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Component, [{
key: "getNamespace",
value: function getNamespace() {
return 'panel/page-settings';
}
}, {
key: "defaultTabs",
value: function defaultTabs() {
return {
settings: {
title: __('Settings', 'elementor')
},
style: {
title: __('Style', 'elementor')
},
advanced: {
title: __('Advanced', 'elementor')
}
};
}
}, {
key: "renderTab",
value: function renderTab(tab, args) {
var activeControl = args.activeControl,
_args$refresh = args.refresh,
refresh = _args$refresh === void 0 ? false : _args$refresh;
if (this.shouldRenderPage(tab) || refresh) {
elementor.getPanelView().setPage('page_settings').activateTab(tab);
}
this.activateControl(activeControl);
}
}, {
key: "shouldRenderPage",
value: function shouldRenderPage(tab) {
var _currentPanelView$get;
var currentPanelView = elementor.getPanelView();
var isSamePage = 'page_settings' === currentPanelView.getCurrentPageName();
var isSameTab = tab === ((_currentPanelView$get = currentPanelView.getCurrentPageView()) === null || _currentPanelView$get === void 0 ? void 0 : _currentPanelView$get.activeTab);
return !isSamePage || !isSameTab;
}
}, {
key: "getTabsWrapperSelector",
value: function getTabsWrapperSelector() {
return '.elementor-panel-navigation';
}
}]);
return Component;
}(_componentBase.default);
exports["default"] = Component;
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/page/manager.js":
/*!*******************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/page/manager.js ***!
\*******************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ "../node_modules/@babel/runtime/helpers/construct.js"));
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js"));
var _component = _interopRequireDefault(__webpack_require__(/*! ./component */ "../assets/dev/js/editor/components/settings/page/component.js"));
var _childrenArray = _interopRequireDefault(__webpack_require__(/*! elementor-editor/container/model/children-array */ "../assets/dev/js/editor/container/model/children-array.js"));
var BaseSettings = __webpack_require__(/*! elementor-editor/components/settings/base/manager */ "../assets/dev/js/editor/components/settings/base/manager.js");
module.exports = BaseSettings.extend({
getStyleId: function getStyleId() {
return this.getSettings('name') + '-' + elementor.documents.getCurrent().id;
},
onInit: function onInit() {
BaseSettings.prototype.onInit.apply(this);
$e.components.register(new _component.default({
manager: this
}));
},
save: function save() {},
getDataToSave: function getDataToSave(data) {
data.id = elementor.config.document.id;
return data;
},
// Emulate an element view/model structure with the parts needed for a container.
getEditedView: function getEditedView() {
var _this = this;
if (this.editedView) {
return this.editedView;
}
var documentElementType = elementor.elementsManager.getElementTypeClass('document'),
ModelClass = documentElementType.getModel(),
type = this.getContainerType(),
editModel = new ModelClass({
id: type,
elType: type,
settings: this.model,
elements: elementor.elements
}),
container = new elementorModules.editor.Container({
type: type,
id: editModel.id,
model: editModel,
settings: editModel.get('settings'),
label: elementor.config.document.panel.title,
controls: this.model.controls,
children: (0, _construct2.default)(_childrenArray.default, (0, _toConsumableArray2.default)(elementor.elements || [])),
parent: false,
// Emulate a view that can render the style.
renderer: {
view: {
lookup: function lookup() {
return container;
},
renderOnChange: function renderOnChange() {
return _this.updateStylesheet();
},
renderUI: function renderUI() {
return _this.updateStylesheet();
}
}
}
});
this.editedView = {
getContainer: function getContainer() {
return container;
},
getEditModel: function getEditModel() {
return editModel;
},
model: editModel,
container: container
};
return this.editedView;
},
getContainerType: function getContainerType() {
return 'document';
},
/**
* @deprecated since 3.7.0, use `getContainerType()` instead.
*/
getContainerId: function getContainerId() {
elementorDevTools.deprecation.deprecated('getContainerId()', '3.7.0', 'getContainerType()');
return this.getContainerType();
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/settings/settings.js":
/*!***************************************************************!*\
!*** ../assets/dev/js/editor/components/settings/settings.js ***!
\***************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _manager = _interopRequireDefault(__webpack_require__(/*! ./editor-preferences/manager */ "../assets/dev/js/editor/components/settings/editor-preferences/manager.js"));
module.exports = elementorModules.Module.extend({
modules: {
base: __webpack_require__(/*! elementor-editor/components/settings/base/manager */ "../assets/dev/js/editor/components/settings/base/manager.js"),
page: __webpack_require__(/*! elementor-editor/components/settings/page/manager */ "../assets/dev/js/editor/components/settings/page/manager.js"),
editorPreferences: _manager.default
},
panelPages: {
base: __webpack_require__(/*! elementor-editor/components/settings/base/panel */ "../assets/dev/js/editor/components/settings/base/panel.js")
},
onInit: function onInit() {
this.initSettings();
},
initSettings: function initSettings() {
var self = this;
_.each(elementor.config.settings, function (config, name) {
var Manager = self.modules[name] || self.modules.base;
self[name] = new Manager(config);
});
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/behaviors/insert-template.js":
/*!****************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/behaviors/insert-template.js ***!
\****************************************************************************************/
/***/ ((module) => {
"use strict";
var InsertTemplateHandler;
InsertTemplateHandler = Marionette.Behavior.extend({
ui: {
insertButton: '.elementor-template-library-template-insert'
},
events: {
'click @ui.insertButton': 'onInsertButtonClick'
},
onInsertButtonClick: function onInsertButtonClick() {
var args = {
model: this.view.model
};
this.ui.insertButton.addClass('elementor-disabled');
if ('remote' === args.model.get('source') && !elementor.config.library_connect.is_connected) {
$e.route('library/connect', args);
return;
}
$e.run('library/insert-template', args);
}
});
module.exports = InsertTemplateHandler;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/collections/templates.js":
/*!************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/collections/templates.js ***!
\************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TemplateLibraryTemplateModel = __webpack_require__(/*! elementor-templates/models/template */ "../assets/dev/js/editor/components/template-library/models/template.js"),
TemplateLibraryCollection;
TemplateLibraryCollection = Backbone.Collection.extend({
model: TemplateLibraryTemplateModel
});
module.exports = TemplateLibraryCollection;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/commands-data/index.js":
/*!**********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/commands-data/index.js ***!
\**********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "Templates", ({
enumerable: true,
get: function get() {
return _templates.Templates;
}
}));
var _templates = __webpack_require__(/*! ./templates */ "../assets/dev/js/editor/components/template-library/commands-data/templates.js");
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/commands-data/templates.js":
/*!**************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/commands-data/templates.js ***!
\**************************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = exports.Templates = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Templates = /*#__PURE__*/function (_$e$modules$CommandDa) {
(0, _inherits2.default)(Templates, _$e$modules$CommandDa);
var _super = _createSuper(Templates);
function Templates() {
(0, _classCallCheck2.default)(this, Templates);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Templates, null, [{
key: "getEndpointFormat",
value: function getEndpointFormat() {
return 'template-library/templates';
}
}]);
return Templates;
}($e.modules.CommandData);
exports.Templates = Templates;
var _default = Templates;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/commands/index.js":
/*!*****************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/commands/index.js ***!
\*****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "InsertTemplate", ({
enumerable: true,
get: function get() {
return _insertTemplate.InsertTemplate;
}
}));
Object.defineProperty(exports, "Open", ({
enumerable: true,
get: function get() {
return _open.Open;
}
}));
var _insertTemplate = __webpack_require__(/*! ./insert-template */ "../assets/dev/js/editor/components/template-library/commands/insert-template.js");
var _open = __webpack_require__(/*! ./open */ "../assets/dev/js/editor/components/template-library/commands/open.js");
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/commands/insert-template.js":
/*!***************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/commands/insert-template.js ***!
\***************************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = exports.InsertTemplate = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var InsertTemplate = /*#__PURE__*/function (_$e$modules$CommandBa) {
(0, _inherits2.default)(InsertTemplate, _$e$modules$CommandBa);
var _super = _createSuper(InsertTemplate);
function InsertTemplate() {
(0, _classCallCheck2.default)(this, InsertTemplate);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(InsertTemplate, [{
key: "apply",
value: function apply(args) {
return this.component.insertTemplate(args);
}
}]);
return InsertTemplate;
}($e.modules.CommandBase);
exports.InsertTemplate = InsertTemplate;
var _default = InsertTemplate;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/commands/open.js":
/*!****************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/commands/open.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = exports.Open = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Open = /*#__PURE__*/function (_$e$modules$CommandBa) {
(0, _inherits2.default)(Open, _$e$modules$CommandBa);
var _super = _createSuper(Open);
function Open() {
(0, _classCallCheck2.default)(this, Open);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Open, [{
key: "apply",
value: function apply(args) {
return this.component.show(args);
}
}]);
return Open;
}($e.modules.CommandBase);
exports.Open = Open;
var _default = Open;
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/component.js":
/*!************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/component.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _componentModalBase = _interopRequireDefault(__webpack_require__(/*! elementor-api/modules/component-modal-base */ "../modules/web-cli/assets/js/modules/component-modal-base.js"));
var commands = _interopRequireWildcard(__webpack_require__(/*! ./commands/ */ "../assets/dev/js/editor/components/template-library/commands/index.js"));
var commandsData = _interopRequireWildcard(__webpack_require__(/*! ./commands-data/ */ "../assets/dev/js/editor/components/template-library/commands-data/index.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var TemplateLibraryLayoutView = __webpack_require__(/*! elementor-templates/views/library-layout */ "../assets/dev/js/editor/components/template-library/views/library-layout.js");
var Component = /*#__PURE__*/function (_ComponentModalBase) {
(0, _inherits2.default)(Component, _ComponentModalBase);
var _super = _createSuper(Component);
function Component() {
(0, _classCallCheck2.default)(this, Component);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(Component, [{
key: "__construct",
value: function __construct(args) {
(0, _get2.default)((0, _getPrototypeOf2.default)(Component.prototype), "__construct", this).call(this, args);
// When switching documents update defaultTabs.
elementor.on('document:loaded', this.onDocumentLoaded.bind(this));
// Remove whole component cache data.
$e.data.deleteCache(this, 'library');
}
}, {
key: "getNamespace",
value: function getNamespace() {
return 'library';
}
}, {
key: "defaultTabs",
value: function defaultTabs() {
return {
'templates/blocks': {
title: __('Blocks', 'elementor'),
getFilter: function getFilter() {
return {
source: 'remote',
type: 'block',
subtype: elementor.config.document.remoteLibrary.category
};
}
},
'templates/pages': {
title: __('Pages', 'elementor'),
filter: {
source: 'remote',
type: 'page'
}
},
'templates/my-templates': {
title: __('My Templates', 'elementor'),
filter: {
source: 'local'
}
}
};
}
}, {
key: "defaultRoutes",
value: function defaultRoutes() {
var _this = this;
return {
import: function _import() {
_this.manager.layout.showImportView();
},
'save-template': function saveTemplate(args) {
_this.manager.layout.showSaveTemplateView(args.model);
},
preview: function preview(args) {
_this.manager.layout.showPreviewView(args.model);
},
connect: function connect(args) {
args.texts = {
title: __('Connect to Template Library', 'elementor'),
message: __('Access this template and our entire library by creating a free personal account', 'elementor'),
button: __('Get Started', 'elementor')
};
_this.manager.layout.showConnectView(args);
}
};
}
}, {
key: "defaultCommands",
value: function defaultCommands() {
var modalCommands = (0, _get2.default)((0, _getPrototypeOf2.default)(Component.prototype), "defaultCommands", this).call(this);
return _objectSpread(_objectSpread({}, modalCommands), this.importCommands(commands));
}
}, {
key: "defaultData",
value: function defaultData() {
return this.importCommands(commandsData);
}
}, {
key: "defaultShortcuts",
value: function defaultShortcuts() {
return {
open: {
keys: 'ctrl+shift+l'
}
};
}
}, {
key: "onDocumentLoaded",
value: function onDocumentLoaded(document) {
this.setDefaultRoute(document.config.remoteLibrary.default_route);
this.maybeOpenLibrary();
}
}, {
key: "renderTab",
value: function renderTab(tab) {
var currentTab = this.tabs[tab],
filter = currentTab.getFilter ? currentTab.getFilter() : currentTab.filter;
this.manager.setScreen(filter);
}
}, {
key: "activateTab",
value: function activateTab(tab) {
$e.routes.saveState('library');
(0, _get2.default)((0, _getPrototypeOf2.default)(Component.prototype), "activateTab", this).call(this, tab);
}
}, {
key: "open",
value: function open() {
(0, _get2.default)((0, _getPrototypeOf2.default)(Component.prototype), "open", this).call(this);
if (!this.manager.layout) {
this.manager.layout = this.layout;
}
this.manager.layout.setHeaderDefaultParts();
return true;
}
}, {
key: "close",
value: function close() {
if (!(0, _get2.default)((0, _getPrototypeOf2.default)(Component.prototype), "close", this).call(this)) {
return false;
}
this.manager.modalConfig = {};
return true;
}
}, {
key: "show",
value: function show(args) {
this.manager.modalConfig = args;
if (args.toDefault || !$e.routes.restoreState('library')) {
$e.route(this.getDefaultRoute());
}
}
// TODO: Move function to 'insert-template' command.
}, {
key: "insertTemplate",
value: function insertTemplate(args) {
this.downloadTemplate(args, function (data, callbackParams) {
$e.run('document/elements/import', {
model: callbackParams.model,
data: data,
options: callbackParams.importOptions
});
});
}
}, {
key: "downloadTemplate",
value: function downloadTemplate(args, callback) {
var _this2 = this;
var autoImportSettings = elementor.config.document.remoteLibrary.autoImportSettings,
model = args.model;
var _args$withPageSetting = args.withPageSettings,
withPageSettings = _args$withPageSetting === void 0 ? null : _args$withPageSetting;
if (autoImportSettings) {
withPageSettings = true;
}
if (null === withPageSettings && model.get('hasPageSettings')) {
var insertTemplateHandler = this.getImportSettingsDialog();
insertTemplateHandler.showImportDialog(model);
return;
}
this.manager.layout.showLoadingView();
this.manager.requestTemplateContent(model.get('source'), model.get('template_id'), {
data: {
with_page_settings: withPageSettings
},
success: function success(data) {
// Clone the `modalConfig.importOptions` because it deleted during the closing.
var importOptions = jQuery.extend({}, _this2.manager.modalConfig.importOptions);
importOptions.withPageSettings = withPageSettings;
// Hide for next open.
_this2.manager.layout.hideLoadingView();
_this2.manager.layout.hideModal();
callback(data, {
model: model,
importOptions: importOptions
});
},
error: function error(data) {
_this2.manager.showErrorDialog(data);
},
complete: function complete() {
_this2.manager.layout.hideLoadingView();
}
});
}
}, {
key: "getImportSettingsDialog",
value: function getImportSettingsDialog() {
// Moved from ./behaviors/insert-template.js
var InsertTemplateHandler = {
dialog: null,
showImportDialog: function showImportDialog(model) {
var dialog = InsertTemplateHandler.getDialog(model);
dialog.onConfirm = function () {
$e.run('library/insert-template', {
model: model,
withPageSettings: true
});
};
dialog.onCancel = function () {
$e.run('library/insert-template', {
model: model,
withPageSettings: false
});
};
dialog.show();
},
initDialog: function initDialog(model) {
InsertTemplateHandler.dialog = elementorCommon.dialogsManager.createWidget('confirm', {
id: 'elementor-insert-template-settings-dialog',
/* Translators: %s is the type content */
headerMessage: __('Apply the settings of this %s too?', 'elementor').replace('%s', elementor.translate(model.attributes.type)),
/* Translators: %s is the type content */
message: __('This will override the design, layout, and other settings of the %s you’re working on.', 'elementor').replace('%s', elementor.documents.getCurrent().container.label),
strings: {
confirm: __('Apply', 'elementor'),
cancel: __('Don’t apply', 'elementor')
}
});
},
getDialog: function getDialog(model) {
if (!InsertTemplateHandler.dialog) {
InsertTemplateHandler.initDialog(model);
}
return InsertTemplateHandler.dialog;
}
};
return InsertTemplateHandler;
}
}, {
key: "getTabsWrapperSelector",
value: function getTabsWrapperSelector() {
return '#elementor-template-library-header-menu';
}
}, {
key: "getModalLayout",
value: function getModalLayout() {
return TemplateLibraryLayoutView;
}
}, {
key: "maybeOpenLibrary",
value: function maybeOpenLibrary() {
if ('#library' === location.hash) {
$e.run('library/open');
location.hash = '';
}
}
}]);
return Component;
}(_componentModalBase.default);
exports["default"] = Component;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/manager.js":
/*!**********************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/manager.js ***!
\**********************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
/* provided dependency */ var sprintf = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["sprintf"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _component = _interopRequireDefault(__webpack_require__(/*! ./component */ "../assets/dev/js/editor/components/template-library/component.js"));
var TemplateLibraryCollection = __webpack_require__(/*! elementor-templates/collections/templates */ "../assets/dev/js/editor/components/template-library/collections/templates.js"),
TemplateLibraryManager;
TemplateLibraryManager = function TemplateLibraryManager() {
this.modalConfig = {};
var self = this,
templateTypes = {};
var deleteDialog,
errorDialog,
templatesCollection,
config = {},
filterTerms = {};
var registerDefaultTemplateTypes = function registerDefaultTemplateTypes() {
var data = {
saveDialog: {
description: __('Your designs will be available for export and reuse on any page or website', 'elementor')
},
ajaxParams: {
success: function success(successData) {
$e.route('library/templates/my-templates', {
onBefore: function onBefore() {
if (templatesCollection) {
var itemExist = templatesCollection.findWhere({
template_id: successData.template_id
});
if (!itemExist) {
templatesCollection.add(successData);
}
}
}
});
},
error: function error(errorData) {
self.showErrorDialog(errorData);
}
}
};
var translationMap = (0, _defineProperty2.default)({
page: __('Page', 'elementor'),
section: __('Section', 'elementor'),
container: __('Container', 'elementor')
}, elementor.config.document.type, elementor.config.document.panel.title);
jQuery.each(translationMap, function (type, title) {
var safeData = jQuery.extend(true, {}, data, {
saveDialog: {
/* Translators: %s: Template type. */
title: sprintf(__('Save Your %s to Library', 'elementor'), title)
}
});
self.registerTemplateType(type, safeData);
});
};
var registerDefaultFilterTerms = function registerDefaultFilterTerms() {
filterTerms = {
text: {
callback: function callback(value) {
value = value.toLowerCase();
if (this.get('title').toLowerCase().indexOf(value) >= 0) {
return true;
}
return _.any(this.get('tags'), function (tag) {
return tag.toLowerCase().indexOf(value) >= 0;
});
}
},
type: {},
subtype: {},
favorite: {}
};
};
this.init = function () {
registerDefaultTemplateTypes();
registerDefaultFilterTerms();
this.component = $e.components.register(new _component.default({
manager: this
}));
elementor.addBackgroundClickListener('libraryToggleMore', {
element: '.elementor-template-library-template-more'
});
};
this.getTemplateTypes = function (type) {
if (type) {
return templateTypes[type];
}
return templateTypes;
};
this.registerTemplateType = function (type, data) {
templateTypes[type] = data;
};
this.deleteTemplate = function (templateModel, options) {
var dialog = self.getDeleteDialog();
dialog.onConfirm = function () {
if (options.onConfirm) {
options.onConfirm();
}
elementorCommon.ajax.addRequest('delete_template', {
data: {
source: templateModel.get('source'),
template_id: templateModel.get('template_id')
},
success: function success(response) {
templatesCollection.remove(templateModel, {
silent: true
});
if (options.onSuccess) {
options.onSuccess(response);
}
}
});
};
dialog.show();
};
/**
* @param {*} model - Template model.
* @param {Object} args - Template arguments.
* @deprecated since 2.8.0, use `$e.run( 'library/insert-template' )` instead.
*/
this.importTemplate = function (model) {
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
elementorDevTools.deprecation.deprecated('importTemplate', '2.8.0', "$e.run( 'library/insert-template' )");
args.model = model;
$e.run('library/insert-template', args);
};
this.saveTemplate = function (type, data) {
var templateType = templateTypes[type];
_.extend(data, {
source: 'local',
type: type
});
if (templateType.prepareSavedData) {
data = templateType.prepareSavedData(data);
}
data.content = JSON.stringify(data.content);
var ajaxParams = {
data: data
};
if (templateType.ajaxParams) {
_.extend(ajaxParams, templateType.ajaxParams);
}
elementorCommon.ajax.addRequest('save_template', ajaxParams);
};
this.requestTemplateContent = function (source, id, ajaxOptions) {
var options = {
unique_id: id,
data: {
source: source,
edit_mode: true,
display: true,
template_id: id
}
};
if (ajaxOptions) {
jQuery.extend(true, options, ajaxOptions);
}
return elementorCommon.ajax.addRequest('get_template_data', options);
};
this.markAsFavorite = function (templateModel, favorite) {
var options = {
data: {
source: templateModel.get('source'),
template_id: templateModel.get('template_id'),
favorite: favorite
}
};
return elementorCommon.ajax.addRequest('mark_template_as_favorite', options);
};
this.getDeleteDialog = function () {
if (!deleteDialog) {
deleteDialog = elementorCommon.dialogsManager.createWidget('confirm', {
id: 'elementor-template-library-delete-dialog',
headerMessage: __('Delete Template', 'elementor'),
message: __('Are you sure you want to delete this template?', 'elementor'),
strings: {
confirm: __('Delete', 'elementor')
}
});
}
return deleteDialog;
};
this.getErrorDialog = function () {
if (!errorDialog) {
errorDialog = elementorCommon.dialogsManager.createWidget('alert', {
id: 'elementor-template-library-error-dialog',
headerMessage: __('An error occurred.', 'elementor')
});
}
return errorDialog;
};
this.getTemplatesCollection = function () {
return templatesCollection;
};
this.getConfig = function (item) {
if (item) {
return config[item] ? config[item] : {};
}
return config;
};
this.requestLibraryData = function (options) {
if (templatesCollection && !options.forceUpdate) {
if (options.onUpdate) {
options.onUpdate();
}
return;
}
if (options.onBeforeUpdate) {
options.onBeforeUpdate();
}
var ajaxOptions = {
data: {},
success: function success(data) {
templatesCollection = new TemplateLibraryCollection(data.templates);
if (data.config) {
config = data.config;
}
if (options.onUpdate) {
options.onUpdate();
}
}
};
if (options.forceSync) {
ajaxOptions.data.sync = true;
}
elementorCommon.ajax.addRequest('get_library_data', ajaxOptions);
};
this.getFilter = function (name) {
return elementor.channels.templates.request('filter:' + name);
};
this.setFilter = function (name, value, silent) {
elementor.channels.templates.reply('filter:' + name, value);
if (!silent) {
elementor.channels.templates.trigger('filter:change');
}
};
this.getFilterTerms = function (termName) {
if (termName) {
return filterTerms[termName];
}
return filterTerms;
};
this.setScreen = function (args) {
elementor.channels.templates.stopReplying();
self.setFilter('source', args.source, true);
self.setFilter('type', args.type, true);
self.setFilter('subtype', args.subtype, true);
self.showTemplates();
};
this.loadTemplates = function (onUpdate) {
self.layout.showLoadingView();
var query = {
source: this.getFilter('source')
},
options = {};
// TODO: Remove - it when all the data commands is ready, manage the cache!.
if ('local' === query.source) {
options.refresh = true;
}
$e.data.get('library/templates', query, options).then(function (result) {
templatesCollection = new TemplateLibraryCollection(result.data.templates);
if (result.data.config) {
config = result.data.config;
}
self.layout.hideLoadingView();
if (onUpdate) {
onUpdate();
}
});
};
this.showTemplates = function () {
// The tabs should exist in DOM on loading.
self.layout.setHeaderDefaultParts();
self.loadTemplates(function () {
var templatesToShow = self.filterTemplates();
self.layout.showTemplatesView(new TemplateLibraryCollection(templatesToShow));
});
};
this.filterTemplates = function () {
var activeSource = self.getFilter('source');
return templatesCollection.filter(function (model) {
if (activeSource !== model.get('source')) {
return false;
}
var typeInfo = templateTypes[model.get('type')];
return !typeInfo || false !== typeInfo.showInLibrary;
});
};
this.showErrorDialog = function (errorMessage) {
if ('object' === (0, _typeof2.default)(errorMessage)) {
var message = '';
_.each(errorMessage, function (error) {
if (!(error !== null && error !== void 0 && error.message)) {
return;
}
message += '
' + error.message + '.
';
});
errorMessage = message;
} else if (errorMessage) {
errorMessage += '.';
}
if (errorMessage) {
errorMessage = __('The following error(s) occurred while processing the request:', 'elementor') + '
' + errorMessage + '
';
} else {
errorMessage = __('Please try again.', 'elementor');
}
self.getErrorDialog().setMessage(errorMessage).show();
};
};
module.exports = new TemplateLibraryManager();
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/models/template.js":
/*!******************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/models/template.js ***!
\******************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Backbone.Model.extend({
defaults: {
template_id: 0,
title: '',
source: '',
type: '',
subtype: '',
author: '',
thumbnail: '',
url: '',
export_link: '',
tags: []
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/library-layout.js":
/*!***********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/library-layout.js ***!
\***********************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var TemplateLibraryHeaderActionsView = __webpack_require__(/*! elementor-templates/views/parts/header-parts/actions */ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/actions.js"),
TemplateLibraryHeaderMenuView = __webpack_require__(/*! elementor-templates/views/parts/header-parts/menu */ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/menu.js"),
TemplateLibraryHeaderPreviewView = __webpack_require__(/*! elementor-templates/views/parts/header-parts/preview */ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/preview.js"),
TemplateLibraryHeaderBackView = __webpack_require__(/*! elementor-templates/views/parts/header-parts/back */ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/back.js"),
TemplateLibraryCollectionView = __webpack_require__(/*! elementor-templates/views/parts/templates */ "../assets/dev/js/editor/components/template-library/views/parts/templates.js"),
TemplateLibrarySaveTemplateView = __webpack_require__(/*! elementor-templates/views/parts/save-template */ "../assets/dev/js/editor/components/template-library/views/parts/save-template.js"),
TemplateLibraryImportView = __webpack_require__(/*! elementor-templates/views/parts/import */ "../assets/dev/js/editor/components/template-library/views/parts/import.js"),
TemplateLibraryConnectView = __webpack_require__(/*! elementor-templates/views/parts/connect */ "../assets/dev/js/editor/components/template-library/views/parts/connect.js"),
TemplateLibraryPreviewView = __webpack_require__(/*! elementor-templates/views/parts/preview */ "../assets/dev/js/editor/components/template-library/views/parts/preview.js");
module.exports = elementorModules.common.views.modal.Layout.extend({
getModalOptions: function getModalOptions() {
var _window$elementor$con, _window, _window$elementor, _window$elementor$con2, _window$elementor$con3, _window$elementor$con4;
var allowClosingModal = (_window$elementor$con = (_window = window) === null || _window === void 0 ? void 0 : (_window$elementor = _window.elementor) === null || _window$elementor === void 0 ? void 0 : (_window$elementor$con2 = _window$elementor.config) === null || _window$elementor$con2 === void 0 ? void 0 : (_window$elementor$con3 = _window$elementor$con2.document) === null || _window$elementor$con3 === void 0 ? void 0 : (_window$elementor$con4 = _window$elementor$con3.panel) === null || _window$elementor$con4 === void 0 ? void 0 : _window$elementor$con4.allow_closing_remote_library) !== null && _window$elementor$con !== void 0 ? _window$elementor$con : true;
return {
id: 'elementor-template-library-modal',
hide: {
onOutsideClick: allowClosingModal,
onBackgroundClick: allowClosingModal,
onEscKeyPress: allowClosingModal
}
};
},
getLogoOptions: function getLogoOptions() {
return {
title: __('Library', 'elementor'),
click: function click() {
$e.run('library/open', {
toDefault: true
});
}
};
},
getTemplateActionButton: function getTemplateActionButton(templateData) {
var subscriptionPlans = elementor.config.library_connect.subscription_plans,
baseAccessTier = elementor.config.library_connect.base_access_tier,
templateAccessTier = templateData.accessTier,
shouldUpgrade = baseAccessTier !== templateAccessTier;
var viewId = '#tmpl-elementor-template-library-' + (shouldUpgrade ? 'upgrade-plan-button' : 'insert-button');
viewId = elementor.hooks.applyFilters('elementor/editor/template-library/template/action-button', viewId, templateData);
var template = Marionette.TemplateCache.get(viewId);
var subscriptionPlan = subscriptionPlans[templateAccessTier];
var promotionText = elementorAppConfig.hasPro ? 'Upgrade' : "Go ".concat(subscriptionPlan.label);
try {
var promotionUrlPieces = new URL(subscriptionPlan.promotion_url);
var queryString = promotionUrlPieces.searchParams.toString();
var promotionLinkQueryString = elementor.hooks.applyFilters('elementor/editor/template-library/template/promotion-link-search-params', queryString, templateData);
return Marionette.Renderer.render(template, {
promotionText: promotionText,
promotionLink: "".concat(promotionUrlPieces.origin).concat(promotionUrlPieces.pathname, "?").concat(promotionLinkQueryString)
});
} catch (e) {
return Marionette.Renderer.render(template, {
promotionText: promotionText,
promotionLink: subscriptionPlan.promotion_url
});
}
},
setHeaderDefaultParts: function setHeaderDefaultParts() {
var headerView = this.getHeaderView();
headerView.tools.show(new TemplateLibraryHeaderActionsView());
headerView.menuArea.show(new TemplateLibraryHeaderMenuView());
this.showLogo();
},
showTemplatesView: function showTemplatesView(templatesCollection) {
this.modalContent.show(new TemplateLibraryCollectionView({
collection: templatesCollection
}));
},
showImportView: function showImportView() {
var headerView = this.getHeaderView();
headerView.menuArea.reset();
this.modalContent.show(new TemplateLibraryImportView());
headerView.logoArea.show(new TemplateLibraryHeaderBackView());
},
showConnectView: function showConnectView(args) {
this.getHeaderView().menuArea.reset();
this.modalContent.show(new TemplateLibraryConnectView(args));
},
showSaveTemplateView: function showSaveTemplateView(elementModel) {
this.getHeaderView().menuArea.reset();
this.modalContent.show(new TemplateLibrarySaveTemplateView({
model: elementModel
}));
},
showPreviewView: function showPreviewView(templateModel) {
this.modalContent.show(new TemplateLibraryPreviewView({
url: templateModel.get('url')
}));
var headerView = this.getHeaderView();
headerView.menuArea.reset();
headerView.tools.show(new TemplateLibraryHeaderPreviewView({
model: templateModel
}));
headerView.logoArea.show(new TemplateLibraryHeaderBackView());
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/connect.js":
/*!**********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/connect.js ***!
\**********************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
module.exports = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-connect',
id: 'elementor-template-library-connect',
ui: {
connect: '#elementor-template-library-connect__button',
thumbnails: '#elementor-template-library-connect-thumbnails'
},
templateHelpers: function templateHelpers() {
return this.getOption('texts');
},
onRender: function onRender() {
var _this = this;
this.ui.connect.elementorConnect({
parseUrl: function parseUrl(url) {
return url.replace('%%template_type%%', _this.model.get('type'));
},
success: function success() {
elementor.config.library_connect.is_connected = true;
// If is connecting during insert template.
if (_this.getOption('model')) {
$e.run('library/insert-template', {
model: _this.getOption('model')
});
} else {
$e.run('library/close');
elementor.notifications.showToast({
message: __('Connected successfully.', 'elementor')
});
}
},
error: function error() {
elementor.config.library_connect.is_connected = false;
}
});
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/actions.js":
/*!***********************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/header-parts/actions.js ***!
\***********************************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-header-actions',
id: 'elementor-template-library-header-actions',
ui: {
import: '#elementor-template-library-header-import i',
sync: '#elementor-template-library-header-sync i',
save: '#elementor-template-library-header-save i'
},
events: {
'click @ui.import': 'onImportClick',
'click @ui.sync': 'onSyncClick',
'click @ui.save': 'onSaveClick'
},
onImportClick: function onImportClick() {
$e.route('library/import');
},
onSyncClick: function onSyncClick() {
var self = this;
self.ui.sync.addClass('eicon-animation-spin');
elementor.templates.requestLibraryData({
onUpdate: function onUpdate() {
self.ui.sync.removeClass('eicon-animation-spin');
$e.routes.refreshContainer('library');
},
forceUpdate: true,
forceSync: true
});
},
onSaveClick: function onSaveClick() {
$e.route('library/save-template');
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/back.js":
/*!********************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/header-parts/back.js ***!
\********************************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-header-back',
id: 'elementor-template-library-header-preview-back',
events: {
click: 'onClick'
},
onClick: function onClick() {
$e.routes.restoreState('library');
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/menu.js":
/*!********************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/header-parts/menu.js ***!
\********************************************************************************************/
/***/ ((module) => {
"use strict";
module.exports = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-header-menu',
id: 'elementor-template-library-header-menu',
templateHelpers: function templateHelpers() {
return {
tabs: $e.components.get('library').getTabs()
};
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/header-parts/preview.js":
/*!***********************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/header-parts/preview.js ***!
\***********************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TemplateLibraryInsertTemplateBehavior = __webpack_require__(/*! elementor-templates/behaviors/insert-template */ "../assets/dev/js/editor/components/template-library/behaviors/insert-template.js");
module.exports = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-header-preview',
id: 'elementor-template-library-header-preview',
behaviors: {
insertTemplate: {
behaviorClass: TemplateLibraryInsertTemplateBehavior
}
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/import.js":
/*!*********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/import.js ***!
\*********************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var _filesUploadHandler = _interopRequireDefault(__webpack_require__(/*! ../../../../utils/files-upload-handler */ "../assets/dev/js/editor/utils/files-upload-handler.js"));
var _jsonUploadWarningMessage = __webpack_require__(/*! elementor-utils/json-upload-warning-message */ "../assets/dev/js/utils/json-upload-warning-message.js");
var TemplateLibraryImportView;
TemplateLibraryImportView = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-import',
id: 'elementor-template-library-import',
ui: {
uploadForm: '#elementor-template-library-import-form',
fileInput: '#elementor-template-library-import-form-input'
},
events: {
'change @ui.fileInput': 'onFileInputChange'
},
droppedFiles: null,
submitForm: function submitForm() {
var _this = this;
var file;
if (this.droppedFiles) {
file = this.droppedFiles[0];
this.droppedFiles = null;
} else {
file = this.ui.fileInput[0].files[0];
this.ui.uploadForm[0].reset();
}
var fileReader = new FileReader();
fileReader.onload = function (event) {
return _this.importTemplate(file.name, event.target.result.replace(/^[^,]+,/, ''));
};
fileReader.readAsDataURL(file);
},
importTemplate: function importTemplate(fileName, fileData) {
var _this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var layout, enableUnfilteredFilesModal;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
layout = elementor.templates.layout;
_this2.options = {
data: {
fileName: fileName,
fileData: fileData
},
success: function success(successData) {
elementor.templates.getTemplatesCollection().add(successData);
$e.route('library/templates/my-templates');
},
error: function error(errorData) {
elementor.templates.showErrorDialog(errorData);
layout.showImportView();
},
complete: function complete() {
layout.hideLoadingView();
}
};
_context.next = 4;
return (0, _jsonUploadWarningMessage.showJsonUploadWarningMessageIfNeeded)({
introductionMap: window.elementor.config.user.introduction,
IntroductionClass: window.elementorModules.editor.utils.Introduction
});
case 4:
if (!elementorCommon.config.filesUpload.unfilteredFiles) {
enableUnfilteredFilesModal = _filesUploadHandler.default.getUnfilteredFilesNotEnabledImportTemplateDialog(function () {
return _this2.sendImportRequest();
});
enableUnfilteredFilesModal.show();
} else {
_this2.sendImportRequest();
}
case 5:
case "end":
return _context.stop();
}
}, _callee);
}))();
},
sendImportRequest: function sendImportRequest() {
elementorCommon.ajax.addRequest('import_template', this.options);
elementor.templates.layout.showLoadingView();
},
onRender: function onRender() {
this.ui.uploadForm.on({
'drag dragstart dragend dragover dragenter dragleave drop': this.onFormActions.bind(this),
dragenter: this.onFormDragEnter.bind(this),
'dragleave drop': this.onFormDragLeave.bind(this),
drop: this.onFormDrop.bind(this)
});
},
onFormActions: function onFormActions(event) {
event.preventDefault();
event.stopPropagation();
},
onFormDragEnter: function onFormDragEnter() {
this.ui.uploadForm.addClass('elementor-drag-over');
},
onFormDragLeave: function onFormDragLeave(event) {
if (jQuery(event.relatedTarget).closest(this.ui.uploadForm).length) {
return;
}
this.ui.uploadForm.removeClass('elementor-drag-over');
},
onFormDrop: function onFormDrop(event) {
this.droppedFiles = event.originalEvent.dataTransfer.files;
this.submitForm();
},
onFileInputChange: function onFileInputChange() {
this.submitForm();
}
});
module.exports = TemplateLibraryImportView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/preview.js":
/*!**********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/preview.js ***!
\**********************************************************************************/
/***/ ((module) => {
"use strict";
var TemplateLibraryPreviewView;
TemplateLibraryPreviewView = Marionette.ItemView.extend({
template: '#tmpl-elementor-template-library-preview',
id: 'elementor-template-library-preview',
ui: {
iframe: '> iframe'
},
onRender: function onRender() {
this.ui.iframe.attr('src', this.getOption('url'));
}
});
module.exports = TemplateLibraryPreviewView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/save-template.js":
/*!****************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/save-template.js ***!
\****************************************************************************************/
/***/ ((module) => {
"use strict";
var TemplateLibrarySaveTemplateView;
TemplateLibrarySaveTemplateView = Marionette.ItemView.extend({
id: 'elementor-template-library-save-template',
template: '#tmpl-elementor-template-library-save-template',
ui: {
form: '#elementor-template-library-save-template-form',
submitButton: '#elementor-template-library-save-template-submit'
},
events: {
'submit @ui.form': 'onFormSubmit'
},
getSaveType: function getSaveType() {
var type;
if (this.model) {
type = this.model.get('elType');
} else if (elementor.config.document.library && elementor.config.document.library.save_as_same_type) {
type = elementor.config.document.type;
} else {
type = 'page';
}
return type;
},
templateHelpers: function templateHelpers() {
var saveType = this.getSaveType(),
templateType = elementor.templates.getTemplateTypes(saveType);
return templateType.saveDialog;
},
onFormSubmit: function onFormSubmit(event) {
event.preventDefault();
var formData = this.ui.form.elementorSerializeObject(),
saveType = this.getSaveType(),
JSONParams = {
remove: ['default']
};
formData.content = this.model ? [this.model.toJSON(JSONParams)] : elementor.elements.toJSON(JSONParams);
this.ui.submitButton.addClass('elementor-button-state');
elementor.templates.saveTemplate(saveType, formData);
}
});
module.exports = TemplateLibrarySaveTemplateView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/templates-empty.js":
/*!******************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/templates-empty.js ***!
\******************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var TemplateLibraryTemplatesEmptyView;
TemplateLibraryTemplatesEmptyView = Marionette.ItemView.extend({
id: 'elementor-template-library-templates-empty',
template: '#tmpl-elementor-template-library-templates-empty',
ui: {
title: '.elementor-template-library-blank-title',
message: '.elementor-template-library-blank-message'
},
modesStrings: {
empty: {
title: __('Haven’t Saved Templates Yet?', 'elementor'),
message: __('This is where your templates should be. Design it. Save it. Reuse it.', 'elementor')
},
noResults: {
title: __('No Results Found', 'elementor'),
message: __('Please make sure your search is spelled correctly or try a different words.', 'elementor')
},
noFavorites: {
title: __('No Favorite Templates', 'elementor'),
message: __('You can mark any pre-designed template as a favorite.', 'elementor')
}
},
getCurrentMode: function getCurrentMode() {
if (elementor.templates.getFilter('text')) {
return 'noResults';
}
if (elementor.templates.getFilter('favorite')) {
return 'noFavorites';
}
return 'empty';
},
onRender: function onRender() {
var modeStrings = this.modesStrings[this.getCurrentMode()];
this.ui.title.html(modeStrings.title);
this.ui.message.html(modeStrings.message);
}
});
module.exports = TemplateLibraryTemplatesEmptyView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/parts/templates.js":
/*!************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/parts/templates.js ***!
\************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _select = _interopRequireDefault(__webpack_require__(/*! elementor-editor-utils/select2.js */ "../assets/dev/js/editor/utils/select2.js"));
var TemplateLibraryTemplateLocalView = __webpack_require__(/*! elementor-templates/views/template/local */ "../assets/dev/js/editor/components/template-library/views/template/local.js"),
TemplateLibraryTemplateRemoteView = __webpack_require__(/*! elementor-templates/views/template/remote */ "../assets/dev/js/editor/components/template-library/views/template/remote.js"),
TemplateLibraryCollectionView;
TemplateLibraryCollectionView = Marionette.CompositeView.extend({
template: '#tmpl-elementor-template-library-templates',
id: 'elementor-template-library-templates',
childViewContainer: '#elementor-template-library-templates-container',
reorderOnSort: true,
emptyView: function emptyView() {
var EmptyView = __webpack_require__(/*! elementor-templates/views/parts/templates-empty */ "../assets/dev/js/editor/components/template-library/views/parts/templates-empty.js");
return new EmptyView();
},
ui: {
textFilter: '#elementor-template-library-filter-text',
selectFilter: '.elementor-template-library-filter-select',
myFavoritesFilter: '#elementor-template-library-filter-my-favorites',
orderInputs: '.elementor-template-library-order-input',
orderLabels: 'label.elementor-template-library-order-label'
},
events: {
'input @ui.textFilter': 'onTextFilterInput',
'change @ui.selectFilter': 'onSelectFilterChange',
'change @ui.myFavoritesFilter': 'onMyFavoritesFilterChange',
'mousedown @ui.orderLabels': 'onOrderLabelsClick'
},
comparators: {
title: function title(model) {
return model.get('title').toLowerCase();
},
popularityIndex: function popularityIndex(model) {
var popularityIndex = model.get('popularityIndex');
if (!popularityIndex) {
popularityIndex = model.get('date');
}
return -popularityIndex;
},
trendIndex: function trendIndex(model) {
var trendIndex = model.get('trendIndex');
if (!trendIndex) {
trendIndex = model.get('date');
}
return -trendIndex;
}
},
getChildView: function getChildView(childModel) {
if ('remote' === childModel.get('source')) {
return TemplateLibraryTemplateRemoteView;
}
return TemplateLibraryTemplateLocalView;
},
initialize: function initialize() {
this.listenTo(elementor.channels.templates, 'filter:change', this._renderChildren);
},
filter: function filter(childModel) {
var filterTerms = elementor.templates.getFilterTerms(),
passingFilter = true;
jQuery.each(filterTerms, function (filterTermName) {
var filterValue = elementor.templates.getFilter(filterTermName);
if (!filterValue) {
return;
}
if (this.callback) {
var callbackResult = this.callback.call(childModel, filterValue);
if (!callbackResult) {
passingFilter = false;
}
return callbackResult;
}
var filterResult = filterValue === childModel.get(filterTermName);
if (!filterResult) {
passingFilter = false;
}
return filterResult;
});
return passingFilter;
},
order: function order(by, reverseOrder) {
var comparator = this.comparators[by] || by;
if (reverseOrder) {
comparator = this.reverseOrder(comparator);
}
this.collection.comparator = comparator;
this.collection.sort();
},
reverseOrder: function reverseOrder(comparator) {
if ('function' !== typeof comparator) {
var comparatorValue = comparator;
comparator = function comparator(model) {
return model.get(comparatorValue);
};
}
return function (left, right) {
var l = comparator(left);
if (undefined === l) {
return -1;
}
var r = comparator(right);
if (undefined === r) {
return 1;
}
if (l < r) {
return 1;
}
if (l > r) {
return -1;
}
return 0;
};
},
addSourceData: function addSourceData() {
var isEmpty = this.children.isEmpty();
this.$el.attr('data-template-source', isEmpty ? 'empty' : elementor.templates.getFilter('source'));
},
setFiltersUI: function setFiltersUI() {
if (!this.select2Instance && this.$(this.ui.selectFilter).length) {
var $filters = this.$(this.ui.selectFilter),
select2Options = {
placeholder: __('Category', 'elementor'),
allowClear: true,
width: 150,
dropdownParent: this.$el
};
this.select2Instance = new _select.default({
$element: $filters,
options: select2Options
});
}
},
setMasonrySkin: function setMasonrySkin() {
var masonry = new elementorModules.utils.Masonry({
container: this.$childViewContainer,
items: this.$childViewContainer.children()
});
this.$childViewContainer.imagesLoaded(masonry.run.bind(masonry));
},
toggleFilterClass: function toggleFilterClass() {
this.$el.toggleClass('elementor-templates-filter-active', !!(elementor.templates.getFilter('text') || elementor.templates.getFilter('favorite')));
},
isPageOrLandingPageTemplates: function isPageOrLandingPageTemplates() {
var templatesType = elementor.templates.getFilter('type');
return 'page' === templatesType || 'lp' === templatesType;
},
onRender: function onRender() {
if ('remote' === elementor.templates.getFilter('source') && 'page' !== elementor.templates.getFilter('type') && 'lb' !== elementor.templates.getFilter('type')) {
this.setFiltersUI();
}
},
onRenderCollection: function onRenderCollection() {
this.addSourceData();
this.toggleFilterClass();
if ('remote' === elementor.templates.getFilter('source') && !this.isPageOrLandingPageTemplates()) {
this.setMasonrySkin();
}
},
onBeforeRenderEmpty: function onBeforeRenderEmpty() {
this.addSourceData();
},
onTextFilterInput: function onTextFilterInput() {
elementor.templates.setFilter('text', this.ui.textFilter.val());
},
onSelectFilterChange: function onSelectFilterChange(event) {
var $select = jQuery(event.currentTarget),
filterName = $select.data('elementor-filter');
elementor.templates.setFilter(filterName, $select.val());
},
onMyFavoritesFilterChange: function onMyFavoritesFilterChange() {
elementor.templates.setFilter('favorite', this.ui.myFavoritesFilter[0].checked);
},
onOrderLabelsClick: function onOrderLabelsClick(event) {
var $clickedInput = jQuery(event.currentTarget.control),
toggle;
if (!$clickedInput[0].checked) {
toggle = 'asc' !== $clickedInput.data('default-ordering-direction');
}
$clickedInput.toggleClass('elementor-template-library-order-reverse', toggle);
this.order($clickedInput.val(), $clickedInput.hasClass('elementor-template-library-order-reverse'));
}
});
module.exports = TemplateLibraryCollectionView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/template/base.js":
/*!**********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/template/base.js ***!
\**********************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TemplateLibraryInsertTemplateBehavior = __webpack_require__(/*! elementor-templates/behaviors/insert-template */ "../assets/dev/js/editor/components/template-library/behaviors/insert-template.js"),
TemplateLibraryTemplateView;
var _require = __webpack_require__(/*! elementor-utils/tiers */ "../assets/dev/js/utils/tiers.js"),
isTierAtLeast = _require.isTierAtLeast,
TIERS = _require.TIERS;
TemplateLibraryTemplateView = Marionette.ItemView.extend({
className: function className() {
var classes = 'elementor-template-library-template',
source = this.model.get('source');
classes += ' elementor-template-library-template-' + source;
if ('remote' === source) {
classes += ' elementor-template-library-template-' + this.model.get('type');
}
if (elementor.config.library_connect.base_access_tier !== this.model.get('accessTier')) {
classes += ' elementor-template-library-pro-template';
}
return elementor.hooks.applyFilters('elementor/editor/template-library/template/classes', classes, this);
},
attributes: function attributes() {
var userAccessTier = elementor.config.library_connect.current_access_tier;
var templateAccessTier = this.model.get('accessTier');
var canDownloadTemplate = isTierAtLeast(userAccessTier, templateAccessTier);
// User with access to the template shouldn't see the badge.
if (canDownloadTemplate) {
return {};
}
var subscriptionPlans = elementor.config.library_connect.subscription_plans;
var subscriptionPlan = subscriptionPlans[templateAccessTier];
// Free user should see a generic "Pro" badge.
if (userAccessTier === TIERS.free) {
subscriptionPlan = subscriptionPlans.essential;
}
if (!subscriptionPlan) {
return {};
}
return {
style: "--elementor-template-library-subscription-plan-label: \"".concat(subscriptionPlan.label, "\";--elementor-template-library-subscription-plan-color: ").concat(subscriptionPlan.color, ";")
};
},
ui: function ui() {
return {
previewButton: '.elementor-template-library-template-preview'
};
},
events: function events() {
return {
'click @ui.previewButton': 'onPreviewButtonClick'
};
},
behaviors: function behaviors() {
var behaviors = {
insertTemplate: {
behaviorClass: TemplateLibraryInsertTemplateBehavior
}
};
return elementor.hooks.applyFilters('elementor/editor/template-library/template/behaviors', behaviors, this);
}
});
module.exports = TemplateLibraryTemplateView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/template/local.js":
/*!***********************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/template/local.js ***!
\***********************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TemplateLibraryTemplateView = __webpack_require__(/*! elementor-templates/views/template/base */ "../assets/dev/js/editor/components/template-library/views/template/base.js"),
TemplateLibraryTemplateLocalView;
TemplateLibraryTemplateLocalView = TemplateLibraryTemplateView.extend({
template: '#tmpl-elementor-template-library-template-local',
ui: function ui() {
return _.extend(TemplateLibraryTemplateView.prototype.ui.apply(this, arguments), {
deleteButton: '.elementor-template-library-template-delete',
morePopup: '.elementor-template-library-template-more',
toggleMore: '.elementor-template-library-template-more-toggle',
toggleMoreIcon: '.elementor-template-library-template-more-toggle i'
});
},
events: function events() {
return _.extend(TemplateLibraryTemplateView.prototype.events.apply(this, arguments), {
'click @ui.deleteButton': 'onDeleteButtonClick',
'click @ui.toggleMore': 'onToggleMoreClick'
});
},
onDeleteButtonClick: function onDeleteButtonClick() {
var toggleMoreIcon = this.ui.toggleMoreIcon;
elementor.templates.deleteTemplate(this.model, {
onConfirm: function onConfirm() {
toggleMoreIcon.removeClass('eicon-ellipsis-h').addClass('eicon-loading eicon-animation-spin');
},
onSuccess: function onSuccess() {
elementor.templates.showTemplates();
}
});
},
onToggleMoreClick: function onToggleMoreClick() {
this.ui.morePopup.show();
},
onPreviewButtonClick: function onPreviewButtonClick() {
open(this.model.get('url'), '_blank');
}
});
module.exports = TemplateLibraryTemplateLocalView;
/***/ }),
/***/ "../assets/dev/js/editor/components/template-library/views/template/remote.js":
/*!************************************************************************************!*\
!*** ../assets/dev/js/editor/components/template-library/views/template/remote.js ***!
\************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var TemplateLibraryTemplateView = __webpack_require__(/*! elementor-templates/views/template/base */ "../assets/dev/js/editor/components/template-library/views/template/base.js"),
TemplateLibraryTemplateRemoteView;
TemplateLibraryTemplateRemoteView = TemplateLibraryTemplateView.extend({
template: '#tmpl-elementor-template-library-template-remote',
ui: function ui() {
return jQuery.extend(TemplateLibraryTemplateView.prototype.ui.apply(this, arguments), {
favoriteCheckbox: '.elementor-template-library-template-favorite-input'
});
},
events: function events() {
return jQuery.extend(TemplateLibraryTemplateView.prototype.events.apply(this, arguments), {
'change @ui.favoriteCheckbox': 'onFavoriteCheckboxChange'
});
},
onPreviewButtonClick: function onPreviewButtonClick() {
$e.route('library/preview', {
model: this.model
});
},
onFavoriteCheckboxChange: function onFavoriteCheckboxChange() {
var isFavorite = this.ui.favoriteCheckbox[0].checked;
this.model.set('favorite', isFavorite);
elementor.templates.markAsFavorite(this.model, isFavorite);
if (!isFavorite && elementor.templates.getFilter('favorite')) {
elementor.channels.templates.trigger('filter:change');
}
}
});
module.exports = TemplateLibraryTemplateRemoteView;
/***/ }),
/***/ "../assets/dev/js/editor/components/validator/base.js":
/*!************************************************************!*\
!*** ../assets/dev/js/editor/components/validator/base.js ***!
\************************************************************/
/***/ ((module) => {
"use strict";
module.exports = elementorModules.Module.extend({
errors: [],
__construct: function __construct(settings) {
var customValidationMethod = settings.customValidationMethod;
if (customValidationMethod) {
this.validationMethod = customValidationMethod;
}
},
getDefaultSettings: function getDefaultSettings() {
return {
validationTerms: {}
};
},
isValid: function isValid() {
var validationErrors = this.validationMethod.apply(this, arguments);
if (validationErrors.length) {
this.errors = validationErrors;
return false;
}
return true;
},
validationMethod: function validationMethod(newValue) {
var validationTerms = this.getSettings('validationTerms'),
errors = [];
if (validationTerms.required) {
if (!('' + newValue).length) {
errors.push('Required value is empty');
}
}
return errors;
}
});
/***/ }),
/***/ "../assets/dev/js/editor/components/validator/breakpoint.js":
/*!******************************************************************!*\
!*** ../assets/dev/js/editor/components/validator/breakpoint.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var NumberValidator = __webpack_require__(/*! elementor-validator/number */ "../assets/dev/js/editor/components/validator/number.js");
var BreakpointValidator = /*#__PURE__*/function (_NumberValidator) {
(0, _inherits2.default)(BreakpointValidator, _NumberValidator);
var _super = _createSuper(BreakpointValidator);
function BreakpointValidator() {
(0, _classCallCheck2.default)(this, BreakpointValidator);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(BreakpointValidator, [{
key: "getDefaultSettings",
value: function getDefaultSettings() {
return {
validationTerms: {
// Max width we allow in general
max: 5120
}
};
}
/**
* Get Panel Active Breakpoints
*
* Since the active kit used in the Site Settings panel could be a draft, we need to use the panel's active
* breakpoints settings and not the elementorFrontend.config values (which come from the DB).
*
* @return {*} Object
*/
}, {
key: "getPanelActiveBreakpoints",
value: function getPanelActiveBreakpoints() {
var panelBreakpoints = elementor.documents.currentDocument.config.settings.settings.active_breakpoints.map(function (breakpointName) {
return breakpointName.replace('viewport_', '');
}),
panelActiveBreakpoints = {};
panelBreakpoints.forEach(function (breakpointName) {
panelActiveBreakpoints[breakpointName] = elementorFrontend.config.responsive.breakpoints[breakpointName];
});
return panelActiveBreakpoints;
}
}, {
key: "initBreakpointProperties",
value: function initBreakpointProperties() {
var _activeBreakpoints$br, _activeBreakpoints$br2;
var validationTerms = this.getSettings('validationTerms'),
activeBreakpoints = this.getPanelActiveBreakpoints(),
breakpointKeys = Object.keys(activeBreakpoints);
this.breakpointIndex = breakpointKeys.indexOf(validationTerms.breakpointName);
this.topBreakpoint = (_activeBreakpoints$br = activeBreakpoints[breakpointKeys[this.breakpointIndex + 1]]) === null || _activeBreakpoints$br === void 0 ? void 0 : _activeBreakpoints$br.value;
this.bottomBreakpoint = (_activeBreakpoints$br2 = activeBreakpoints[breakpointKeys[this.breakpointIndex - 1]]) === null || _activeBreakpoints$br2 === void 0 ? void 0 : _activeBreakpoints$br2.value;
}
}, {
key: "validationMethod",
value: function validationMethod(newValue) {
var validationTerms = this.getSettings('validationTerms'),
errors = NumberValidator.prototype.validationMethod.call(this, newValue);
// Validate both numeric and empty values, since breakpoints utilize default values when empty.
if (_.isFinite(newValue) || '' === newValue) {
if (!this.validateMinMaxForBreakpoint(newValue, validationTerms)) {
errors.push('Value is not between the breakpoints above or under the edited breakpoint');
}
}
return errors;
}
}, {
key: "validateMinMaxForBreakpoint",
value: function validateMinMaxForBreakpoint(newValue, validationTerms) {
var breakpointDefaultValue = elementorFrontend.config.responsive.breakpoints[validationTerms.breakpointName].default_value;
var isValid = true;
this.initBreakpointProperties();
// Since the following comparison is <=, allow usage of the 320px value for the mobile breakpoint.
if ('mobile' === validationTerms.breakpointName && 320 === this.bottomBreakpoint) {
this.bottomBreakpoint -= 1;
}
// If there is a breakpoint below the currently edited breakpoint
if (this.bottomBreakpoint) {
// Check that the new value is not under the bottom breakpoint's value.
if ('' !== newValue && newValue <= this.bottomBreakpoint) {
isValid = false;
}
// If the new value is empty, check that the default breakpoint value is not below the bottom breakpoint.
if ('' === newValue && breakpointDefaultValue <= this.bottomBreakpoint) {
isValid = false;
}
}
// If there is a breakpoint above the currently edited breakpoint.
if (this.topBreakpoint) {
// Check that the value is not above the top breakpoint's value.
if ('' !== newValue && newValue >= this.topBreakpoint) {
isValid = false;
}
// If the new value is empty, check that the default breakpoint value is not above the top breakpoint.
if ('' === newValue && breakpointDefaultValue >= this.topBreakpoint) {
isValid = false;
}
}
return isValid;
}
}]);
return BreakpointValidator;
}(NumberValidator);
exports["default"] = BreakpointValidator;
/***/ }),
/***/ "../assets/dev/js/editor/components/validator/number.js":
/*!**************************************************************!*\
!*** ../assets/dev/js/editor/components/validator/number.js ***!
\**************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var Validator = __webpack_require__(/*! elementor-validator/base */ "../assets/dev/js/editor/components/validator/base.js");
module.exports = Validator.extend({
validationMethod: function validationMethod(newValue) {
var validationTerms = this.getSettings('validationTerms'),
errors = [];
if (_.isFinite(newValue)) {
if (undefined !== validationTerms.min && newValue < validationTerms.min) {
errors.push('Value is less than minimum');
}
if (undefined !== validationTerms.max && newValue > validationTerms.max) {
errors.push('Value is greater than maximum');
}
}
return errors;
}
});
/***/ }),
/***/ "../assets/dev/js/editor/container/model/children-array.js":
/*!*****************************************************************!*\
!*** ../assets/dev/js/editor/container/model/children-array.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ "../node_modules/@babel/runtime/helpers/wrapNativeSuper.js"));
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/**
* @typedef {import('../container')} Container
*/
var ChildrenArray = /*#__PURE__*/function (_Array) {
(0, _inherits2.default)(ChildrenArray, _Array);
var _super = _createSuper(ChildrenArray);
function ChildrenArray() {
(0, _classCallCheck2.default)(this, ChildrenArray);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(ChildrenArray, [{
key: "clear",
value: function clear() {
this.length = 0;
}
/**
* Function findRecursive().
*
* Will run over children recursively and pass the children to the callback till the callback returns positive value.
*
* @param {function(Container) : *} callback
*
* @return {Container|false} child
*/
}, {
key: "findRecursive",
value: function findRecursive(callback) {
var _iterator = _createForOfIteratorHelper(this),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var container = _step.value;
if (callback(container)) {
return container;
}
if (container.children.length) {
var foundChildren = container.children.findRecursive(callback);
if (foundChildren) {
return foundChildren;
}
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return false;
}
/**
* Function forEachRecursive().
*
* Will run over children recursively.
*
* @param {function(Container) : *} callback
*
* @return {void}
*/
}, {
key: "forEachRecursive",
value: function forEachRecursive(callback) {
var _iterator2 = _createForOfIteratorHelper(this),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var container = _step2.value;
callback(container);
if (container.children.length) {
container.children.forEachRecursive(callback);
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
}
/**
* Function someRecursive().
*
* Will run over children recursively, breaks if the callback return true.
*
* @param {function(Container) : *} callback
*/
}, {
key: "someRecursive",
value: function someRecursive(callback) {
var _iterator3 = _createForOfIteratorHelper(this),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var _container$children;
var container = _step3.value;
if (callback(container)) {
return true;
}
if ((_container$children = container.children) !== null && _container$children !== void 0 && _container$children.length) {
if (container.children.someRecursive(callback)) {
return true;
}
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return false;
}
}]);
return ChildrenArray;
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Array));
exports["default"] = ChildrenArray;
/***/ }),
/***/ "../assets/dev/js/editor/controls/base-data.js":
/*!*****************************************************!*\
!*** ../assets/dev/js/editor/controls/base-data.js ***!
\*****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _breakpoint = _interopRequireDefault(__webpack_require__(/*! elementor-validator/breakpoint */ "../assets/dev/js/editor/components/validator/breakpoint.js"));
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ControlBaseView = __webpack_require__(/*! elementor-controls/base */ "../assets/dev/js/editor/controls/base.js"),
TagsBehavior = __webpack_require__(/*! elementor-dynamic-tags/control-behavior */ "../assets/dev/js/editor/components/dynamic-tags/control-behavior.js"),
Validator = __webpack_require__(/*! elementor-validator/base */ "../assets/dev/js/editor/components/validator/base.js"),
NumberValidator = __webpack_require__(/*! elementor-validator/number */ "../assets/dev/js/editor/components/validator/number.js"),
ControlBaseDataView;
ControlBaseDataView = ControlBaseView.extend({
validatorTypes: {
Base: Validator,
Number: NumberValidator,
Breakpoint: _breakpoint.default
},
ui: function ui() {
var ui = ControlBaseView.prototype.ui.apply(this, arguments);
_.extend(ui, {
input: 'input[data-setting][type!="checkbox"][type!="radio"]',
checkbox: 'input[data-setting][type="checkbox"]',
radio: 'input[data-setting][type="radio"]',
select: 'select[data-setting]',
textarea: 'textarea[data-setting]',
responsiveSwitchersSibling: "".concat(ui.controlTitle, "[data-e-responsive-switcher-sibling!=\"false\"]"),
responsiveSwitchers: '.elementor-responsive-switcher',
contentEditable: '[contenteditable="true"]'
});
return ui;
},
templateHelpers: function templateHelpers() {
var controlData = ControlBaseView.prototype.templateHelpers.apply(this, arguments);
controlData.data.controlValue = this.getControlValue();
return controlData;
},
events: function events() {
return {
'input @ui.input': 'onBaseInputTextChange',
'change @ui.checkbox': 'onBaseInputChange',
'change @ui.radio': 'onBaseInputChange',
'input @ui.textarea': 'onBaseInputTextChange',
'change @ui.select': 'onBaseInputChange',
'input @ui.contentEditable': 'onBaseInputTextChange',
'click @ui.responsiveSwitchers': 'onResponsiveSwitchersClick'
};
},
behaviors: function behaviors() {
var behaviors = ControlBaseView.prototype.behaviors.apply(this, arguments),
dynamicSettings = this.options.model.get('dynamic');
if (dynamicSettings && dynamicSettings.active) {
var tags = _.filter(elementor.dynamicTags.getConfig('tags'), function (tag) {
return tag.editable && _.intersection(tag.categories, dynamicSettings.categories).length;
});
if (tags.length || elementor.config.user.is_administrator) {
behaviors.tags = {
behaviorClass: TagsBehavior,
tags: tags,
dynamicSettings: dynamicSettings
};
}
}
return behaviors;
},
initialize: function initialize() {
ControlBaseView.prototype.initialize.apply(this, arguments);
this.registerValidators();
if (this.model.get('responsive')) {
this.setPlaceholderFromParent();
}
if (undefined === this.model.get('inherit_placeholders')) {
this.model.set('inherit_placeholders', true);
}
// TODO: this.elementSettingsModel is deprecated since 2.8.0.
var settings = this.container ? this.container.settings : this.elementSettingsModel;
this.listenTo(settings, 'change:external:' + this.model.get('name'), this.onAfterExternalChange);
},
getControlValue: function getControlValue() {
return this.container.settings.get(this.model.get('name'));
},
getGlobalKey: function getGlobalKey() {
return this.container.globals.get(this.model.get('name'));
},
getGlobalValue: function getGlobalValue() {
return this.globalValue;
},
getGlobalDefault: function getGlobalDefault() {
var controlGlobalArgs = this.model.get('global');
if (controlGlobalArgs !== null && controlGlobalArgs !== void 0 && controlGlobalArgs.default) {
// If the control is a color/typography control and default colors/typography are disabled, don't return the global value.
if (!elementor.config.globals.defaults_enabled[this.getGlobalMeta().controlType]) {
return '';
}
var _$e$data$commandExtra = $e.data.commandExtractArgs(controlGlobalArgs.default),
command = _$e$data$commandExtra.command,
args = _$e$data$commandExtra.args,
result = $e.data.getCache($e.components.get('globals'), command, args.query);
return result === null || result === void 0 ? void 0 : result.value;
}
// No global default.
return '';
},
getCurrentValue: function getCurrentValue() {
if (this.getGlobalKey() && !this.globalValue) {
return '';
}
if (this.globalValue) {
return this.globalValue;
}
var controlValue = this.getControlValue();
if (controlValue) {
return controlValue;
}
return this.getGlobalDefault();
},
isGlobalActive: function isGlobalActive() {
var _this$options$model$g;
return (_this$options$model$g = this.options.model.get('global')) === null || _this$options$model$g === void 0 ? void 0 : _this$options$model$g.active;
},
setValue: function setValue(value) {
this.setSettingsModel(value);
},
setSettingsModel: function setSettingsModel(value) {
var key = this.model.get('name');
$e.run('document/elements/settings', {
container: this.options.container,
settings: (0, _defineProperty2.default)({}, key, value)
});
this.triggerMethod('settings:change');
},
applySavedValue: function applySavedValue() {
this.setInputValue('[data-setting="' + this.model.get('name') + '"]', this.getControlValue());
},
getEditSettings: function getEditSettings(setting) {
var settings = this.getOption('elementEditSettings').toJSON();
if (setting) {
return settings[setting];
}
return settings;
},
setEditSetting: function setEditSetting(settingKey, settingValue) {
var settings = this.getOption('elementEditSettings') || this.getOption('container').settings;
settings.set(settingKey, settingValue);
},
/**
* Get the placeholder for the current control.
*
* @return {*} placeholder
*/
getControlPlaceholder: function getControlPlaceholder() {
var placeholder = this.model.get('placeholder');
if (this.model.get('responsive') && this.model.get('inherit_placeholders')) {
placeholder = placeholder || this.container.placeholders[this.model.get('name')];
}
return placeholder;
},
/**
* Get the responsive parent view if exists.
*
* @return {ControlBaseDataView|undefined} responsive parent view if exists
*/
getResponsiveParentView: function getResponsiveParentView() {
var parent = this.model.get('parent');
try {
return parent && this.container.panel.getControlView(parent);
// eslint-disable-next-line no-empty
} catch (e) {}
},
/**
* Get the responsive children views if exists.
*
* @return {ControlBaseDataView|null} responsive children views if exists
*/
getResponsiveChildrenViews: function getResponsiveChildrenViews() {
var children = this.model.get('inheritors'),
views = [];
try {
var _iterator = _createForOfIteratorHelper(children),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var child = _step.value;
views.push(this.container.panel.getControlView(child));
}
// eslint-disable-next-line no-empty
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
} catch (e) {}
return views;
},
/**
* Get prepared placeholder from the responsive parent, and put it into current
* control model as placeholder.
*/
setPlaceholderFromParent: function setPlaceholderFromParent() {
var parent = this.getResponsiveParentView();
if (parent) {
this.container.placeholders[this.model.get('name')] = parent.preparePlaceholderForChildren();
}
},
/**
* Returns the value of the current control if exists, or the parent value if not,
* so responsive children can set it as their placeholder. When there are multiple
* inputs, the inputs which are empty on this control will inherit their values
* from the responsive parent.
* For example, if on desktop the padding of all edges is 10, and on tablet only
* padding right and left is set to 15, the mobile control placeholder will
* eventually be: { top: 10, right: 15, left: 15, bottom: 10 }, because of the
* inheritance of multiple values.
*
* @return {*} value of the current control if exists, or the parent value if not
*/
preparePlaceholderForChildren: function preparePlaceholderForChildren() {
var _this$getResponsivePa;
var cleanValue = this.getCleanControlValue(),
parentValue = (_this$getResponsivePa = this.getResponsiveParentView()) === null || _this$getResponsivePa === void 0 ? void 0 : _this$getResponsivePa.preparePlaceholderForChildren();
if (cleanValue instanceof Object) {
return Object.assign({}, parentValue, cleanValue);
}
return cleanValue || parentValue;
},
/**
* Start the re-rendering recursive chain from the responsive child of this
* control. It's useful when the current control value is changed and we want
* to update all responsive children. In this case, the re-rendering is supposed
* to be applied only from the responsive child of this control and on.
*/
propagatePlaceholder: function propagatePlaceholder() {
var children = this.getResponsiveChildrenViews();
var _iterator2 = _createForOfIteratorHelper(children),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var child = _step2.value;
child.renderWithChildren();
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
},
/**
* Re-render current control and trigger this method on the responsive child.
* The purpose of those actions is to recursively re-render all responsive
* children.
*/
renderWithChildren: function renderWithChildren() {
this.render();
this.propagatePlaceholder();
},
/**
* Get control value without empty properties, and without default values.
*
* @return {{}} control value without empty properties, and without default values
*/
getCleanControlValue: function getCleanControlValue() {
var value = this.getControlValue();
return value && value !== this.model.get('default') ? value : undefined;
},
onAfterChange: function onAfterChange(control) {
if (Object.keys(control.changed).includes(this.model.get('name'))) {
this.propagatePlaceholder();
}
ControlBaseView.prototype.onAfterChange.apply(this, arguments);
},
getInputValue: function getInputValue(input) {
var $input = this.$(input);
if ($input.is('[contenteditable="true"]')) {
return $input.html();
}
var inputValue = $input.val(),
inputType = $input.attr('type');
if (-1 !== ['radio', 'checkbox'].indexOf(inputType)) {
return $input.prop('checked') ? inputValue : '';
}
if ('number' === inputType && _.isFinite(inputValue)) {
return +inputValue;
}
// Temp fix for jQuery (< 3.0) that return null instead of empty array
if ('SELECT' === input.tagName && $input.prop('multiple') && null === inputValue) {
inputValue = [];
}
return inputValue;
},
setInputValue: function setInputValue(input, value) {
var $input = this.$(input),
inputType = $input.attr('type');
if ('checkbox' === inputType) {
$input.prop('checked', !!value);
} else if ('radio' === inputType) {
$input.filter('[value="' + value + '"]').prop('checked', true);
} else {
$input.val(value);
}
},
addValidator: function addValidator(validator) {
this.validators.push(validator);
},
registerValidators: function registerValidators() {
var _this = this;
this.validators = [];
var validationTerms = {};
if (this.model.get('required')) {
validationTerms.required = true;
}
if (!jQuery.isEmptyObject(validationTerms)) {
this.addValidator(new this.validatorTypes.Base({
validationTerms: validationTerms
}));
}
var validators = this.model.get('validators');
if (validators) {
Object.entries(validators).forEach(function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
key = _ref2[0],
args = _ref2[1];
_this.addValidator(new _this.validatorTypes[key]({
validationTerms: args
}));
});
}
},
onBeforeRender: function onBeforeRender() {
this.setPlaceholderFromParent();
},
onRender: function onRender() {
ControlBaseView.prototype.onRender.apply(this, arguments);
if (this.model.get('responsive')) {
this.renderResponsiveSwitchers();
}
this.applySavedValue();
this.triggerMethod('ready');
this.toggleControlVisibility();
this.addTooltip();
},
onBaseInputTextChange: function onBaseInputTextChange(event) {
this.onBaseInputChange(event);
},
onBaseInputChange: function onBaseInputChange(event) {
clearTimeout(this.correctionTimeout);
var input = event.currentTarget,
value = this.getInputValue(input),
validators = this.validators.slice(0),
settingsValidators = this.container.settings.validators[this.model.get('name')];
if (settingsValidators) {
validators = validators.concat(settingsValidators);
}
if (validators) {
var oldValue = this.getControlValue(input.dataset.setting);
var isValidValue = validators.every(function (validator) {
return validator.isValid(value, oldValue);
});
if (!isValidValue) {
this.correctionTimeout = setTimeout(this.setInputValue.bind(this, input, oldValue), 1200);
return;
}
}
this.updateElementModel(value, input);
this.triggerMethod('input:change', event);
},
onResponsiveSwitchersClick: function onResponsiveSwitchersClick(event) {
var $switcher = jQuery(event.currentTarget),
device = $switcher.data('device'),
$switchersWrapper = this.ui.responsiveSwitchersWrapper,
selectedOption = $switcher.index();
$switchersWrapper.toggleClass('elementor-responsive-switchers-open');
$switchersWrapper[0].style.setProperty('--selected-option', selectedOption);
this.triggerMethod('responsive:switcher:click', device);
elementor.changeDeviceMode(device);
},
renderResponsiveSwitchers: function renderResponsiveSwitchers() {
var templateHtml = Marionette.Renderer.render('#tmpl-elementor-control-responsive-switchers', this.model.attributes);
this.ui.responsiveSwitchersSibling.after(templateHtml);
this.ui.responsiveSwitchersWrapper = this.$el.find('.elementor-control-responsive-switchers');
},
onAfterExternalChange: function onAfterExternalChange() {
this.hideTooltip();
this.applySavedValue();
},
addTooltip: function addTooltip() {
this.ui.tooltipTargets = this.$el.find('.tooltip-target');
if (!this.ui.tooltipTargets.length) {
return;
}
// Create tooltip on controls
this.ui.tooltipTargets.tipsy({
gravity: function gravity() {
// `n` for down, `s` for up
var gravity = jQuery(this).data('tooltip-pos');
if (undefined !== gravity) {
return gravity;
}
return 's';
},
title: function title() {
return this.getAttribute('data-tooltip');
}
});
},
hideTooltip: function hideTooltip() {
if (this.ui.tooltipTargets.length) {
this.ui.tooltipTargets.tipsy('hide');
}
},
updateElementModel: function updateElementModel(value) {
this.setValue(value);
}
}, {
// Static methods
getStyleValue: function getStyleValue(placeholder, controlValue, controlData) {
if ('DEFAULT' === placeholder) {
return controlData.default;
}
return controlValue;
},
onPasteStyle: function onPasteStyle() {
return true;
}
});
module.exports = ControlBaseDataView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/base-multiple.js":
/*!*********************************************************!*\
!*** ../assets/dev/js/editor/controls/base-multiple.js ***!
\*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js"));
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlBaseMultipleItemView;
ControlBaseMultipleItemView = ControlBaseDataView.extend({
applySavedValue: function applySavedValue() {
var values = this.getControlValue(),
$inputs = this.$('[data-setting]'),
self = this;
_.each(values, function (value, key) {
var $input = $inputs.filter(function () {
return key === this.dataset.setting;
});
self.setInputValue($input, value);
});
},
getControlValue: function getControlValue(key) {
var values = this.container.settings.get(this.model.get('name'));
if (!jQuery.isPlainObject(values)) {
return {};
}
if (key) {
var value = values[key];
if (undefined === value) {
value = '';
}
return value;
}
return elementorCommon.helpers.cloneObject(values);
},
/**
* @inheritDoc
*/
getCleanControlValue: function getCleanControlValue(key) {
var _this = this;
var values = Object.fromEntries(Object.entries(this.getControlValue()).filter(function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
k = _ref2[0],
v = _ref2[1];
return v && _this.model.get('default')[k] !== v;
}));
if (key) {
return values === null || values === void 0 ? void 0 : values[key];
}
return Object.keys(values).length ? values : undefined;
},
setValue: function setValue(key, value) {
var values = this.getControlValue();
if ('object' === (0, _typeof2.default)(key)) {
_.each(key, function (internalValue, internalKey) {
values[internalKey] = internalValue;
});
} else {
values[key] = value;
}
this.setSettingsModel(values);
},
updateElementModel: function updateElementModel(value, input) {
var key = input.dataset.setting;
this.setValue(key, value);
}
}, {
// Static methods
getStyleValue: function getStyleValue(placeholder, controlValue) {
if (!_.isObject(controlValue)) {
return ''; // Invalid
}
return controlValue[placeholder.toLowerCase()];
}
});
module.exports = ControlBaseMultipleItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/base-units.js":
/*!******************************************************!*\
!*** ../assets/dev/js/editor/controls/base-units.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var ControlBaseMultipleItemView = __webpack_require__(/*! elementor-controls/base-multiple */ "../assets/dev/js/editor/controls/base-multiple.js"),
ControlBaseUnitsItemView;
ControlBaseUnitsItemView = ControlBaseMultipleItemView.extend({
ui: function ui() {
return Object.assign(ControlBaseMultipleItemView.prototype.ui.apply(this, arguments), {
units: '.e-units-choices>input',
unitSwitcher: '.e-units-switcher',
unitChoices: '.e-units-choices'
});
},
events: function events() {
return Object.assign(ControlBaseMultipleItemView.prototype.events.apply(this, arguments), {
'change @ui.units': 'onUnitChange',
'click @ui.units': 'onUnitClick',
'click @ui.unitSwitcher': 'onUnitLabelClick'
});
},
updatePlaceholder: function updatePlaceholder() {
var _this$getControlPlace;
var placeholder = (_this$getControlPlace = this.getControlPlaceholder()) === null || _this$getControlPlace === void 0 ? void 0 : _this$getControlPlace.unit;
this.ui.units.removeClass('e-units-placeholder');
var currentUnitSelected = this.getControlValue('unit');
if (placeholder !== currentUnitSelected) {
this.ui.units.filter("[value=\"".concat(placeholder, "\"]")).addClass('e-units-placeholder');
}
},
recursiveUnitChange: function recursiveUnitChange() {
var includingSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var parent = this.getResponsiveParentView();
if (parent && includingSelf) {
var unit = parent.getControlValue('unit'),
values = Object.keys(this.getCleanControlValue() || {});
// Remove `unit` from values, so only control values are indicated.
values.splice(values.indexOf('unit'), 1);
// Only set the unit when no control values are already specified.
if (unit && !values.length) {
this.setValue('unit', unit);
this.render();
}
}
var _iterator = _createForOfIteratorHelper(this.getResponsiveChildrenViews()),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var child = _step.value;
child.recursiveUnitChange();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
},
onRender: function onRender() {
ControlBaseMultipleItemView.prototype.onRender.apply(this, arguments);
this.updatePlaceholder();
this.updateUnitChoices();
},
onUnitChange: function onUnitChange() {
this.toggleUnitChoices(false);
this.recursiveUnitChange(false);
this.updatePlaceholder();
this.updateUnitChoices();
},
toggleUnitChoices: function toggleUnitChoices(stateVal) {
this.ui.unitChoices.toggleClass('e-units-choices-open', stateVal);
},
updateUnitChoices: function updateUnitChoices() {
var unit = this.getControlValue('unit');
this.ui.unitSwitcher.attr('data-selected', unit).find('span').html(unit);
this.$el.toggleClass('e-units-custom', this.isCustomUnit());
},
onUnitClick: function onUnitClick() {
this.toggleUnitChoices(false);
},
onUnitLabelClick: function onUnitLabelClick(event) {
event.preventDefault();
this.toggleUnitChoices();
},
getCurrentRange: function getCurrentRange() {
return this.getUnitRange(this.getControlValue('unit'));
},
getUnitRange: function getUnitRange(unit) {
var ranges = this.model.get('range');
if (!ranges) {
return false;
}
if (!ranges[unit]) {
ranges[unit] = Object.values(ranges)[0];
}
return ranges[unit];
},
isCustomUnit: function isCustomUnit() {
return 'custom' === this.getControlValue('unit');
}
}, {
// Static methods
getStyleValue: function getStyleValue(placeholder, controlValue) {
var returnValue = ControlBaseMultipleItemView.getStyleValue(placeholder, controlValue);
if ('UNIT' === placeholder && 'custom' === returnValue) {
returnValue = '__EMPTY__';
}
return returnValue;
}
});
module.exports = ControlBaseUnitsItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/base.js":
/*!************************************************!*\
!*** ../assets/dev/js/editor/controls/base.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ControlBaseView;
ControlBaseView = Marionette.CompositeView.extend({
ui: function ui() {
return {
controlTitle: '.elementor-control-title'
};
},
behaviors: function behaviors() {
var behaviors = {};
return elementor.hooks.applyFilters('controls/base/behaviors', behaviors, this);
},
getBehavior: function getBehavior(name) {
return this._behaviors[Object.keys(this.behaviors()).indexOf(name)];
},
className: function className() {
// TODO: Any better classes for that?
var classes = 'elementor-control elementor-control-' + this.model.get('name') + ' elementor-control-type-' + this.model.get('type'),
modelClasses = this.model.get('classes'),
responsive = this.model.get('responsive');
if (!_.isEmpty(modelClasses)) {
classes += ' ' + modelClasses;
}
if (!_.isEmpty(responsive)) {
var responsiveControlName = responsive.max || responsive.min;
classes += ' elementor-control-responsive-' + responsiveControlName;
}
return classes;
},
templateHelpers: function templateHelpers() {
var controlData = {
_cid: this.model.cid
};
return {
view: this,
data: _.extend({}, this.model.toJSON(), controlData)
};
},
getTemplate: function getTemplate() {
return Marionette.TemplateCache.get('#tmpl-elementor-control-' + this.model.get('type') + '-content');
},
initialize: function initialize(options) {
var label = this.model.get('label');
// TODO: Temp backwards compatibility. since 2.8.0.
Object.defineProperty(this, 'container', {
get: function get() {
if (!options.container) {
var settingsModel = options.elementSettingsModel,
view = $e.components.get('document').utils.findViewById(settingsModel.id);
// Element control.
if (view && view.getContainer) {
options.container = view.getContainer();
} else {
if (!settingsModel.id) {
settingsModel.id = 'bc-' + elementorCommon.helpers.getUniqueId();
}
// Document/General/Other control.
options.container = new elementorModules.editor.Container({
type: 'bc-container',
id: settingsModel.id,
model: settingsModel,
settings: settingsModel,
label: label,
view: false,
parent: false,
renderer: false,
controls: settingsModel.options.controls
});
}
}
return options.container;
}
});
// Use `defineProperty` because `get elementSettingsModel()` fails during the `Marionette.CompositeView.extend`.
Object.defineProperty(this, 'elementSettingsModel', {
get: function get() {
elementorDevTools.deprecation.deprecated('elementSettingsModel', '2.8.0', 'container.settings');
return options.container ? options.container.settings : options.elementSettingsModel;
}
});
var controlType = this.model.get('type'),
controlSettings = jQuery.extend(true, {}, elementor.config.controls[controlType], this.model.attributes);
this.model.set(controlSettings);
// TODO: this.elementSettingsModel is deprecated since 2.8.0.
var settings = this.container ? this.container.settings : this.elementSettingsModel;
this.listenTo(settings, 'change', this.onAfterChange);
if (this.model.attributes.responsive) {
this.onDeviceModeChange = this.onDeviceModeChange.bind(this);
elementor.listenTo(elementor.channels.deviceMode, 'change', this.onDeviceModeChange);
}
},
onDestroy: function onDestroy() {
elementor.stopListening(elementor.channels.deviceMode, 'change', this.onDeviceModeChange);
},
onDeviceModeChange: function onDeviceModeChange() {
this.toggleControlVisibility();
},
onAfterChange: function onAfterChange() {
this.toggleControlVisibility();
},
toggleControlVisibility: function toggleControlVisibility() {
// TODO: this.elementSettingsModel is deprecated since 2.8.0.
var settings = this.container ? this.container.settings : this.elementSettingsModel;
var isVisible = elementor.helpers.isActiveControl(this.model, settings.attributes, settings.controls);
this.$el.toggleClass('elementor-hidden-control', !isVisible);
elementor.getPanelView().updateScrollbar();
},
onRender: function onRender() {
var layoutType = this.model.get('label_block') ? 'block' : 'inline',
showLabel = this.model.get('show_label'),
elClasses = 'elementor-label-' + layoutType;
elClasses += ' elementor-control-separator-' + this.model.get('separator');
if (!showLabel) {
elClasses += ' elementor-control-hidden-label';
}
this.$el.addClass(elClasses);
this.toggleControlVisibility();
},
reRoute: function reRoute(controlActive) {
$e.route($e.routes.getCurrent('panel'), this.getControlInRouteArgs(controlActive ? this.getControlPath() : ''), {
history: false
});
},
getControlInRouteArgs: function getControlInRouteArgs(path) {
return _objectSpread(_objectSpread({}, $e.routes.getCurrentArgs('panel')), {}, {
activeControl: path
});
},
getControlPath: function getControlPath() {
var controlPath = this.model.get('name'),
parent = this._parent;
while (!parent.$el.hasClass('elementor-controls-stack')) {
var parentName = parent.model.get('name') || parent.model.get('_id');
controlPath = parentName + '/' + controlPath;
parent = parent._parent;
}
return controlPath;
}
});
module.exports = ControlBaseView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/behaviors/scrubbing.js":
/*!***************************************************************!*\
!*** ../assets/dev/js/editor/controls/behaviors/scrubbing.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _uiStates = __webpack_require__(/*! elementor-document/ui-states */ "../assets/dev/js/editor/document/ui-states/index.js");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var SCRUB_REGULAR = 'UPDATE-VALUE';
var SCRUB_ENHANCED = 'UPDATE-VALUE-ENHANCED';
var SKIP_SCRUB = 'SKIP-UPDATE-VALUE';
var Scrubbing = /*#__PURE__*/function (_Marionette$Behavior) {
(0, _inherits2.default)(Scrubbing, _Marionette$Behavior);
var _super = _createSuper(Scrubbing);
function Scrubbing() {
var _this;
(0, _classCallCheck2.default)(this, Scrubbing);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "checkIntentTimeout", null);
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "skipperCount", 0);
var userOptions = _this.getOption('scrubSettings') || {};
_this.scrubSettings = _objectSpread({
intentTime: 600,
skipperSteps: 10,
valueModifier: 1,
enhancedNumber: 10,
scrubbingActiveClass: 'e-scrubbing--active',
scrubbingOverClass: 'e-scrubbing-over'
}, userOptions);
return _this;
}
(0, _createClass2.default)(Scrubbing, [{
key: "ui",
value: function ui() {
return {
input: 'input[type=number]',
label: 'label[for^="elementor-control-"]'
};
}
}, {
key: "events",
value: function events() {
return {
'mousedown @ui.input': 'onMouseDownInput',
'mousedown @ui.label': 'onMouseDownLabel',
'mouseenter @ui.label': 'onMouseEnterLabel',
'mouseleave @ui.label': 'onMouseLeaveLabel'
};
}
}, {
key: "scrub",
value: function scrub(input, movementEvent) {
var movementType = this.getMovementType(movementEvent);
if (SKIP_SCRUB === movementType) {
return;
}
switch (movementType) {
case SCRUB_REGULAR:
input.value = this.getModifiedValue({
value: input.value,
change: movementEvent.movementX,
modifier: this.scrubSettings.valueModifier
});
break;
case SCRUB_ENHANCED:
input.value = this.getModifiedValue({
value: input.value,
change: movementEvent.movementX,
modifier: this.scrubSettings.enhancedNumber
});
break;
default:
break;
}
// Fire an input event so other behaviors/validators can handle the new input
input.dispatchEvent(new Event('input', {
bubbles: true
}));
}
}, {
key: "getMovementType",
value: function getMovementType(movementEvent) {
if (movementEvent.altKey) {
this.skipperCount++;
// When ALT key is pressed, skipping x times before updating input value.
// 'skipperSteps' defines the exact times to skip, can be changed to any number.
if (this.skipperCount <= this.scrubSettings.skipperSteps) {
return SKIP_SCRUB;
}
this.skipperCount = 0;
return SCRUB_REGULAR;
}
return movementEvent.ctrlKey || movementEvent.metaKey ? SCRUB_ENHANCED : SCRUB_REGULAR;
}
}, {
key: "getModifiedValue",
value: function getModifiedValue(_ref) {
var value = _ref.value,
change = _ref.change,
modifier = _ref.modifier;
if ('function' === typeof modifier) {
modifier = modifier();
}
var newValue = +value + change * modifier;
// Prevent cases where the value resolves to something like 1.0000000000000001.
return parseFloat(newValue.toFixed(1));
}
}, {
key: "isInputValidForScrubbing",
value: function isInputValidForScrubbing(input) {
return input && !input.disabled && 'number' === input.type;
}
/**
* @param {HTMLElement[]} elements
*/
}, {
key: "setActive",
value: function setActive(elements) {
var _this2 = this;
elements.forEach(function (element) {
element.classList.add(_this2.scrubSettings.scrubbingActiveClass);
});
}
/**
* @param {HTMLElement[]} elements
*/
}, {
key: "setInactive",
value: function setInactive(elements) {
var _this3 = this;
elements.forEach(function (element) {
element.classList.remove(_this3.scrubSettings.scrubbingActiveClass);
});
}
}, {
key: "onMouseDownInput",
value: function onMouseDownInput(e) {
var _this4 = this;
var input = e.target;
if (!this.isInputValidForScrubbing(input)) {
return;
}
var trackMovement = function trackMovement(movementEvent) {
_this4.scrub(input, movementEvent);
};
// For input, scrubbing effect works only after X time the mouse is down.
var checkIntentTimeout = setTimeout(function () {
clearTimeout(checkIntentTimeout);
document.addEventListener('mousemove', trackMovement);
$e.uiStates.set('document/scrubbing-mode', _uiStates.ScrubbingMode.ON);
_this4.setActive([input]);
}, this.scrubSettings.intentTime);
document.addEventListener('mouseup', function () {
document.removeEventListener('mousemove', trackMovement);
clearTimeout(checkIntentTimeout);
$e.uiStates.remove('document/scrubbing-mode');
_this4.setInactive([input]);
}, {
once: true
});
}
}, {
key: "onMouseDownLabel",
value: function onMouseDownLabel(e) {
var _this5 = this;
var label = e.target;
var input = e.target.control;
if (!this.isInputValidForScrubbing(input)) {
return;
}
$e.uiStates.set('document/scrubbing-mode', _uiStates.ScrubbingMode.ON);
this.setActive([input, label]);
var trackMovement = function trackMovement(movementEvent) {
_this5.scrub(input, movementEvent);
};
document.addEventListener('mousemove', trackMovement);
document.addEventListener('mouseup', function () {
document.removeEventListener('mousemove', trackMovement);
$e.uiStates.remove('document/scrubbing-mode');
_this5.setInactive([input, label]);
}, {
once: true
});
}
}, {
key: "onMouseEnterLabel",
value: function onMouseEnterLabel(e) {
var input = e.target.control;
if (!this.isInputValidForScrubbing(input)) {
return;
}
e.target.classList.add(this.scrubSettings.scrubbingOverClass);
}
}, {
key: "onMouseLeaveLabel",
value: function onMouseLeaveLabel(e) {
var input = e.target.control;
if (!this.isInputValidForScrubbing(input)) {
return;
}
e.target.classList.remove(this.scrubSettings.scrubbingOverClass);
}
}]);
return Scrubbing;
}(Marionette.Behavior);
exports["default"] = Scrubbing;
/***/ }),
/***/ "../assets/dev/js/editor/controls/box-shadow.js":
/*!******************************************************!*\
!*** ../assets/dev/js/editor/controls/box-shadow.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _colorPicker = _interopRequireDefault(__webpack_require__(/*! ../utils/color-picker */ "../assets/dev/js/editor/utils/color-picker.js"));
var ControlMultipleBaseItemView = __webpack_require__(/*! elementor-controls/base-multiple */ "../assets/dev/js/editor/controls/base-multiple.js"),
ControlBoxShadowItemView;
ControlBoxShadowItemView = ControlMultipleBaseItemView.extend({
ui: function ui() {
var ui = ControlMultipleBaseItemView.prototype.ui.apply(this, arguments);
ui.sliders = '.elementor-slider';
ui.colorPickerPlaceholder = '.elementor-color-picker-placeholder';
return ui;
},
initSliders: function initSliders() {
var _this = this;
var value = this.getControlValue();
this.ui.sliders.each(function (index, slider) {
var $input = jQuery(slider).next('.elementor-slider-input').find('input');
var sliderInstance = noUiSlider.create(slider, {
start: [value[slider.dataset.input]],
step: 1,
range: {
min: +$input.attr('min'),
max: +$input.attr('max')
},
format: {
to: function to(sliderValue) {
return +sliderValue.toFixed(1);
},
from: function from(sliderValue) {
return +sliderValue;
}
}
});
sliderInstance.on('slide', function (values) {
var type = sliderInstance.target.dataset.input;
$input.val(values[0]);
_this.setValue(type, values[0]);
});
});
},
initColors: function initColors() {
var _this2 = this;
this.colorPicker = new _colorPicker.default({
picker: {
el: this.ui.colorPickerPlaceholder[0],
default: this.getControlValue('color')
},
onChange: function onChange() {
_this2.setValue('color', _this2.colorPicker.getColor());
},
onClear: function onClear() {
_this2.setValue('color', '');
}
});
},
onInputChange: function onInputChange(event) {
var type = event.currentTarget.dataset.setting,
$slider = this.ui.sliders.filter('[data-input="' + type + '"]');
$slider[0].noUiSlider.set(this.getControlValue(type));
},
onReady: function onReady() {
this.initSliders();
this.initColors();
},
onBeforeDestroy: function onBeforeDestroy() {
this.colorPicker.destroy();
}
});
module.exports = ControlBoxShadowItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/button.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/button.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseView = __webpack_require__(/*! elementor-controls/base */ "../assets/dev/js/editor/controls/base.js");
module.exports = ControlBaseView.extend({
ui: function ui() {
var ui = ControlBaseView.prototype.ui.apply(this, arguments);
ui.button = 'button';
return ui;
},
events: {
'click @ui.button': 'onButtonClick'
},
onButtonClick: function onButtonClick() {
var eventName = this.model.get('event');
elementor.channels.editor.trigger(eventName, this);
}
});
/***/ }),
/***/ "../assets/dev/js/editor/controls/choose.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/choose.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlChooseItemView;
ControlChooseItemView = ControlBaseDataView.extend({
ui: function ui() {
var ui = ControlBaseDataView.prototype.ui.apply(this, arguments);
ui.inputs = '[type="radio"]';
return ui;
},
events: function events() {
return _.extend(ControlBaseDataView.prototype.events.apply(this, arguments), {
'mousedown label': 'onMouseDownLabel',
'click @ui.inputs': 'onClickInput',
'change @ui.inputs': 'onBaseInputChange'
});
},
updatePlaceholder: function updatePlaceholder() {
var placeholder = this.getControlPlaceholder();
if (!this.getControlValue() && placeholder) {
// Find the input which has value equals to the placeholder (which is the parent's value),
// and add it a placeholder class, to indicate which value is selected in the parent.
this.ui.inputs.filter("[value=\"".concat(this.getControlPlaceholder(), "\"]")).addClass('e-choose-placeholder');
} else {
this.ui.inputs.removeClass('e-choose-placeholder');
}
},
onReady: function onReady() {
this.updatePlaceholder();
},
applySavedValue: function applySavedValue() {
var currentValue = this.getControlValue();
if (currentValue) {
this.ui.inputs.filter('[value="' + currentValue + '"]').prop('checked', true);
} else {
this.ui.inputs.filter(':checked').prop('checked', false);
}
},
onMouseDownLabel: function onMouseDownLabel(event) {
var $clickedLabel = this.$(event.currentTarget),
$selectedInput = this.$('#' + $clickedLabel.attr('for'));
$selectedInput.data('checked', $selectedInput.prop('checked'));
},
onClickInput: function onClickInput(event) {
if (!this.model.get('toggle')) {
return;
}
var $selectedInput = this.$(event.currentTarget);
if ($selectedInput.data('checked')) {
$selectedInput.prop('checked', false).trigger('change');
}
},
onBaseInputChange: function onBaseInputChange() {
ControlBaseDataView.prototype.onBaseInputChange.apply(this, arguments);
this.updatePlaceholder();
}
}, {
onPasteStyle: function onPasteStyle(control, clipboardValue) {
return '' === clipboardValue || undefined !== control.options[clipboardValue];
}
});
module.exports = ControlChooseItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/code.js":
/*!************************************************!*\
!*** ../assets/dev/js/editor/controls/code.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlCodeEditorItemView;
ControlCodeEditorItemView = ControlBaseDataView.extend({
ui: function ui() {
var ui = ControlBaseDataView.prototype.ui.apply(this, arguments);
ui.editor = '.elementor-code-editor';
return ui;
},
onReady: function onReady() {
var self = this;
if ('undefined' === typeof ace) {
return;
}
var langTools = ace.require('ace/ext/language_tools'),
uiTheme = elementor.settings.editorPreferences.model.get('ui_theme'),
userPrefersDark = matchMedia('(prefers-color-scheme: dark)').matches;
self.editor = ace.edit(this.ui.editor[0]);
// Since the code control is wrapped with a dynamic div, the class elementor-control-tag-area need to be had dynamically to handle the dynamic tag functionality.
jQuery(self.editor.container).addClass('e-input-style elementor-code-editor elementor-control-tag-area');
self.editor.setOptions({
mode: 'ace/mode/' + self.model.attributes.language,
minLines: 10,
maxLines: Infinity,
showGutter: true,
useWorker: true,
enableBasicAutocompletion: true,
enableLiveAutocompletion: true
});
if ('dark' === uiTheme || 'auto' === uiTheme && userPrefersDark) {
self.editor.setTheme('ace/theme/merbivore_soft');
}
self.editor.getSession().setUseWrapMode(true);
elementor.panel.$el.on('resize.aceEditor', self.onResize.bind(this));
if ('css' === self.model.attributes.language) {
var selectorCompleter = {
getCompletions: function getCompletions(editor, session, pos, prefix, callback) {
var list = [],
token = session.getTokenAt(pos.row, pos.column);
if (0 < prefix.length && 'selector'.match(prefix) && 'constant' === token.type) {
list = [{
name: 'selector',
value: 'selector',
score: 1,
meta: 'Elementor'
}];
}
callback(null, list);
}
};
langTools.addCompleter(selectorCompleter);
}
self.editor.setValue(self.getControlValue(), -1); // -1 = move cursor to the start
if (this.isEditable()) {
self.editor.on('change', function () {
self.setValue(self.editor.getValue());
});
}
if ('html' === self.model.attributes.language) {
// Remove the `doctype` annotation
var session = self.editor.getSession();
session.on('changeAnnotation', function () {
var annotations = session.getAnnotations() || [],
annotationsLength = annotations.length,
index = annotations.length;
while (index--) {
if (/doctype first\. Expected/.test(annotations[index].text)) {
annotations.splice(index, 1);
}
}
if (annotationsLength > annotations.length) {
session.setAnnotations(annotations);
}
});
}
},
onResize: function onResize() {
this.editor.resize();
},
onDestroy: function onDestroy() {
elementor.panel.$el.off('resize.aceEditor');
},
isEditable: function isEditable() {
var isEditable = this.model.get('is_editable');
return undefined !== isEditable ? isEditable : true;
}
});
module.exports = ControlCodeEditorItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/color.js":
/*!*************************************************!*\
!*** ../assets/dev/js/editor/controls/color.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _baseData = _interopRequireDefault(__webpack_require__(/*! ./base-data */ "../assets/dev/js/editor/controls/base-data.js"));
var _colorPicker = _interopRequireDefault(__webpack_require__(/*! ../utils/color-picker */ "../assets/dev/js/editor/utils/color-picker.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var _default = /*#__PURE__*/function (_ControlBaseDataView) {
(0, _inherits2.default)(_default, _ControlBaseDataView);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "ui",
value: function ui() {
var ui = (0, _get2.default)((0, _getPrototypeOf2.default)(_default.prototype), "ui", this).call(this);
ui.pickerContainer = '.elementor-color-picker-placeholder';
return ui;
}
}, {
key: "applySavedValue",
value: function applySavedValue() {
// Gets the current OR default value of the control.
var currentValue = this.getCurrentValue();
if (this.colorPicker) {
// When there is a global set on the control but there is no value/it doesn't exist, don't show a value.
if (currentValue) {
var _this$colorPicker$pic;
// Set the picker color without triggering the 'onChange' event.
var parsedColor = this.colorPicker.picker._parseLocalColor(currentValue);
(_this$colorPicker$pic = this.colorPicker.picker).setHSVA.apply(_this$colorPicker$pic, (0, _toConsumableArray2.default)(parsedColor.values).concat([false]));
} else {
this.colorPicker.picker._clearColor(true);
}
} else {
this.initPicker();
}
this.$el.toggleClass('e-control-color--no-value', !currentValue);
}
}, {
key: "initPicker",
value: function initPicker() {
var _this$model$get,
_this = this;
var options = {
picker: {
el: this.ui.pickerContainer[0],
default: this.getCurrentValue(),
components: {
opacity: this.model.get('alpha')
},
defaultRepresentation: 'HEX'
},
// Don't create the add button in the Global Settings color pickers.
addButton: (_this$model$get = this.model.get('global')) === null || _this$model$get === void 0 ? void 0 : _this$model$get.active,
onChange: function onChange() {
return _this.onPickerChange();
},
onClear: function onClear() {
return _this.onPickerClear();
},
onAddButtonClick: function onAddButtonClick() {
return _this.onAddGlobalButtonClick();
},
onPickerShow: function onPickerShow() {
return _this.reRoute(true);
},
onPickerHide: function onPickerHide() {
return _this.reRoute(false);
}
};
this.colorPicker = new _colorPicker.default(options);
this.hidePickerOnPreviewClick();
this.$pickerButton = jQuery(this.colorPicker.picker.getRoot().button);
this.addTipsyToPickerButton();
this.addEyedropper();
this.$pickerButton.on('click', function () {
return _this.onPickerButtonClick();
});
jQuery(this.colorPicker.picker.getRoot().root).addClass('elementor-control-unit-1 elementor-control-tag-area');
}
}, {
key: "hidePickerOnPreviewClick",
value: function hidePickerOnPreviewClick() {
var picker = this.colorPicker.picker;
var pickerUtils = picker.constructor.utils;
// Adding to the eventBindings to unbind in the picker's destroy
picker._eventBindings.push(pickerUtils.on(elementorFrontend.elements.window.document, ['touchstart', 'pointerdown'], function () {
if (picker.isOpen()) {
picker.hide();
}
}));
}
}, {
key: "addTipsyToPickerButton",
value: function addTipsyToPickerButton() {
var _this2 = this;
this.$pickerButton.tipsy({
title: function title() {
var currentValue = _this2.getCurrentValue();
// If there is a global enabled for the control, but the global has no value.
if (_this2.getGlobalKey() && !currentValue) {
currentValue = "".concat(__('Invalid Global Color', 'elementor'));
}
return currentValue || '';
},
offset: 4,
gravity: function gravity() {
return 's';
}
});
}
}, {
key: "addEyedropper",
value: function addEyedropper() {
var _this3 = this;
var $colorPicker = jQuery(Marionette.Renderer.render('#tmpl-elementor-control-element-color-picker')),
$colorPickerToolsContainer = this.colorPicker.$pickerToolsContainer,
container = this.getOption('container');
var kit = null;
// When it's a kit (i.e "Site Settings").
if ('kit' === container.document.config.type) {
kit = container.document;
}
// Add a tooltip to the Eye Dropper.
$colorPicker.tipsy({
title: function title() {
return __('Color Sampler', 'elementor');
},
gravity: 's'
});
$colorPicker.on('click', function () {
$e.run('elements-color-picker/start', {
container: container,
kit: kit,
control: _this3.model.get('name'),
trigger: $colorPicker[0]
});
});
$colorPickerToolsContainer.append($colorPicker);
}
}, {
key: "getGlobalMeta",
value: function getGlobalMeta() {
return {
commandName: this.getGlobalCommand(),
key: this.model.get('name'),
controlType: 'colors',
route: 'panel/global/global-colors'
};
}
}, {
key: "getNameAlreadyExistsMessage",
value: function getNameAlreadyExistsMessage() {
return '
' + __('Please note that the same exact color already exists in your Global Colors list. Are you sure you want to create it?', 'elementor');
}
}, {
key: "getConfirmTextMessage",
value: function getConfirmTextMessage() {
return __('Are you sure you want to create a new Global Color?', 'elementor');
}
}, {
key: "getAddGlobalConfirmMessage",
value: function getAddGlobalConfirmMessage(globalColors) {
var colorTitle = __('New Global Color', 'elementor'),
currentValue = this.getCurrentValue(),
$message = jQuery('
', {
class: 'e-global__confirm-message'
}),
$messageText = jQuery('
', {
class: 'e-global__confirm-message-text'
}),
$inputWrapper = jQuery('
', {
class: 'e-global__confirm-input-wrapper'
}),
$colorPreview = this.createColorPreviewBox(currentValue),
$input = jQuery('
', {
type: 'text',
name: 'global-name',
placeholder: colorTitle
}).val(colorTitle);
var messageContent;
// Check if the color already exists in the global colors, and display an appropriate message.
for (var _i = 0, _Object$values = Object.values(globalColors); _i < _Object$values.length; _i++) {
var globalColor = _Object$values[_i];
if (currentValue === globalColor.value) {
messageContent = this.getNameAlreadyExistsMessage();
break;
} else if (colorTitle === globalColor.title) {
messageContent = this.getConfirmTextMessage();
break;
} else {
messageContent = __('Are you sure you want to create a new Global Color?', 'elementor');
}
}
$messageText.html(messageContent);
$inputWrapper.append($colorPreview, $input);
$message.append($messageText, $inputWrapper);
return $message;
}
}, {
key: "getGlobalCommand",
value: function getGlobalCommand() {
return 'globals/colors';
}
// The globalData parameter is received from the Data API.
}, {
key: "createGlobalItemMarkup",
value: function createGlobalItemMarkup(globalData) {
var $color = jQuery('
', {
class: 'e-global__preview-item e-global__color',
'data-global-id': globalData.id
}),
$colorPreview = this.createColorPreviewBox(globalData.value),
$colorTitle = jQuery('
', {
class: 'e-global__color-title'
}).html(globalData.title),
$colorHex = jQuery('', {
class: 'e-global__color-hex'
}).html(globalData.value);
$color.append($colorPreview, $colorTitle, $colorHex);
return $color;
}
}, {
key: "createColorPreviewBox",
value: function createColorPreviewBox(color) {
var $colorPreviewContainer = jQuery('', {
class: 'e-global__color-preview-container'
}),
$colorPreviewColor = jQuery('
', {
class: 'e-global__color-preview-color',
style: 'background-color: ' + color
}),
$colorPreviewBg = jQuery('
', {
class: 'e-global__color-preview-transparent-bg'
});
$colorPreviewContainer.append($colorPreviewBg, $colorPreviewColor);
return $colorPreviewContainer;
}
}, {
key: "getGlobalsList",
value: function () {
var _getGlobalsList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var result;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return $e.data.get(this.getGlobalCommand());
case 2:
result = _context.sent;
return _context.abrupt("return", result.data);
case 4:
case "end":
return _context.stop();
}
}, _callee, this);
}));
function getGlobalsList() {
return _getGlobalsList.apply(this, arguments);
}
return getGlobalsList;
}() // Create the markup for the colors in the global select dropdown.
}, {
key: "buildGlobalsList",
value: function buildGlobalsList(globalColors, $globalPreviewItemsContainer) {
var _this4 = this;
Object.values(globalColors).forEach(function (color) {
if (!color.value) {
return;
}
var $color = _this4.createGlobalItemMarkup(color);
$globalPreviewItemsContainer.append($color);
});
}
}, {
key: "onPickerChange",
value: function onPickerChange() {
this.setValue(this.colorPicker.picker.getColor().toHEXA().toString());
if (!this.isCustom) {
this.triggerMethod('value:type:change');
this.colorPicker.toggleClearButtonState(true);
if (this.$el.hasClass('e-control-color--no-value')) {
this.$el.removeClass('e-control-color--no-value');
}
this.isCustom = true;
}
}
}, {
key: "onPickerClear",
value: function onPickerClear() {
this.isCustom = false;
// Empty the value saved in the control.
this.setValue('');
// Adjust the Global select box text according to the cleared value.
this.triggerMethod('value:type:change');
this.applySavedValue();
this.colorPicker.toggleClearButtonState(false);
}
}, {
key: "onPickerButtonClick",
value: function onPickerButtonClick() {
if (this.getGlobalKey()) {
this.triggerMethod('unset:global:value');
} else if (this.isGlobalActive() && !this.getControlValue() && this.getGlobalDefault()) {
this.triggerMethod('unlink:global:default');
}
// If there is a value in the control, set the clear button to active, if not, deactivate it.
this.colorPicker.toggleClearButtonState(!!this.getCurrentValue());
}
}, {
key: "onAddGlobalButtonClick",
value: function onAddGlobalButtonClick() {
var _this5 = this;
this.getGlobalsList().then(function (globalsList) {
_this5.globalsList = globalsList;
_this5.triggerMethod('add:global:to:list', _this5.getAddGlobalConfirmMessage(globalsList));
});
}
}, {
key: "activate",
value: function activate() {
this.colorPicker.picker.show();
}
}, {
key: "onBeforeDestroy",
value: function onBeforeDestroy() {
if (this.colorPicker) {
this.colorPicker.destroy();
}
}
}]);
return _default;
}(_baseData.default);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/controls/date-time.js":
/*!*****************************************************!*\
!*** ../assets/dev/js/editor/controls/date-time.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js");
var _default = /*#__PURE__*/function (_ControlBaseDataView) {
(0, _inherits2.default)(_default, _ControlBaseDataView);
var _super = _createSuper(_default);
function _default() {
(0, _classCallCheck2.default)(this, _default);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(_default, [{
key: "onReady",
value: function onReady() {
var options = _.extend({
enableTime: true,
minuteIncrement: 1
}, this.model.get('picker_options'));
this.ui.input.flatpickr(options);
}
}, {
key: "onBaseInputChange",
value: function onBaseInputChange() {
var _this$model$get;
(0, _get2.default)((0, _getPrototypeOf2.default)(_default.prototype), "onBaseInputChange", this).apply(this, arguments);
if ((_this$model$get = this.model.get('validation')) !== null && _this$model$get !== void 0 && _this$model$get.date_time) {
this.validateDateTime();
}
}
}, {
key: "validateDateTime",
value: function validateDateTime() {
var _this$model$get$date_ = this.model.get('validation').date_time,
controlName = _this$model$get$date_.control_name,
operator = _this$model$get$date_.operator;
var startDate = this.options.container.settings.get(controlName);
var endDate = this.ui.input.val();
if (!startDate || !endDate) {
return;
}
var startDateTimestamp = new Date(startDate).getTime();
var endDateTimestamp = new Date(endDate).getTime();
if (elementor.conditions.compare(startDateTimestamp, endDateTimestamp, operator)) {
this.ui.input.val('');
}
}
}, {
key: "onBeforeDestroy",
value: function onBeforeDestroy() {
this.ui.input.flatpickr().destroy();
}
}]);
return _default;
}(ControlBaseDataView);
exports["default"] = _default;
/***/ }),
/***/ "../assets/dev/js/editor/controls/dimensions.js":
/*!******************************************************!*\
!*** ../assets/dev/js/editor/controls/dimensions.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _scrubbing = _interopRequireDefault(__webpack_require__(/*! ./behaviors/scrubbing */ "../assets/dev/js/editor/controls/behaviors/scrubbing.js"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ControlBaseUnitsItemView = __webpack_require__(/*! elementor-controls/base-units */ "../assets/dev/js/editor/controls/base-units.js"),
ControlDimensionsItemView;
ControlDimensionsItemView = ControlBaseUnitsItemView.extend({
behaviors: function behaviors() {
var _this = this;
return _objectSpread(_objectSpread({}, ControlBaseUnitsItemView.prototype.behaviors.apply(this)), {}, {
Scrubbing: {
behaviorClass: _scrubbing.default,
scrubSettings: {
intentTime: 800,
valueModifier: function valueModifier() {
var currentUnit = _this.getControlValue('unit');
return ['rem', 'em'].includes(currentUnit) ? 0.1 : 1;
},
enhancedNumber: function enhancedNumber() {
var currentUnit = _this.getControlValue('unit');
return ['rem', 'em'].includes(currentUnit) ? 0.5 : 10;
}
}
}
});
},
ui: function ui() {
var ui = ControlBaseUnitsItemView.prototype.ui.apply(this, arguments);
ui.controls = '.elementor-control-dimension > input:enabled';
ui.link = 'button.elementor-link-dimensions';
return ui;
},
events: function events() {
return _.extend(ControlBaseUnitsItemView.prototype.events.apply(this, arguments), {
'click @ui.link': 'onLinkDimensionsClicked'
});
},
// Default value must be 0, because the CSS generator (in dimensions) expects the 4 dimensions to be filled together (or all are empty).
defaultDimensionValue: 0,
initialize: function initialize() {
ControlBaseUnitsItemView.prototype.initialize.apply(this, arguments);
// TODO: Need to be in helpers, and not in variable
this.model.set('allowed_dimensions', this.filterDimensions(this.model.get('allowed_dimensions')));
},
getPossibleDimensions: function getPossibleDimensions() {
return ['top', 'right', 'bottom', 'left'];
},
filterDimensions: function filterDimensions(filter) {
filter = filter || 'all';
var dimensions = this.getPossibleDimensions();
if ('all' === filter) {
return dimensions;
}
if (!_.isArray(filter)) {
if ('horizontal' === filter) {
filter = ['right', 'left'];
} else if ('vertical' === filter) {
filter = ['top', 'bottom'];
}
}
return filter;
},
onReady: function onReady() {
var self = this,
currentValue = self.getControlValue();
if (!self.isLinkedDimensions()) {
self.ui.link.addClass('unlinked');
self.ui.controls.each(function (index, element) {
var value = currentValue[element.dataset.setting];
if (_.isEmpty(value)) {
value = self.defaultDimensionValue;
}
self.$(element).val(value);
});
}
self.fillEmptyDimensions();
},
updateDimensionsValue: function updateDimensionsValue() {
var currentValue = {},
dimensions = this.getPossibleDimensions(),
$controls = this.ui.controls,
defaultDimensionValue = this.defaultDimensionValue;
dimensions.forEach(function (dimension) {
var $element = $controls.filter('[data-setting="' + dimension + '"]');
currentValue[dimension] = $element.length ? $element.val() : defaultDimensionValue;
});
this.setValue(currentValue);
},
fillEmptyDimensions: function fillEmptyDimensions() {
var $controls = this.ui.controls,
defaultDimensionValue = this.defaultDimensionValue;
if (this.isLinkedDimensions()) {
return;
}
var allowedDimensions = this.model.get('allowed_dimensions'),
dimensions = this.getPossibleDimensions();
dimensions.forEach(function (dimension) {
var $element = $controls.filter('[data-setting="' + dimension + '"]'),
isAllowedDimension = -1 !== _.indexOf(allowedDimensions, dimension);
if (isAllowedDimension && $element.length && _.isEmpty($element.val())) {
$element.val(defaultDimensionValue);
}
});
},
updateDimensions: function updateDimensions() {
this.fillEmptyDimensions();
this.updateDimensionsValue();
},
resetDimensions: function resetDimensions() {
this.ui.controls.val('');
this.updateDimensionsValue();
},
onInputChange: function onInputChange(event) {
var _event$originalEvent;
var inputSetting = event.target.dataset.setting;
if ('unit' === inputSetting) {
this.resetDimensions();
}
if (!_.contains(this.getPossibleDimensions(), inputSetting)) {
return;
}
// When using input with type="number" and the user starts typing `-`, the actual value (`event.target.value`) is
// an empty string. Since the user probably has the intention to insert a negative value, the methods below will
// not be triggered. This will prevent updating the input again with an empty string.
var hasIntentionForNegativeNumber = '-' === (event === null || event === void 0 ? void 0 : (_event$originalEvent = event.originalEvent) === null || _event$originalEvent === void 0 ? void 0 : _event$originalEvent.data) && !event.target.value;
if (hasIntentionForNegativeNumber) {
return;
}
if (this.isLinkedDimensions()) {
var $thisControl = this.$(event.target);
this.ui.controls.val($thisControl.val());
}
this.updateDimensions();
},
onLinkDimensionsClicked: function onLinkDimensionsClicked(event) {
event.preventDefault();
event.stopPropagation();
this.ui.link.toggleClass('unlinked');
this.setValue('isLinked', !this.ui.link.hasClass('unlinked'));
if (this.isLinkedDimensions()) {
// Set all controls value from the first control.
this.ui.controls.val(this.ui.controls.eq(0).val());
}
this.updateDimensions();
},
isLinkedDimensions: function isLinkedDimensions() {
return this.getControlValue('isLinked');
},
updateUnitChoices: function updateUnitChoices() {
ControlBaseUnitsItemView.prototype.updateUnitChoices.apply(this, arguments);
var inputType = 'number';
if (this.isCustomUnit()) {
inputType = 'text';
}
this.ui.controls.attr('type', inputType);
}
});
module.exports = ControlDimensionsItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/font.js":
/*!************************************************!*\
!*** ../assets/dev/js/editor/controls/font.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlSelect2View = __webpack_require__(/*! elementor-controls/select2 */ "../assets/dev/js/editor/controls/select2.js");
module.exports = ControlSelect2View.extend({
$previewContainer: null,
getSelect2Options: function getSelect2Options() {
return {
dir: elementorCommon.config.isRTL ? 'rtl' : 'ltr',
templateSelection: this.fontPreviewTemplate,
templateResult: this.fontPreviewTemplate
};
},
onReady: function onReady() {
var self = this;
this.ui.select.select2(this.getSelect2Options());
this.ui.select.on('select2:open', function () {
self.$previewContainer = jQuery('.select2-results__options[role="tree"]:visible');
// Load initial?
setTimeout(function () {
self.enqueueFontsInView();
}, 100);
// On search
jQuery('input.select2-search__field:visible').on('keyup', function () {
self.typeStopDetection.action.apply(self);
});
// On scroll
self.$previewContainer.on('scroll', function () {
self.scrollStopDetection.onScroll.apply(self);
});
});
},
typeStopDetection: {
idle: 350,
timeOut: null,
action: function action() {
var parent = this,
self = this.typeStopDetection;
clearTimeout(self.timeOut);
self.timeOut = setTimeout(function () {
parent.enqueueFontsInView();
}, self.idle);
}
},
scrollStopDetection: {
idle: 350,
timeOut: null,
onScroll: function onScroll() {
var parent = this,
self = this.scrollStopDetection;
clearTimeout(self.timeOut);
self.timeOut = setTimeout(function () {
parent.enqueueFontsInView();
}, self.idle);
}
},
enqueueFontsInView: function enqueueFontsInView() {
var containerOffset = this.$previewContainer.offset(),
top = containerOffset.top,
bottom = top + this.$previewContainer.innerHeight(),
fontsInView = [];
this.$previewContainer.children().find('li:visible').each(function (index, font) {
var $font = jQuery(font),
offset = $font.offset();
if (offset && offset.top > top && offset.top < bottom) {
fontsInView.push($font);
}
});
fontsInView.forEach(function (font) {
var fontFamily = jQuery(font).find('span').html();
elementor.helpers.enqueueFont(fontFamily, 'editor');
});
},
fontPreviewTemplate: function fontPreviewTemplate(state) {
if (!state.id) {
return state.text;
}
return jQuery('
', {
text: state.text,
css: {
'font-family': state.element.value.toString()
}
});
},
templateHelpers: function templateHelpers() {
var helpers = ControlSelect2View.prototype.templateHelpers.apply(this, arguments),
fonts = this.model.get('options');
helpers.getFontsByGroups = function (groups) {
var filteredFonts = {};
_.each(fonts, function (fontType, fontName) {
if (_.isArray(groups) && _.contains(groups, fontType) || fontType === groups) {
filteredFonts[fontName] = fontName;
}
});
return filteredFonts;
};
return helpers;
}
});
/***/ }),
/***/ "../assets/dev/js/editor/controls/gallery.js":
/*!***************************************************!*\
!*** ../assets/dev/js/editor/controls/gallery.js ***!
\***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var sprintf = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["sprintf"];
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var _filesUploadHandler = _interopRequireDefault(__webpack_require__(/*! ../utils/files-upload-handler */ "../assets/dev/js/editor/utils/files-upload-handler.js"));
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlMediaItemView;
ControlMediaItemView = ControlBaseDataView.extend({
ui: function ui() {
var ui = ControlBaseDataView.prototype.ui.apply(this, arguments);
ui.addImages = '.elementor-control-gallery-add';
ui.clearGallery = '.elementor-control-gallery-clear';
ui.galleryThumbnails = '.elementor-control-gallery-thumbnails';
ui.status = '.elementor-control-gallery-status-title';
// eslint-disable-next-line capitalized-comments
// ui.warnings = '.elementor-control-media__warnings';
ui.promotions = '.elementor-control-media__promotions';
ui.promotions_dismiss = '.elementor-control-media__promotions .elementor-control-notice-dismiss';
ui.promotions_action = '.elementor-control-media__promotions .elementor-control-notice-main-actions button';
return ui;
},
events: function events() {
return _.extend(ControlBaseDataView.prototype.events.apply(this, arguments), {
'click @ui.addImages': 'onAddImagesClick',
'click @ui.clearGallery': 'onClearGalleryClick',
'click @ui.galleryThumbnails': 'onGalleryThumbnailsClick',
'click @ui.promotions_dismiss': 'onPromotionDismiss',
'click @ui.promotions_action': 'onPromotionAction',
'keyup @ui.galleryThumbnails': 'onGalleryThumbnailsKeyPress'
});
},
onReady: function onReady() {
this.initRemoveDialog();
},
applySavedValue: function applySavedValue() {
var _this = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var images, imagesCount, hasImages, imagesWithoutOptimization, promotionsAlwaysOn, hasPromotions, $galleryThumbnails, attachments;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
images = _this.getControlValue(), imagesCount = images.length, hasImages = !!imagesCount, imagesWithoutOptimization = 0, promotionsAlwaysOn = false;
hasPromotions = _this.ui.promotions.length && !elementor.config.user.dismissed_editor_notices.includes(_this.getDismissPromotionEventName());
_this.$el.toggleClass('elementor-gallery-has-images', hasImages).toggleClass('elementor-gallery-empty', !hasImages);
$galleryThumbnails = _this.ui.galleryThumbnails;
$galleryThumbnails.empty();
/* Translators: %s: Selected images count. */
_this.ui.status.text(hasImages ? sprintf(__('%s Images Selected', 'elementor'), imagesCount) : __('No Images Selected', 'elementor'));
if (hasPromotions) {
promotionsAlwaysOn = _this.ui.promotions.find('.elementor-control-notice').data('display') || false;
}
if (hasImages) {
_context.next = 9;
break;
}
return _context.abrupt("return");
case 9:
attachments = [];
_this.getControlValue().forEach(function (image, thumbIndex) {
var $thumbnail = jQuery('', {
class: 'elementor-control-gallery-thumbnail',
src: image.url,
alt: 'gallery-thumbnail-' + thumbIndex
});
$galleryThumbnails.append($thumbnail);
var handleHints = function handleHints(attachment) {
var hasAlt = _this.imageHasAlt(attachment);
if (!hasAlt) {
$thumbnail.addClass('unoptimized__image');
// eslint-disable-next-line capitalized-comments
// imagesWithoutAlt += hasAlt ? 0 : 1;
}
if (hasPromotions && _this.imageNotOptimized(attachment)) {
imagesWithoutOptimization += 1;
}
};
attachments.push(wp.media.attachment(image.id).fetch().then(handleHints));
});
// Ensure all attachments are fetched before updating the warnings
_context.next = 13;
return Promise.all(attachments).then(function () {
// eslint-disable-next-line capitalized-comments
// this.ui.warnings.toggle( !! imagesWithoutAlt );
if (hasPromotions) {
var showHints = promotionsAlwaysOn || !!imagesWithoutOptimization;
_this.ui.promotions.toggle(showHints);
}
});
case 13:
case "end":
return _context.stop();
}
}, _callee);
}))();
},
hasImages: function hasImages() {
return !!this.getControlValue().length;
},
imageHasAlt: function imageHasAlt(attachment) {
var _attachment$alt;
var attachmentAlt = (attachment === null || attachment === void 0 ? void 0 : (_attachment$alt = attachment.alt) === null || _attachment$alt === void 0 ? void 0 : _attachment$alt.trim()) || '';
return !!attachmentAlt;
},
imageNotOptimized: function imageNotOptimized(attachment) {
var checks = {
height: 1080,
width: 1920,
filesizeInBytes: 100000
};
return Object.keys(checks).some(function (key) {
var value = attachment[key] || false;
return value && value > checks[key];
});
},
openFrame: function openFrame(action) {
this.initFrame(action);
this.frame.open();
// Set params to trigger sanitizer
if (_filesUploadHandler.default.isUploadEnabled('svg')) {
_filesUploadHandler.default.setUploadTypeCaller(this.frame);
}
},
initFrame: function initFrame(action) {
var frameStates = {
create: 'gallery',
add: 'gallery-library',
edit: 'gallery-edit'
};
var options = {
frame: 'post',
multiple: true,
state: frameStates[action],
button: {
text: __('Insert Media', 'elementor')
}
};
if (this.hasImages()) {
options.selection = this.fetchSelection();
}
this.frame = wp.media(options);
this.addSvgMimeType();
// When a file is selected, run a callback.
this.frame.on({
update: this.select,
'menu:render:default': this.menuRender,
'content:render:browse': this.gallerySettings
}, this);
},
addSvgMimeType: function addSvgMimeType() {
if (!_filesUploadHandler.default.isUploadEnabled('svg')) {
return;
}
// Add the SVG to the currently allowed extensions
var oldExtensions = _wpPluploadSettings.defaults.filters.mime_types[0].extensions;
this.frame.on('ready', function () {
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = oldExtensions + ',svg';
});
// Restore allowed upload extensions
this.frame.on('close', function () {
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = oldExtensions;
});
},
menuRender: function menuRender(view) {
view.unset('insert');
view.unset('featured-image');
},
gallerySettings: function gallerySettings(browser) {
browser.sidebar.on('ready', function () {
browser.sidebar.unset('gallery');
});
},
fetchSelection: function fetchSelection() {
var attachments = wp.media.query({
orderby: 'post__in',
order: 'ASC',
type: 'image',
perPage: -1,
post__in: _.pluck(this.getControlValue(), 'id')
});
return new wp.media.model.Selection(attachments.models, {
props: attachments.props.toJSON(),
multiple: true
});
},
/**
* Callback handler for when an attachment is selected in the media modal.
* Gets the selected image information, and sets it within the control.
*
* @param {Array<*>} selection
*/
select: function select(selection) {
var images = [];
selection.each(function (image) {
images.push({
id: image.get('id'),
url: image.get('url')
});
});
this.setValue(images);
this.applySavedValue();
},
onPromotionDismiss: function onPromotionDismiss() {
this.dismissPromotion(this.getDismissPromotionEventName());
},
getDismissPromotionEventName: function getDismissPromotionEventName() {
var _$dismissButton$, _$dismissButton$$data;
var $promotions = this.ui.promotions;
var $dismissButton = $promotions.find('.elementor-control-notice-dismiss');
// Remove listener
$dismissButton.off('click');
return ((_$dismissButton$ = $dismissButton[0]) === null || _$dismissButton$ === void 0 ? void 0 : (_$dismissButton$$data = _$dismissButton$.dataset) === null || _$dismissButton$$data === void 0 ? void 0 : _$dismissButton$$data.event) || false;
},
hidePromotion: function hidePromotion() {
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var $promotions = this.ui.promotions;
$promotions.hide();
if (!eventName) {
eventName = this.getDismissPromotionEventName();
}
// Prevent opening the same promotion again in current editor session.
elementor.config.user.dismissed_editor_notices.push(eventName);
},
onPromotionAction: function onPromotionAction(event) {
var _JSON$parse = JSON.parse(event.target.closest('button').dataset.settings),
_JSON$parse$action_ur = _JSON$parse.action_url,
actionURL = _JSON$parse$action_ur === void 0 ? null : _JSON$parse$action_ur;
if (actionURL) {
window.open(actionURL, '_blank');
}
elementorCommon.ajax.addRequest('elementor_image_optimization_campaign', {
data: {
source: 'io-editor-gallery-install'
}
});
this.hidePromotion();
},
dismissPromotion: function dismissPromotion(eventName) {
var $promotions = this.ui.promotions;
$promotions.hide();
if (eventName) {
elementorCommon.ajax.addRequest('dismissed_editor_notices', {
data: {
dismissId: eventName
}
});
// Prevent opening the same promotion again in current editor session.
elementor.config.user.dismissed_editor_notices.push(eventName);
}
},
onBeforeDestroy: function onBeforeDestroy() {
if (this.frame) {
this.frame.off();
}
this.$el.remove();
},
clearGallery: function clearGallery() {
this.setValue([]);
this.applySavedValue();
// eslint-disable-next-line capitalized-comments
// this.ui.warnings.hide();
if (this.ui.promotions) {
this.ui.promotions.hide();
}
},
initRemoveDialog: function initRemoveDialog() {
var removeDialog;
this.getRemoveDialog = function () {
if (!removeDialog) {
removeDialog = elementorCommon.dialogsManager.createWidget('confirm', {
message: __('Are you sure you want to clear this gallery?', 'elementor'),
headerMessage: __('Clear gallery', 'elementor'),
strings: {
confirm: __('Clear', 'elementor'),
cancel: __('Cancel', 'elementor')
},
defaultOption: 'confirm',
onConfirm: this.clearGallery.bind(this)
});
}
return removeDialog;
};
},
onAddImagesClick: function onAddImagesClick() {
this.openFrame(this.hasImages() ? 'add' : 'create');
},
onClearGalleryClick: function onClearGalleryClick() {
this.getRemoveDialog().show();
},
onGalleryThumbnailsClick: function onGalleryThumbnailsClick() {
this.openFrame('edit');
},
onGalleryThumbnailsKeyPress: function onGalleryThumbnailsKeyPress(event) {
var ENTER_KEY = 13,
SPACE_KEY = 32;
if (ENTER_KEY === event.which || SPACE_KEY === event.which) {
this.onGalleryThumbnailsClick(event);
}
}
});
module.exports = ControlMediaItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/gaps.js":
/*!************************************************!*\
!*** ../assets/dev/js/editor/controls/gaps.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
// eslint-disable-next-line prefer-const
var ControlDimensionsView = __webpack_require__(/*! elementor-controls/dimensions */ "../assets/dev/js/editor/controls/dimensions.js"),
ControlGapItemView;
// eslint-disable-next-line prefer-const
ControlGapItemView = ControlDimensionsView.extend({
ui: function ui() {
// eslint-disable-next-line prefer-const
var ui = ControlDimensionsView.prototype.ui.apply(this, arguments);
ui.controls = '.elementor-control-gap > input:enabled';
ui.link = 'button.elementor-link-gaps';
return ui;
},
getPossibleDimensions: function getPossibleDimensions() {
return ['row', 'column'];
},
setValue: function setValue(key, value) {
var values = this.getControlValue();
if ('object' === (0, _typeof2.default)(key)) {
_.each(key, function (internalValue, internalKey) {
values[internalKey] = internalValue;
});
} else {
values[key] = value;
}
var conversion = this.model.get('conversion_map');
if (conversion && conversion.old_key && conversion.new_key) {
values[conversion.old_key] = parseInt(values[conversion.new_key]);
}
this.setSettingsModel(values);
},
getControlValue: function getControlValue() {
var valuesUpdated = ControlDimensionsView.prototype.getControlValue.apply(this, arguments);
if (this.shouldUpdateGapsValues(valuesUpdated)) {
valuesUpdated.column = '' + valuesUpdated.size;
valuesUpdated.row = '' + valuesUpdated.size;
valuesUpdated.isLinked = true;
}
return valuesUpdated;
},
shouldUpdateGapsValues: function shouldUpdateGapsValues(valuesUpdated) {
return !!valuesUpdated.hasOwnProperty('size') && '' !== valuesUpdated.size && !valuesUpdated.hasOwnProperty('column');
}
});
module.exports = ControlGapItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/hidden.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/hidden.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _baseData = _interopRequireDefault(__webpack_require__(/*! ./base-data */ "../assets/dev/js/editor/controls/base-data.js"));
module.exports = _baseData.default.extend({}, {
onPasteStyle: function onPasteStyle() {
return false;
}
});
/***/ }),
/***/ "../assets/dev/js/editor/controls/icon.js":
/*!************************************************!*\
!*** ../assets/dev/js/editor/controls/icon.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlSelect2View = __webpack_require__(/*! elementor-controls/select2 */ "../assets/dev/js/editor/controls/select2.js"),
ControlIconView;
ControlIconView = ControlSelect2View.extend({
initialize: function initialize() {
ControlSelect2View.prototype.initialize.apply(this, arguments);
this.filterIcons();
},
filterIcons: function filterIcons() {
var icons = this.model.get('options'),
include = this.model.get('include');
if (include) {
var filteredIcons = {};
_.each(include, function (iconKey) {
filteredIcons[iconKey] = icons[iconKey];
});
this.model.set('options', filteredIcons);
return;
}
var exclude = this.model.get('exclude');
if (exclude) {
_.each(exclude, function (iconKey) {
delete icons[iconKey];
});
}
},
iconsList: function iconsList(icon) {
if (!icon.id) {
return icon.text;
}
return jQuery(' ' + icon.text + '');
},
getSelect2Options: function getSelect2Options() {
return {
allowClear: true,
templateResult: this.iconsList.bind(this),
templateSelection: this.iconsList.bind(this)
};
}
});
module.exports = ControlIconView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/icons.js":
/*!*************************************************!*\
!*** ../assets/dev/js/editor/controls/icons.js ***!
\*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _filesUploadHandler = _interopRequireDefault(__webpack_require__(/*! ../utils/files-upload-handler */ "../assets/dev/js/editor/utils/files-upload-handler.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var ControlMultipleBaseItemView = __webpack_require__(/*! elementor-controls/base-multiple */ "../assets/dev/js/editor/controls/base-multiple.js");
var ControlIconsView = /*#__PURE__*/function (_ControlMultipleBaseI) {
(0, _inherits2.default)(ControlIconsView, _ControlMultipleBaseI);
var _super = _createSuper(ControlIconsView);
function ControlIconsView() {
var _this;
(0, _classCallCheck2.default)(this, ControlIconsView);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.cache = {
loaded: false,
dialog: false,
enableClicked: false,
fa4Mapping: false,
migratedFlag: {}
};
_this.dataKeys = {
migratedKey: '__fa4_migrated',
fa4MigrationFlag: 'fa4compatibility'
};
return _this;
}
(0, _createClass2.default)(ControlIconsView, [{
key: "enqueueIconFonts",
value: function enqueueIconFonts(iconType) {
var iconSetting = elementor.helpers.getIconLibrarySettings(iconType);
if (false === iconSetting || !this.isMigrationAllowed()) {
return;
}
if (iconSetting.enqueue) {
iconSetting.enqueue.forEach(function (assetURL) {
elementor.helpers.enqueueEditorStylesheet(assetURL);
elementor.helpers.enqueuePreviewStylesheet(assetURL);
});
}
if (iconSetting.url) {
elementor.helpers.enqueueEditorStylesheet(iconSetting.url);
elementor.helpers.enqueuePreviewStylesheet(iconSetting.url);
}
}
}, {
key: "ui",
value: function ui() {
var ui = (0, _get2.default)((0, _getPrototypeOf2.default)(ControlIconsView.prototype), "ui", this).call(this),
skin = this.model.get('skin');
ui.controlMedia = '.elementor-control-media';
ui.svgUploader = 'media' === skin ? '.elementor-control-svg-uploader' : '.elementor-control-icons--inline__svg';
ui.iconPickers = 'media' === skin ? '.elementor-control-icon-picker, .elementor-control-media__preview, .elementor-control-media-upload-button' : '.elementor-control-icons--inline__icon';
ui.deleteButton = 'media' === skin ? '.elementor-control-media__remove' : '.elementor-control-icons--inline__none';
ui.previewPlaceholder = '.elementor-control-media__preview';
ui.previewContainer = '.elementor-control-preview-area';
ui.inlineIconContainer = '.elementor-control-inline-icon';
ui.inlineDisplayedIcon = '.elementor-control-icons--inline__displayed-icon';
ui.radioInputs = '[type="radio"]';
return ui;
}
}, {
key: "events",
value: function events() {
return jQuery.extend(ControlMultipleBaseItemView.prototype.events.apply(this, arguments), {
'click @ui.iconPickers': 'openPicker',
'click @ui.svgUploader': 'openFrame',
'click @ui.radioInputs': 'onClickInput',
'click @ui.deleteButton': 'deleteIcon'
});
}
}, {
key: "getControlValue",
value: function getControlValue() {
var model = this.model,
valueToMigrate = this.getValueToMigrate();
if (!this.isMigrationAllowed()) {
return valueToMigrate;
}
// Bail if no migration flag or no value to migrate
var value = (0, _get2.default)((0, _getPrototypeOf2.default)(ControlIconsView.prototype), "getControlValue", this).call(this);
if (!valueToMigrate) {
return value;
}
var controlName = model.get('name');
// Check if migration had been done and is stored locally
if (this.cache.migratedFlag[controlName]) {
return this.cache.migratedFlag[controlName];
}
// Check if already migrated
var didMigration = this.elementSettingsModel.get(this.dataKeys.migratedKey);
if (didMigration && didMigration[controlName]) {
return value;
}
// Do migration
return this.migrateFa4toFa5(valueToMigrate);
}
}, {
key: "migrateFa4toFa5",
value: function migrateFa4toFa5(fa4Value) {
var fa5Value = elementor.helpers.mapFa4ToFa5(fa4Value);
this.cache.migratedFlag[this.model.get('name')] = fa5Value;
this.enqueueIconFonts(fa5Value.library);
return fa5Value;
}
}, {
key: "setControlAsMigrated",
value: function setControlAsMigrated(controlName) {
var didMigration = this.elementSettingsModel.get(this.dataKeys.migratedKey) || {};
didMigration[controlName] = true;
this.elementSettingsModel.set(this.dataKeys.migratedKey, didMigration, {
silent: true
});
}
}, {
key: "isMigrationAllowed",
value: function isMigrationAllowed() {
return !elementor.config.icons_update_needed;
}
}, {
key: "getValueToMigrate",
value: function getValueToMigrate() {
var controlToMigrate = this.model.get(this.dataKeys.fa4MigrationFlag);
if (!controlToMigrate) {
return false;
}
// Check if there is a value to migrate
var valueToMigrate = this.container.settings.get(controlToMigrate);
if (valueToMigrate) {
return valueToMigrate;
}
return false;
}
}, {
key: "onReady",
value: function onReady() {
var _this2 = this;
// Is migration allowed from fa4
if (!this.isMigrationAllowed()) {
var migrationPopupTrigger = 'media' === this.model.get('skin') ? this.ui.previewContainer[0] : this.ui.inlineIconContainer[0];
migrationPopupTrigger.addEventListener('click', function (event) {
// Prevent default to prevent marking the inline icons as selected on click when migration is not allowed
event.preventDefault();
event.stopPropagation();
var onConfirm = function onConfirm() {
var _elementor$documents$;
window.location.href = elementor.config.tools_page_link + '&redirect_to_document=' + ((_elementor$documents$ = elementor.documents.getCurrent()) === null || _elementor$documents$ === void 0 ? void 0 : _elementor$documents$.id) + '&_wpnonce=' + elementor.config.tools_page_nonce + '#tab-fontawesome4_migration';
};
var enableMigrationDialog = elementor.helpers.getSimpleDialog('elementor-enable-fa5-dialog', __('Elementor\'s New Icon Library', 'elementor'), __('Elementor v2.6 includes an upgrade from Font Awesome 4 to 5. In order to continue using icons, be sure to click "Update".', 'elementor') + ' ' + __('Learn More', 'elementor') + '', __('Update', 'elementor'), onConfirm);
enableMigrationDialog.show();
return false;
}, true);
}
var controlName = this.model.get('name');
if (this.cache.migratedFlag[controlName]) {
this.setControlAsMigrated(controlName);
setTimeout(function () {
_this2.setValue(_this2.cache.migratedFlag[controlName]);
}, 10);
}
}
}, {
key: "onRender",
value: function onRender() {
(0, _get2.default)((0, _getPrototypeOf2.default)(ControlIconsView.prototype), "onRender", this).call(this);
if (this.isMigrationAllowed()) {
elementor.iconManager.loadIconLibraries();
}
}
}, {
key: "initFrame",
value: function initFrame() {
var _this3 = this;
// Set current doc id to attach uploaded images.
wp.media.view.settings.post.id = elementor.config.document.id;
this.frame = wp.media({
button: {
text: __('Insert Media', 'elementor')
},
library: {
type: ['image/svg+xml']
},
states: [new wp.media.controller.Library({
title: __('Insert Media', 'elementor'),
library: wp.media.query({
type: ['image/svg+xml']
}),
multiple: false,
date: false
})]
});
var handleSelect = function handleSelect() {
return _this3.selectSvg();
};
// When a file is selected, run a callback.
this.frame.on('insert select', handleSelect);
this.setUploadMimeType(this.frame, 'svg');
}
}, {
key: "setUploadMimeType",
value: function setUploadMimeType(frame, ext) {
// Set svg as only allowed upload extensions
var oldExtensions = _wpPluploadSettings.defaults.filters.mime_types[0].extensions;
frame.on('ready', function () {
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = ext;
});
this.frame.on('close', function () {
// Restore allowed upload extensions
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = oldExtensions;
});
}
/**
* Callback handler for when an attachment is selected in the media modal.
* Gets the selected image information, and sets it within the control.
*/
}, {
key: "selectSvg",
value: function selectSvg() {
this.trigger('before:select');
// Get the attachment from the modal frame.
var attachment = this.frame.state().get('selection').first().toJSON();
if (attachment.url) {
this.setValue({
value: {
url: attachment.url,
id: attachment.id
},
library: 'svg'
});
this.applySavedValue();
}
this.trigger('after:select');
}
}, {
key: "openFrame",
value: function openFrame() {
var _this4 = this;
if (!_filesUploadHandler.default.isUploadEnabled('svg')) {
_filesUploadHandler.default.getUnfilteredFilesNotEnabledDialog(function () {
return _this4.openFrame();
}).show();
return false;
}
if (!this.frame) {
this.initFrame();
}
this.frame.open();
// Set params to trigger sanitizer
_filesUploadHandler.default.setUploadTypeCaller(this.frame);
var selectedId = this.getControlValue('id');
if (!selectedId) {
return;
}
var selection = this.frame.state().get('selection');
selection.add(wp.media.attachment(selectedId));
}
}, {
key: "openPicker",
value: function openPicker() {
elementor.iconManager.show({
view: this
});
}
}, {
key: "applySavedValue",
value: function applySavedValue() {
var _this5 = this;
var controlValue = this.getControlValue(),
skin = this.model.get('skin'),
iconContainer = 'inline' === skin ? this.ui.inlineDisplayedIcon : this.ui.previewPlaceholder,
disableActiveState = this.model.get('disable_initial_active_state'),
defaultIcon = this.model.get('default');
var iconValue = controlValue.value,
iconType = controlValue.library;
if (!this.isMigrationAllowed() && !iconValue && this.getValueToMigrate()) {
iconValue = this.getControlValue();
iconType = '';
}
if ('media' === skin) {
this.ui.controlMedia.toggleClass('e-media-empty', !iconValue);
}
if ('inline' === skin && !disableActiveState || iconType) {
this.markChecked(iconType);
}
if (!iconValue) {
if ('inline' === skin) {
this.setDefaultIconLibraryLabel(defaultIcon, iconContainer);
return;
}
this.ui.previewPlaceholder.html('');
return;
}
if ('svg' === iconType && 'inline' !== skin) {
return elementor.helpers.fetchInlineSvg(iconValue.url, function (data) {
_this5.ui.previewPlaceholder.html(data);
});
}
if ('media' === skin || 'svg' !== iconType) {
var previewHTML = '';
iconContainer.html(previewHTML);
}
this.enqueueIconFonts(iconType);
}
}, {
key: "setDefaultIconLibraryLabel",
value: function setDefaultIconLibraryLabel(defaultIcon, iconContainer) {
// Check if the control has a default icon
if ('' !== defaultIcon.value && 'svg' !== defaultIcon.library) {
// If the default icon is not an SVG, set the icon-library label's icon to the default icon
iconContainer.html('');
} else {
// If (1) the control does NOT have a default icon,
// OR (2) the control DOES have a default icon BUT the default icon is an SVG,
// set the default icon-library label's icon to a simple circle
var skinOptions = this.model.get('skin_settings');
iconContainer.html('');
}
}
}, {
key: "markChecked",
value: function markChecked(iconType) {
this.ui.radioInputs.filter(':checked').prop('checked', false);
if (!iconType) {
return this.ui.radioInputs.filter('[value="none"]').prop('checked', true);
}
if ('svg' !== iconType) {
iconType = 'icon';
}
this.ui.radioInputs.filter('[value="' + iconType + '"]').prop('checked', true);
}
}, {
key: "onClickInput",
value: function onClickInput() {
this.markChecked(this.getControlValue().library);
}
}, {
key: "deleteIcon",
value: function deleteIcon(event) {
event.stopPropagation();
this.setValue({
value: '',
library: ''
});
this.applySavedValue();
}
}, {
key: "onBeforeDestroy",
value: function onBeforeDestroy() {
this.$el.remove();
}
}]);
return ControlIconsView;
}(ControlMultipleBaseItemView);
module.exports = ControlIconsView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/image-dimensions.js":
/*!************************************************************!*\
!*** ../assets/dev/js/editor/controls/image-dimensions.js ***!
\************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _scrubbing = _interopRequireDefault(__webpack_require__(/*! ./behaviors/scrubbing */ "../assets/dev/js/editor/controls/behaviors/scrubbing.js"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ControlMultipleBaseItemView = __webpack_require__(/*! elementor-controls/base-multiple */ "../assets/dev/js/editor/controls/base-multiple.js"),
ControlImageDimensionsItemView;
ControlImageDimensionsItemView = ControlMultipleBaseItemView.extend({
behaviors: function behaviors() {
return _objectSpread(_objectSpread({}, ControlMultipleBaseItemView.prototype.behaviors.apply(this)), {}, {
Scrubbing: {
behaviorClass: _scrubbing.default,
scrubSettings: {
intentTime: 800
}
}
});
},
ui: function ui() {
return {
inputWidth: 'input[data-setting="width"]',
inputHeight: 'input[data-setting="height"]',
btnApply: 'button.elementor-image-dimensions-apply-button'
};
},
// Override the base events
events: function events() {
return {
'click @ui.btnApply': 'onApplyClicked',
'keyup @ui.inputWidth': 'onDimensionKeyUp',
'keyup @ui.inputHeight': 'onDimensionKeyUp'
};
},
onDimensionKeyUp: function onDimensionKeyUp(event) {
var ENTER_KEY = 13;
if (ENTER_KEY === event.keyCode) {
this.onApplyClicked(event);
}
},
onApplyClicked: function onApplyClicked(event) {
event.preventDefault();
this.setValue({
width: this.ui.inputWidth.val(),
height: this.ui.inputHeight.val()
});
}
});
module.exports = ControlImageDimensionsItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/media.js":
/*!*************************************************!*\
!*** ../assets/dev/js/editor/controls/media.js ***!
\*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var _filesUploadHandler = _interopRequireDefault(__webpack_require__(/*! ../utils/files-upload-handler */ "../assets/dev/js/editor/utils/files-upload-handler.js"));
var _jsonUploadWarningMessage = __webpack_require__(/*! elementor-utils/json-upload-warning-message */ "../assets/dev/js/utils/json-upload-warning-message.js");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ControlMultipleBaseItemView = __webpack_require__(/*! elementor-controls/base-multiple */ "../assets/dev/js/editor/controls/base-multiple.js"),
ControlMediaItemView;
ControlMediaItemView = ControlMultipleBaseItemView.extend({
ui: function ui() {
var ui = ControlMultipleBaseItemView.prototype.ui.apply(this, arguments);
ui.controlMedia = '.elementor-control-media';
ui.mediaImage = '.elementor-control-media__preview';
ui.mediaVideo = '.elementor-control-media-video';
ui.frameOpeners = '.elementor-control-preview-area';
ui.removeButton = '.elementor-control-media__remove';
// eslint-disable-next-line capitalized-comments
// ui.warnings = '.elementor-control-media__warnings';
ui.promotions = '.elementor-control-media__promotions';
ui.promotions_dismiss = '.elementor-control-media__promotions .elementor-control-notice-dismiss';
ui.promotions_action = '.elementor-control-media__promotions .elementor-control-notice-main-actions button';
ui.fileName = '.elementor-control-media__file__content__info__name';
ui.mediaInputImageSize = '.e-image-size-select';
return ui;
},
events: function events() {
return _.extend(ControlMultipleBaseItemView.prototype.events.apply(this, arguments), {
'click @ui.frameOpeners': 'openFrame',
'click @ui.removeButton': 'deleteImage',
'change @ui.mediaInputImageSize': 'onMediaInputImageSizeChange',
'click @ui.promotions_dismiss': 'onPromotionDismiss',
'click @ui.promotions_action': 'onPromotionAction'
});
},
getMediaType: function getMediaType() {
// `get( 'media_type' )` is for BC.
return this.mediaType || this.model.get('media_type') || this.model.get('media_types')[0];
},
/**
* Get library type for `wp.media` using a given media type.
*
* @param {string} mediaType - The media type to get the library for.
* @return {string} library media type
*/
getLibraryType: function getLibraryType(mediaType) {
if (!mediaType) {
mediaType = this.getMediaType();
}
return 'svg' === mediaType ? 'image/svg+xml' : mediaType;
},
applySavedValue: function applySavedValue() {
var _this$getControlPlace,
_this = this;
var value = this.getControlValue('url'),
url = value || ((_this$getControlPlace = this.getControlPlaceholder()) === null || _this$getControlPlace === void 0 ? void 0 : _this$getControlPlace.url),
attachmentId = this.getControlValue('id'),
isPlaceholder = !value && url,
mediaType = this.getMediaType();
if (['image', 'svg'].includes(mediaType)) {
this.ui.mediaImage.css('background-image', url ? 'url(' + url + ')' : '');
if (isPlaceholder) {
this.ui.mediaImage.css('opacity', 0.5);
}
} else if ('video' === mediaType) {
this.ui.mediaVideo.attr('src', url);
} else {
var fileName = url ? url.split('/').pop() : '';
this.ui.fileName.text(fileName);
}
if (this.ui.mediaInputImageSize) {
var imageSize = this.getControlValue('size');
if (isPlaceholder) {
var _this$getControlPlace2;
imageSize = (_this$getControlPlace2 = this.getControlPlaceholder()) === null || _this$getControlPlace2 === void 0 ? void 0 : _this$getControlPlace2.size;
}
this.ui.mediaInputImageSize.val(imageSize).toggleClass('e-select-placeholder', isPlaceholder);
}
this.ui.controlMedia.toggleClass('e-media-empty', !value).toggleClass('e-media-empty-placeholder', !value && !isPlaceholder);
if ('image' === mediaType) {
if (attachmentId) {
var dismissPromotionEventName = this.getDismissPromotionEventName();
var handleHints = function handleHints(attachment) {
// eslint-disable-next-line capitalized-comments
// this.ui.warnings.toggle( ! this.imageHasAlt( attachment ) );
if (_this.ui.promotions.length && !elementor.config.user.dismissed_editor_notices.includes(dismissPromotionEventName)) {
var alwaysOn = _this.ui.promotions.find('.elementor-control-notice').data('display') || false;
var showHint = alwaysOn || _this.imageNotOptimized(attachment);
_this.ui.promotions.toggle(showHint);
}
};
wp.media.attachment(attachmentId).fetch().then(handleHints);
} else {
// eslint-disable-next-line capitalized-comments
// this.ui.warnings.hide();
// eslint-disable-next-line no-lonely-if
if (this.ui.promotions.length) {
this.ui.promotions.hide();
}
}
}
},
openFrame: function openFrame(e) {
var _arguments = arguments,
_this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var _e$target, _e$target$dataset;
var source, mediaType, selectedId;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
source = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : null;
mediaType = (e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : (_e$target$dataset = _e$target.dataset) === null || _e$target$dataset === void 0 ? void 0 : _e$target$dataset.mediaType) || _this2.getMediaType();
_this2.mediaType = mediaType;
if (mediaType) {
_context.next = 5;
break;
}
return _context.abrupt("return");
case 5:
if (_filesUploadHandler.default.isUploadEnabled(mediaType)) {
_context.next = 8;
break;
}
_filesUploadHandler.default.getUnfilteredFilesNotEnabledDialog(function () {
return _this2.openFrame(e, 'filter-popup');
}).show();
return _context.abrupt("return", false);
case 8:
if (!(source !== 'filter-popup' && ['application/json', 'json'].includes(mediaType))) {
_context.next = 11;
break;
}
_context.next = 11;
return (0, _jsonUploadWarningMessage.showJsonUploadWarningMessageIfNeeded)({
introductionMap: window.elementor.config.user.introduction,
IntroductionClass: window.elementorModules.editor.utils.Introduction
});
case 11:
// If there is no frame, or the current initialized frame contains a different library than
// the `data-media-type` of the clicked button, (re)initialize the frame.
if (!_this2.frame || _this2.getLibraryType(mediaType) !== _this2.currentLibraryType) {
_this2.initFrame();
}
_this2.frame.open();
// Set params to trigger sanitizer
_filesUploadHandler.default.setUploadTypeCaller(_this2.frame);
selectedId = _this2.getControlValue('id');
if (selectedId) {
_context.next = 17;
break;
}
return _context.abrupt("return");
case 17:
_this2.frame.state().get('selection').add(wp.media.attachment(selectedId));
case 18:
case "end":
return _context.stop();
}
}, _callee);
}))();
},
deleteImage: function deleteImage(event) {
event.stopPropagation();
this.setValue({
url: '',
id: ''
});
this.applySavedValue();
},
imageHasAlt: function imageHasAlt(attachment) {
var _attachment$alt;
var attachmentAlt = (attachment === null || attachment === void 0 ? void 0 : (_attachment$alt = attachment.alt) === null || _attachment$alt === void 0 ? void 0 : _attachment$alt.trim()) || '';
return !!attachmentAlt;
},
imageNotOptimized: function imageNotOptimized(attachment) {
var checks = {
height: 1080,
width: 1920,
filesizeInBytes: 100000
};
return Object.keys(checks).some(function (key) {
var value = attachment[key] || false;
return value && value > checks[key];
});
},
getDismissPromotionEventName: function getDismissPromotionEventName() {
var _$dismissButton$, _$dismissButton$$data;
var $promotions = this.ui.promotions;
var $dismissButton = $promotions.find('.elementor-control-notice-dismiss');
// Remove listener
$dismissButton.off('click');
return ((_$dismissButton$ = $dismissButton[0]) === null || _$dismissButton$ === void 0 ? void 0 : (_$dismissButton$$data = _$dismissButton$.dataset) === null || _$dismissButton$$data === void 0 ? void 0 : _$dismissButton$$data.event) || false;
},
onPromotionDismiss: function onPromotionDismiss() {
this.dismissPromotion(this.getDismissPromotionEventName());
},
onPromotionAction: function onPromotionAction(event) {
var _JSON$parse = JSON.parse(event.target.closest('button').dataset.settings),
_JSON$parse$action_ur = _JSON$parse.action_url,
actionURL = _JSON$parse$action_ur === void 0 ? null : _JSON$parse$action_ur;
if (actionURL) {
window.open(actionURL, '_blank');
}
this.hidePromotion();
},
dismissPromotion: function dismissPromotion(eventName) {
this.hidePromotion(eventName);
if (eventName) {
elementorCommon.ajax.addRequest('dismissed_editor_notices', {
data: {
dismissId: eventName
}
});
}
},
hidePromotion: function hidePromotion() {
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var $promotions = this.ui.promotions;
$promotions.hide();
if (!eventName) {
eventName = this.getDismissPromotionEventName();
}
elementorCommon.ajax.addRequest('elementor_image_optimization_campaign', {
data: {
source: 'io-editor-image-install'
}
});
// Prevent opening the same promotion again in current editor session.
elementor.config.user.dismissed_editor_notices.push(eventName);
},
onMediaInputImageSizeChange: function onMediaInputImageSizeChange() {
var _this3 = this;
if (!this.model.get('has_sizes')) {
return;
}
var currentControlValue = this.getControlValue(),
placeholder = this.getControlPlaceholder();
var hasImage = '' !== (currentControlValue === null || currentControlValue === void 0 ? void 0 : currentControlValue.id),
hasPlaceholder = placeholder === null || placeholder === void 0 ? void 0 : placeholder.id,
hasValue = hasImage || hasPlaceholder;
if (!hasValue) {
return;
}
var shouldUpdateFromPlaceholder = hasPlaceholder && !hasImage;
if (shouldUpdateFromPlaceholder) {
this.setValue(_objectSpread(_objectSpread({}, placeholder), {}, {
size: currentControlValue.size
}));
if (this.model.get('responsive')) {
// Render is already calls `applySavedValue`, therefore there's no need for it in this case.
this.renderWithChildren();
} else {
this.applySavedValue();
}
this.onMediaInputImageSizeChange();
return;
}
var imageURL;
elementor.channels.editor.once('imagesManager:detailsReceived', function (data) {
var _data$currentControlV;
imageURL = (_data$currentControlV = data[currentControlValue.id]) === null || _data$currentControlV === void 0 ? void 0 : _data$currentControlV[currentControlValue.size];
if (imageURL) {
currentControlValue.url = imageURL;
_this3.setValue(currentControlValue);
}
});
imageURL = elementor.imagesManager.getImageUrl({
id: currentControlValue.id,
url: currentControlValue.url,
size: currentControlValue.size
});
if (imageURL) {
currentControlValue.url = imageURL;
this.setValue(currentControlValue);
}
},
/**
* Create a media modal select frame, and store it so the instance can be reused when needed.
*/
initFrame: function initFrame() {
var mediaType = this.getMediaType();
this.currentLibraryType = this.getLibraryType(mediaType);
// Set current doc id to attach uploaded images.
wp.media.view.settings.post.id = elementor.config.document.id;
this.frame = wp.media({
frame: 'post',
type: 'image',
multiple: false,
states: [new wp.media.controller.Library({
title: __('Insert Media', 'elementor'),
library: wp.media.query({
type: this.currentLibraryType
}),
multiple: false,
date: false
})]
});
// Remove unwanted elements when frame is opened.
this.frame.on('ready open', this.onFrameReady.bind(this));
// When a file is selected, run a callback.
this.frame.on('insert select', this.select.bind(this));
if (elementorCommon.config.filesUpload.unfilteredFiles) {
this.setUploadMimeType(this.frame, mediaType);
}
},
/**
* Hack to remove unwanted elements from modal & Open the `Insert from URL` tab.
*/
onFrameReady: function onFrameReady() {
var $frame = this.frame.$el;
var elementsToRemove = ['#menu-item-insert', '#menu-item-gallery', '#menu-item-playlist', '#menu-item-video-playlist', '.embed-link-settings'];
$frame.find(elementsToRemove.join(',')).remove();
// Change the default button text using CSS by passing the text as a variable.
$frame.css('--button-text', "'".concat(__('Insert Media', 'elementor'), "'"));
// Remove elements from the URL upload tab.
$frame.addClass('e-wp-media-elements-removed');
if ('url' === this.getControlValue('source')) {
// Go to the url tab.
$frame.find('#menu-item-embed').trigger('click');
// Hide the top media tabs ( WordPress does that automatically if a real user clicks the url tab ).
$frame.addClass('hide-router');
// Load the image URL.
this.frame.views.get('.media-frame-content')[0].url.model.set({
url: this.getControlValue('url'),
alt: this.getControlValue('alt')
});
} else {
// Go to the upload tab.
$frame.find('#menu-item-library').trigger('click');
}
},
setUploadMimeType: function setUploadMimeType(frame, ext) {
// Add unfiltered files to the allowed upload extensions
var oldExtensions = _wpPluploadSettings.defaults.filters.mime_types[0].extensions;
frame.on('ready', function () {
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = 'application/json' === ext ? 'json' : oldExtensions + ',svg';
});
this.frame.on('close', function () {
// Restore allowed upload extensions
_wpPluploadSettings.defaults.filters.mime_types[0].extensions = oldExtensions;
});
},
/**
* Callback handler for when an attachment is selected in the media modal.
* Gets the selected image information, and sets it within the control.
*/
select: function select() {
this.trigger('before:select');
var state = this.frame.state();
var attachment;
if ('embed' === state.get('id')) {
// Insert from URL.
attachment = {
url: state.props.get('url'),
id: '',
alt: state.props.get('alt'),
source: 'url'
};
} else {
// Get the attachment from the modal frame.
attachment = this.frame.state().get('selection').first().toJSON();
attachment.source = 'library';
}
if (attachment.url) {
this.setValue({
url: attachment.url,
id: attachment.id,
alt: attachment.alt,
source: attachment.source,
size: this.model.get('default').size
});
if (this.model.get('responsive')) {
// Render is already calls `applySavedValue`, therefore there's no need for it in this case.
this.renderWithChildren();
} else {
this.applySavedValue();
}
}
this.onMediaInputImageSizeChange();
this.trigger('after:select');
},
onBeforeDestroy: function onBeforeDestroy() {
this.$el.remove();
}
});
module.exports = ControlMediaItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/notice.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/notice.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js"));
var ControlBaseView = __webpack_require__(/*! elementor-controls/base */ "../assets/dev/js/editor/controls/base.js");
module.exports = ControlBaseView.extend({
ui: function ui() {
var ui = ControlBaseView.prototype.ui.apply(this, arguments);
ui.button = '.elementor-control-notice-dismiss';
return ui;
},
events: {
'click @ui.button.e-btn-1': 'onButton1Click',
'click @ui.button.e-btn-2': 'onButton2Click',
'click @ui.button.elementor-control-notice-dismiss': 'onDismissButtonClick'
},
onButton1Click: function onButton1Click() {
var eventName = this.model.get('event');
elementor.channels.editor.trigger(eventName, this);
},
onButton2Click: function onButton2Click() {
var eventName = this.model.get('event');
elementor.channels.editor.trigger(eventName, this);
},
getDismissId: function getDismissId() {
var _this$options, _this$options$element, _this$options$element2, _this$options$element3, _this$options2, _this$options2$elemen, _this$options2$elemen2, _this$options2$elemen3, _this$options3, _this$options3$elemen, _this$options3$elemen2, _this$options3$elemen3;
var controlName = this.model.get('name');
var elementType = 'widget' === ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : (_this$options$element = _this$options.element) === null || _this$options$element === void 0 ? void 0 : (_this$options$element2 = _this$options$element.model) === null || _this$options$element2 === void 0 ? void 0 : (_this$options$element3 = _this$options$element2.attributes) === null || _this$options$element3 === void 0 ? void 0 : _this$options$element3.elType) ? (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$elemen = _this$options2.element) === null || _this$options2$elemen === void 0 ? void 0 : (_this$options2$elemen2 = _this$options2$elemen.model) === null || _this$options2$elemen2 === void 0 ? void 0 : (_this$options2$elemen3 = _this$options2$elemen2.attributes) === null || _this$options2$elemen3 === void 0 ? void 0 : _this$options2$elemen3.widgetType : (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : (_this$options3$elemen = _this$options3.element) === null || _this$options3$elemen === void 0 ? void 0 : (_this$options3$elemen2 = _this$options3$elemen.model) === null || _this$options3$elemen2 === void 0 ? void 0 : (_this$options3$elemen3 = _this$options3$elemen2.attributes) === null || _this$options3$elemen3 === void 0 ? void 0 : _this$options3$elemen3.elType;
return "".concat(elementType, "-").concat(controlName);
},
onDismissButtonClick: function onDismissButtonClick() {
var _this = this;
var dismissId = this.getDismissId();
elementorCommon.ajax.addRequest('dismissed_editor_notices', {
data: {
dismissId: dismissId
},
success: function success() {
var _elementor, _elementor$config, _elementor$config$use;
_this.$el.remove();
var dismissedNotices = (_elementor = elementor) !== null && _elementor !== void 0 && (_elementor$config = _elementor.config) !== null && _elementor$config !== void 0 && (_elementor$config$use = _elementor$config.user) !== null && _elementor$config$use !== void 0 && _elementor$config$use.dismissed_editor_notices ? (0, _toConsumableArray2.default)(elementor.config.user.dismissed_editor_notices) : [];
elementor.config.user.dismissed_editor_notices = [].concat((0, _toConsumableArray2.default)(dismissedNotices), [dismissId]);
}
});
},
templateHelpers: function templateHelpers() {
var _elementor2, _elementor2$config, _elementor2$config$us;
var controlData = ControlBaseView.prototype.templateHelpers.apply(this, arguments);
var dismissedNotices = (_elementor2 = elementor) !== null && _elementor2 !== void 0 && (_elementor2$config = _elementor2.config) !== null && _elementor2$config !== void 0 && (_elementor2$config$us = _elementor2$config.user) !== null && _elementor2$config$us !== void 0 && _elementor2$config$us.dismissed_editor_notices ? (0, _toConsumableArray2.default)(elementor.config.user.dismissed_editor_notices) : [];
var dismissId = this.getDismissId();
controlData.data.shouldRenderNotice = !dismissedNotices.includes(dismissId);
return controlData;
}
});
/***/ }),
/***/ "../assets/dev/js/editor/controls/number.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/number.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
var _scrubbing = _interopRequireDefault(__webpack_require__(/*! ./behaviors/scrubbing */ "../assets/dev/js/editor/controls/behaviors/scrubbing.js"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlNumberItemView;
ControlNumberItemView = ControlBaseDataView.extend({
behaviors: function behaviors() {
return _objectSpread(_objectSpread({}, ControlBaseDataView.prototype.behaviors.apply(this)), {}, {
Scrubbing: {
behaviorClass: _scrubbing.default,
scrubSettings: {
intentTime: 800
}
}
});
},
registerValidators: function registerValidators() {
ControlBaseDataView.prototype.registerValidators.apply(this, arguments);
var validationTerms = {},
model = this.model;
['min', 'max'].forEach(function (term) {
var termValue = model.get(term);
if (_.isFinite(termValue)) {
validationTerms[term] = termValue;
}
});
if (!jQuery.isEmptyObject(validationTerms)) {
this.addValidator(new this.validatorTypes.Number({
validationTerms: validationTerms
}));
}
}
});
module.exports = ControlNumberItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/popover-toggle.js":
/*!**********************************************************!*\
!*** ../assets/dev/js/editor/controls/popover-toggle.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js"));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var ControlChooseView = __webpack_require__(/*! elementor-controls/choose */ "../assets/dev/js/editor/controls/choose.js");
var ControlPopoverStarterView = /*#__PURE__*/function (_ControlChooseView) {
(0, _inherits2.default)(ControlPopoverStarterView, _ControlChooseView);
var _super = _createSuper(ControlPopoverStarterView);
function ControlPopoverStarterView() {
(0, _classCallCheck2.default)(this, ControlPopoverStarterView);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(ControlPopoverStarterView, [{
key: "ui",
value: function ui() {
var ui = ControlChooseView.prototype.ui.apply(this, arguments);
ui.popoverToggle = '.elementor-control-popover-toggle-toggle';
ui.resetInput = '.elementor-control-popover-toggle-reset';
return ui;
}
}, {
key: "events",
value: function events() {
return _.extend(ControlChooseView.prototype.events.apply(this, arguments), {
'click @ui.popoverToggle': 'onPopoverToggleClick',
'click @ui.resetInput': 'onResetInputClick'
});
}
}, {
key: "onShow",
value: function onShow() {
var _this = this;
var $popover = this.$el.next('.elementor-controls-popover');
// Attach the current control as a toggle of its popover.
if ($popover.length) {
$popover[0].dataset.popoverToggle = "elementor-control-default-".concat(this.model.cid);
$popover.on('hide', function () {
return _this.onPopoverHide();
});
$popover.attr('data-on-hide', true);
}
}
}, {
key: "onPopoverHide",
value: function onPopoverHide() {
this.reRoute(false);
}
}, {
key: "onResetInputClick",
value: function onResetInputClick() {
var globalData = this.model.get('global');
if (globalData !== null && globalData !== void 0 && globalData.active) {
this.triggerMethod('value:type:change');
}
}
}, {
key: "onInputChange",
value: function onInputChange(event) {
if (event.currentTarget !== this.ui.popoverToggle[0]) {
return;
}
// If the control has a global value, unset the global.
if (this.getGlobalKey()) {
this.triggerMethod('unset:global:value');
} else if (this.isGlobalActive()) {
this.triggerMethod('value:type:change');
}
}
}, {
key: "onPopoverToggleClick",
value: function onPopoverToggleClick() {
var _this2 = this;
if (this.isGlobalActive() && !this.getControlValue() && !this.getGlobalKey() && this.getGlobalDefault()) {
this.triggerMethod('unlink:global:default');
}
var $popover = this.$el.next('.elementor-controls-popover');
if (!$popover.attr('data-on-hide')) {
$popover.attr('data-on-hide', true);
$popover.on('hide', function () {
return _this2.onPopoverHide();
});
}
if (!$popover.is(':visible')) {
this.reRoute(true);
} else {
$popover.hide();
$popover.trigger('hide');
}
}
}, {
key: "activate",
value: function activate() {
this.$el.next('.elementor-controls-popover').show();
}
}, {
key: "getGlobalCommand",
value: function getGlobalCommand() {
return 'globals/typography';
}
}, {
key: "buildPreviewItemCSS",
value: function buildPreviewItemCSS(globalValue) {
var cssObject = {};
Object.entries(globalValue).forEach(function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
property = _ref2[0],
value = _ref2[1];
// If a control value is empty, ignore it.
if (!value || '' === value.size) {
return;
}
if (property.startsWith('typography_')) {
property = property.replace('typography_', '');
}
if ('font_family' === property) {
elementor.helpers.enqueueFont(value, 'editor');
}
if ('font_size' === property) {
var fontSize = 'custom' === value.unit ? value.size : "".concat(value.size).concat(value.unit);
cssObject.fontSize = "min(".concat(fontSize, ", 28px)");
} else {
// Convert the snake case property names into camel case to match their corresponding CSS property names.
if (property.includes('_')) {
property = property.replace(/([_][a-z])/g, function (result) {
return result.toUpperCase().replace('_', '');
});
}
cssObject[property] = value;
}
});
return cssObject;
}
}, {
key: "createGlobalItemMarkup",
value: function createGlobalItemMarkup(globalData) {
var $typographyPreview = jQuery('', {
class: 'e-global__preview-item e-global__typography',
'data-global-id': globalData.id,
title: globalData.title
});
$typographyPreview.html(globalData.title).css(this.buildPreviewItemCSS(globalData.value));
return $typographyPreview;
}
}, {
key: "getGlobalMeta",
value: function getGlobalMeta() {
return {
commandName: this.getGlobalCommand(),
key: this.model.get('name'),
title: __('New Typography Setting', 'elementor'),
controlType: 'typography',
route: 'panel/global/global-typography'
};
}
}, {
key: "getAddGlobalConfirmMessage",
value: function getAddGlobalConfirmMessage() {
var globalData = this.getGlobalMeta(),
$message = jQuery('
', {
class: 'e-global__confirm-message'
}),
$messageText = jQuery('
').html(__('Are you sure you want to create a new Global Font setting?', 'elementor')),
$inputWrapper = jQuery('
', {
class: 'e-global__confirm-input-wrapper'
}),
$input = jQuery('
', {
type: 'text',
name: 'global-name',
placeholder: globalData.title
}).val(globalData.title);
$inputWrapper.append($input);
$message.append($messageText, $inputWrapper);
return $message;
}
}, {
key: "getGlobalsList",
value: function () {
var _getGlobalsList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var result;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return $e.data.get(this.getGlobalCommand());
case 2:
result = _context.sent;
return _context.abrupt("return", result.data);
case 4:
case "end":
return _context.stop();
}
}, _callee, this);
}));
function getGlobalsList() {
return _getGlobalsList.apply(this, arguments);
}
return getGlobalsList;
}()
}, {
key: "buildGlobalsList",
value: function buildGlobalsList(globalTypographies, $globalPreviewItemsContainer) {
var _this3 = this;
Object.values(globalTypographies).forEach(function (typography) {
// Only build markup if the typography is valid.
if (typography) {
var $typographyPreview = _this3.createGlobalItemMarkup(typography);
$globalPreviewItemsContainer.append($typographyPreview);
}
});
}
}, {
key: "onAddGlobalButtonClick",
value: function onAddGlobalButtonClick() {
this.triggerMethod('add:global:to:list', this.getAddGlobalConfirmMessage());
}
}]);
return ControlPopoverStarterView;
}(ControlChooseView);
exports["default"] = ControlPopoverStarterView;
ControlPopoverStarterView.onPasteStyle = function (control, clipboardValue) {
return !clipboardValue || clipboardValue === control.return_value;
};
/***/ }),
/***/ "../assets/dev/js/editor/controls/repeater-row.js":
/*!********************************************************!*\
!*** ../assets/dev/js/editor/controls/repeater-row.js ***!
\********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var sprintf = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["sprintf"];
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _controlsStack = _interopRequireDefault(__webpack_require__(/*! elementor-views/controls-stack */ "../assets/dev/js/editor/views/controls-stack.js"));
module.exports = Marionette.CompositeView.extend({
template: Marionette.TemplateCache.get('#tmpl-elementor-repeater-row'),
className: 'elementor-repeater-fields',
ui: function ui() {
return {
duplicateButton: '.elementor-repeater-tool-duplicate',
editButton: '.elementor-repeater-tool-edit',
removeButton: '.elementor-repeater-tool-remove',
itemTitle: '.elementor-repeater-row-item-title'
};
},
behaviors: {
HandleInnerTabs: {
behaviorClass: __webpack_require__(/*! elementor-behaviors/inner-tabs */ "../assets/dev/js/editor/elements/views/behaviors/inner-tabs.js")
}
},
triggers: {
'click @ui.removeButton': 'click:remove',
'click @ui.duplicateButton': 'click:duplicate',
'click @ui.itemTitle': 'click:edit'
},
modelEvents: {
change: 'onModelChange'
},
templateHelpers: function templateHelpers() {
return {
itemIndex: this.getOption('itemIndex'),
itemActions: this.getOption('itemActions')
};
},
childViewContainer: '.elementor-repeater-row-controls',
getChildView: function getChildView(item) {
var controlType = item.get('type');
return elementor.getControlView(controlType);
},
getChildControlView: function getChildControlView(name) {
return this.getControlViewByModel(this.getControlModel(name));
},
getControlViewByModel: function getControlViewByModel(model) {
return this.children.findByModelCid(model.cid);
},
getControlModel: function getControlModel(name) {
return this.collection.findWhere({
name: name
});
},
childViewOptions: function childViewOptions() {
return {
container: this.options.container
};
},
updateIndex: function updateIndex(newIndex) {
this.itemIndex = newIndex;
},
setTitle: function setTitle() {
var titleField = this.getOption('titleField');
var title = '';
if (titleField) {
title = Marionette.TemplateCache.prototype.compileTemplate(titleField)(this.model.parseDynamicSettings());
}
if (!title) {
/* Translators: %s: Item Index (number). */
title = sprintf(__('Item #%s', 'elementor'), this.getOption('itemIndex'));
}
this.ui.itemTitle.html(title);
},
toggleSort: function toggleSort(enable) {
this.$el.toggleClass('elementor-repeater-row--disable-sort', !enable);
},
initialize: function initialize(options) {
this.itemIndex = 0;
// Collection for Controls list
this.collection = new Backbone.Collection(_.values(elementor.mergeControlsSettings(options.controlFields)));
},
onRender: function onRender() {
this.setTitle();
_controlsStack.default.handlePopovers(this);
},
onModelChange: function onModelChange() {
if (this.getOption('titleField')) {
this.setTitle();
}
},
onChildviewResponsiveSwitcherClick: function onChildviewResponsiveSwitcherClick(childView, device) {
if ('desktop' === device) {
elementor.getPanelView().getCurrentPageView().$el.toggleClass('elementor-responsive-switchers-open');
}
}
});
/***/ }),
/***/ "../assets/dev/js/editor/controls/repeater.js":
/*!****************************************************!*\
!*** ../assets/dev/js/editor/controls/repeater.js ***!
\****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
RepeaterRowView = __webpack_require__(/*! elementor-controls/repeater-row */ "../assets/dev/js/editor/controls/repeater-row.js"),
ControlRepeaterItemView;
ControlRepeaterItemView = ControlBaseDataView.extend({
ui: {
btnAddRow: '.elementor-repeater-add',
fieldContainer: '.elementor-repeater-fields-wrapper'
},
events: function events() {
return {
'click @ui.btnAddRow': 'onButtonAddRowClick',
'sortstart @ui.fieldContainer': 'onSortStart',
'sortupdate @ui.fieldContainer': 'onSortUpdate',
'sortstop @ui.fieldContainer': 'onSortStop'
};
},
childView: RepeaterRowView,
childViewContainer: '.elementor-repeater-fields-wrapper',
templateHelpers: function templateHelpers() {
return {
itemActions: this.model.get('item_actions'),
data: _.extend({}, this.model.toJSON(), {
controlValue: []
})
};
},
childViewOptions: function childViewOptions(rowModel, index) {
var elementContainer = this.getOption('container');
return {
container: elementContainer.repeaters[this.model.get('name')].children[index],
controlFields: this.model.get('fields'),
titleField: this.model.get('title_field'),
itemActions: this.model.get('item_actions')
};
},
createItemModel: function createItemModel(attrs, options, controlView) {
options.controls = controlView.model.get('fields');
return new elementorModules.editor.elements.models.BaseSettings(attrs, options);
},
fillCollection: function fillCollection() {
// TODO: elementSettingsModel is deprecated since 2.8.0.
var settings = this.container ? this.container.settings : this.elementSettingsModel;
var controlName = this.model.get('name');
this.collection = settings.get(controlName);
// Hack for history redo/undo
if (!(this.collection instanceof Backbone.Collection)) {
this.collection = new Backbone.Collection(this.collection, {
// Use `partial` to supply the `this` as an argument, but not as context
// the `_` is a place holder for original arguments: `attrs` & `options`
model: _.partial(this.createItemModel, _, _, this)
});
// Set the value silent
settings.set(controlName, this.collection, {
silent: true
});
}
},
initialize: function initialize() {
ControlBaseDataView.prototype.initialize.apply(this, arguments);
this.fillCollection();
this.listenTo(this.collection, 'reset', this.resetContainer.bind(this));
this.listenTo(this.collection, 'add', this.updateContainer.bind(this));
},
editRow: function editRow(rowView) {
if (this.currentEditableChild) {
var currentEditable = this.currentEditableChild.getChildViewContainer(this.currentEditableChild);
currentEditable.removeClass('editable');
// If the repeater contains TinyMCE editors, fire the `hide` trigger to hide floated toolbars
currentEditable.find('.elementor-wp-editor').each(function () {
tinymce.get(this.id).fire('hide');
});
}
if (this.currentEditableChild === rowView) {
delete this.currentEditableChild;
return;
}
rowView.getChildViewContainer(rowView).addClass('editable');
this.currentEditableChild = rowView;
this.updateActiveRow();
},
toggleClasses: function toggleClasses() {
this.toggleMinRowsClass();
this.toggleMaxRowsClass();
},
toggleMaxRowsClass: function toggleMaxRowsClass() {
var maxItems = this.model.get('max_items');
if (!maxItems || !Number.isInteger(maxItems)) {
return;
}
this.$el.toggleClass('elementor-repeater-has-maximum-rows', maxItems <= this.collection.length);
},
getMinItems: function getMinItems() {
var minItems = 0;
if (this.model.get('min_items') && Number.isInteger(this.model.get('min_items'))) {
minItems = this.model.get('min_items');
} else if (this.model.get('prevent_empty')) {
minItems = 1;
}
return minItems;
},
toggleMinRowsClass: function toggleMinRowsClass() {
var minItems = this.getMinItems();
if (!minItems) {
return;
}
this.$el.toggleClass('elementor-repeater-has-minimum-rows', minItems >= this.collection.length);
},
updateActiveRow: function updateActiveRow() {
var activeItemIndex = 1;
if (this.currentEditableChild) {
activeItemIndex = this.currentEditableChild.itemIndex;
}
this.setEditSetting('activeItemIndex', activeItemIndex);
},
updateChildIndexes: function updateChildIndexes() {
var collection = this.collection;
this.children.each(function (view) {
view.updateIndex(collection.indexOf(view.model) + 1);
view.setTitle();
});
},
getSortableParams: function getSortableParams() {
return {
axis: 'y',
handle: '.elementor-repeater-row-tools',
items: ' > :not(.elementor-repeater-row--disable-sort)',
cancel: '' // Elements that do not allow sorting (by default it includs buttons).
};
},
onRender: function onRender() {
ControlBaseDataView.prototype.onRender.apply(this, arguments);
if (this.model.get('item_actions').sort) {
this.ui.fieldContainer.sortable(this.getSortableParams());
}
this.toggleClasses();
},
onSortStart: function onSortStart(event, ui) {
ui.item.data('oldIndex', ui.item.index());
},
onSortStop: function onSortStop(event, ui) {
// Reload TinyMCE editors (if exist), it's a bug that TinyMCE content is missing after stop dragging
var self = this,
sortedIndex = ui.item.index();
if (-1 === sortedIndex) {
return;
}
var sortedRowView = self.children.findByIndex(ui.item.index()),
rowControls = sortedRowView.children._views;
jQuery.each(rowControls, function () {
if ('wysiwyg' === this.model.get('type')) {
sortedRowView.render();
delete self.currentEditableChild;
return false;
}
});
},
onSortUpdate: function onSortUpdate(event, ui) {
var oldIndex = ui.item.data('oldIndex'),
newIndex = ui.item.index();
$e.run('document/repeater/move', {
container: this.options.container,
name: this.model.get('name'),
sourceIndex: oldIndex,
targetIndex: newIndex
});
},
onAddChild: function onAddChild() {
this.updateChildIndexes();
this.updateActiveRow();
this.toggleClasses();
},
/**
* Update container to ensure that new child elements appear in container children.
*
* @param {*} model - Container model.
*/
updateContainer: function updateContainer(model) {
var container = this.options.container.repeaters[this.model.get('name')],
isInChildren = container.children.filter(function (child) {
return child.id === model.get('_id');
});
if (!isInChildren.length) {
elementorDevTools.deprecation.deprecated('Don\'t add models directly to the repeater.', '3.0.0', '$e.run( \'document/repeater/insert\' )');
this.options.container.addRepeaterItem(this.model.get('name'), model, model.collection.indexOf(model));
}
},
/**
* Reset container to ensure that container children are reset on collection reset.
*
* @deprecated since 3.0.0, use `$e.run( 'document/repeater/remove' )` instead.
*/
resetContainer: function resetContainer() {
elementorDevTools.deprecation.deprecated('Don\'t reset repeater collection directly.', '3.0.0', '$e.run( \'document/repeater/remove\' )');
this.options.container.repeaters[this.model.get('name')].children = [];
},
getDefaults: function getDefaults() {
var defaults = {};
// Get default fields.
_.each(this.model.get('fields'), function (field) {
defaults[field.name] = field.default;
});
return defaults;
},
getChildControlView: function getChildControlView(id) {
return this.getControlViewByModel(this.getControlModel(id));
},
getControlViewByModel: function getControlViewByModel(model) {
return this.children.findByModelCid(model.cid);
},
getControlModel: function getControlModel(_id) {
return this.collection.findWhere({
_id: _id
});
},
onButtonAddRowClick: function onButtonAddRowClick() {
var newModel = $e.run('document/repeater/insert', {
container: this.options.container,
name: this.model.get('name'),
model: this.getDefaults()
});
var newChild = this.children.findByModel(newModel);
this.editRow(newChild);
this.toggleClasses();
},
onChildviewClickRemove: function onChildviewClickRemove(childView) {
if (childView === this.currentEditableChild) {
delete this.currentEditableChild;
}
$e.run('document/repeater/remove', {
container: this.options.container,
name: this.model.get('name'),
index: childView._index
});
this.updateActiveRow();
this.updateChildIndexes();
this.toggleClasses();
},
onChildviewClickDuplicate: function onChildviewClickDuplicate(childView) {
$e.run('document/repeater/duplicate', {
container: this.options.container,
name: this.model.get('name'),
index: childView._index
});
this.toggleClasses();
},
onChildviewClickEdit: function onChildviewClickEdit(childView) {
this.editRow(childView);
},
onAfterExternalChange: function onAfterExternalChange() {
// Update the collection with current value
this.fillCollection();
ControlBaseDataView.prototype.onAfterExternalChange.apply(this, arguments);
}
});
module.exports = ControlRepeaterItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/section.js":
/*!***************************************************!*\
!*** ../assets/dev/js/editor/controls/section.js ***!
\***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseView = __webpack_require__(/*! elementor-controls/base */ "../assets/dev/js/editor/controls/base.js"),
ControlSectionItemView;
ControlSectionItemView = ControlBaseView.extend({
ui: function ui() {
var ui = ControlBaseView.prototype.ui.apply(this, arguments);
ui.heading = '.elementor-panel-heading';
return ui;
},
triggers: {
click: 'control:section:clicked'
}
});
module.exports = ControlSectionItemView;
/***/ }),
/***/ "../assets/dev/js/editor/controls/select.js":
/*!**************************************************!*\
!*** ../assets/dev/js/editor/controls/select.js ***!
\**************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var ControlBaseDataView = __webpack_require__(/*! elementor-controls/base-data */ "../assets/dev/js/editor/controls/base-data.js"),
ControlSelectItemView;
ControlSelectItemView = ControlBaseDataView.extend({
updatePlaceholder: function updatePlaceholder() {
var select = this.ui.select;
if (!select) {
return;
}
var selected = select.find('option:selected');
// When option with an empty value ('') selected, and it's not the placeholder option,
// set the selected option to the placeholder.
if ('' === selected.val() && !selected.hasClass('e-option-placeholder')) {
selected = select.find('.e-option-placeholder');
selected.prop('selected', true);
}
if (selected.hasClass('e-option-placeholder')) {
select.addClass('e-select-placeholder');
} else {
select.removeClass('e-select-placeholder');
}
},
onReady: function onReady() {
var placeholder = this.getControlPlaceholder();
if (placeholder) {
jQuery('