| @@ -376,9 +376,13 @@ | ||
| 376 | 376 | value: function dispatchEvent(eventName, payload) { |
| 377 | 377 | if (!this.isEventsManagerAvailable() || !this.canSendEvents()) { |
| 378 | 378 | return false; |
| 379 | 379 | } |
| 380 | - this.getEventsManager().dispatchEvent(eventName, payload); | |
| 380 | + try { | |
| 381 | + return this.getEventsManager().dispatchEvent(eventName, payload); | |
| 382 | + } catch (error) { | |
| 383 | + return false; | |
| 384 | + } | |
| 381 | 385 | } |
| 382 | 386 | }, { |
| 383 | 387 | key: "toLowerSnake", |
| 384 | 388 | value: function toLowerSnake(value) { |
| @@ -679,62 +683,8 @@ | ||
| 679 | 683 | }; |
| 680 | 684 | } |
| 681 | 685 | return this.dispatchEvent(config === null || config === void 0 || (_config$names1 = config.names) === null || _config$names1 === void 0 || (_config$names1 = _config$names1.editorOne) === null || _config$names1 === void 0 ? void 0 : _config$names1.widgetPanelSearch, payload); |
| 682 | 686 | } |
| 683 | - }, { | |
| 684 | - key: "createWpDashPayload", | |
| 685 | - value: function createWpDashPayload() { | |
| 686 | - var _config$appTypes$wpDa, _config$appTypes5, _config$locations11; | |
| 687 | - var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 688 | - var config = this.getConfig(); | |
| 689 | - return this.createBasePayload(_objectSpread({ | |
| 690 | - window_name: (_config$appTypes$wpDa = config === null || config === void 0 || (_config$appTypes5 = config.appTypes) === null || _config$appTypes5 === void 0 ? void 0 : _config$appTypes5.wpDash) !== null && _config$appTypes$wpDa !== void 0 ? _config$appTypes$wpDa : 'wpdash', | |
| 691 | - target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations11 = config.locations) === null || _config$locations11 === void 0 ? void 0 : _config$locations11.wpDashAdmin), | |
| 692 | - location_l2: '' | |
| 693 | - }, overrides)); | |
| 694 | - } | |
| 695 | - }, { | |
| 696 | - key: "sendWpDashElementorMenuClick", | |
| 697 | - value: function sendWpDashElementorMenuClick() { | |
| 698 | - var _config$names10, _config$triggers10, _config$targetTypes11, _config$interactionRe13, _config$secondaryLoca11; | |
| 699 | - var config = this.getConfig(); | |
| 700 | - return this.dispatchEvent(config === null || config === void 0 || (_config$names10 = config.names) === null || _config$names10 === void 0 || (_config$names10 = _config$names10.editorOne) === null || _config$names10 === void 0 ? void 0 : _config$names10.wpDashElementorMenuClick, this.createWpDashPayload({ | |
| 701 | - interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers10 = config.triggers) === null || _config$triggers10 === void 0 ? void 0 : _config$triggers10.click), | |
| 702 | - target_type: config === null || config === void 0 || (_config$targetTypes11 = config.targetTypes) === null || _config$targetTypes11 === void 0 ? void 0 : _config$targetTypes11.wpDashAdminMenuItem, | |
| 703 | - target_name: 'elementor_menu_item', | |
| 704 | - interaction_result: config === null || config === void 0 || (_config$interactionRe13 = config.interactionResults) === null || _config$interactionRe13 === void 0 ? void 0 : _config$interactionRe13.elementorSideMenuOpened, | |
| 705 | - location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca11 = config.secondaryLocations) === null || _config$secondaryLoca11 === void 0 ? void 0 : _config$secondaryLoca11.wpDashElementorCoreMenu), | |
| 706 | - interaction_description: 'core_user_clicked_elementor_menu_item' | |
| 707 | - })); | |
| 708 | - } | |
| 709 | - }, { | |
| 710 | - key: "sendWpDashEditorSubMenuHover", | |
| 711 | - value: function sendWpDashEditorSubMenuHover() { | |
| 712 | - var _config$names11, _config$triggers11, _config$targetTypes12, _config$interactionRe14, _config$secondaryLoca12; | |
| 713 | - var config = this.getConfig(); | |
| 714 | - return this.dispatchEvent(config === null || config === void 0 || (_config$names11 = config.names) === null || _config$names11 === void 0 || (_config$names11 = _config$names11.editorOne) === null || _config$names11 === void 0 ? void 0 : _config$names11.wpDashEditorSubMenuHover, this.createWpDashPayload({ | |
| 715 | - interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers11 = config.triggers) === null || _config$triggers11 === void 0 ? void 0 : _config$triggers11.hover), | |
| 716 | - target_type: config === null || config === void 0 || (_config$targetTypes12 = config.targetTypes) === null || _config$targetTypes12 === void 0 ? void 0 : _config$targetTypes12.wpDashEditorMenu, | |
| 717 | - target_name: 'wpdash_editor_sub_menu', | |
| 718 | - interaction_result: config === null || config === void 0 || (_config$interactionRe14 = config.interactionResults) === null || _config$interactionRe14 === void 0 ? void 0 : _config$interactionRe14.editorSubMenuOpened, | |
| 719 | - location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca12 = config.secondaryLocations) === null || _config$secondaryLoca12 === void 0 ? void 0 : _config$secondaryLoca12.wpDashElementorCoreSubMenu), | |
| 720 | - interaction_description: 'core_user_hovered_sub_menu' | |
| 721 | - })); | |
| 722 | - } | |
| 723 | - }, { | |
| 724 | - key: "sendWpDashThemeBuilderClick", | |
| 725 | - value: function sendWpDashThemeBuilderClick() { | |
| 726 | - var _config$names12, _config$triggers12, _config$targetTypes13, _config$interactionRe15, _config$secondaryLoca13; | |
| 727 | - var config = this.getConfig(); | |
| 728 | - return this.dispatchEvent(config === null || config === void 0 || (_config$names12 = config.names) === null || _config$names12 === void 0 || (_config$names12 = _config$names12.editorOne) === null || _config$names12 === void 0 ? void 0 : _config$names12.wpDashThemeBuilderClick, this.createWpDashPayload({ | |
| 729 | - interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers12 = config.triggers) === null || _config$triggers12 === void 0 ? void 0 : _config$triggers12.click), | |
| 730 | - target_type: config === null || config === void 0 || (_config$targetTypes13 = config.targetTypes) === null || _config$targetTypes13 === void 0 ? void 0 : _config$targetTypes13.wpDashSubMenuItem, | |
| 731 | - target_name: 'theme_builder_menu_item', | |
| 732 | - interaction_result: config === null || config === void 0 || (_config$interactionRe15 = config.interactionResults) === null || _config$interactionRe15 === void 0 ? void 0 : _config$interactionRe15.themeBuilderPromotionWindow, | |
| 733 | - location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca13 = config.secondaryLocations) === null || _config$secondaryLoca13 === void 0 ? void 0 : _config$secondaryLoca13.wpDashThemeBuilder), | |
| 734 | - interaction_description: 'core_user_clicked_theme_builder_menu_item' | |
| 735 | - })); | |
| 736 | - } | |
| 737 | 687 | }]); |
| 738 | 688 | }(); |
| 739 | 689 | var createDebouncedFinderSearch = exports.createDebouncedFinderSearch = function createDebouncedFinderSearch() { |
| 740 | 690 | var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 300; |
| @@ -877,14 +827,10 @@ | ||
| 877 | 827 | } |
| 878 | 828 | }, { |
| 879 | 829 | key: "initialize", |
| 880 | 830 | value: function initialize(attributes, options) { |
| 881 | - var _this$config; | |
| 882 | 831 | var elementType = this.get('elType'); |
| 883 | 832 | this.config = elementor.config.elements[elementType]; |
| 884 | - if ((_this$config = this.config) !== null && _this$config !== void 0 && (_this$config = _this$config.meta) !== null && _this$config !== void 0 && _this$config.permanently_locked) { | |
| 885 | - this.set('isLocked', true); | |
| 886 | - } | |
| 887 | 833 | var isNewElementCreate = 0 === this.get('elements').length && $e.commands.currentTrace.includes('document/elements/create'); |
| 888 | 834 | if (isNewElementCreate) { |
| 889 | 835 | this.onElementCreate(); |
| 890 | 836 | } |
| @@ -899,14 +845,8 @@ | ||
| 899 | 845 | }, { |
| 900 | 846 | key: "onElementCreate", |
| 901 | 847 | value: function onElementCreate() { |
| 902 | 848 | var _this = this; |
| 903 | - if (this.get('skipDefaultChildren')) { | |
| 904 | - this.unset('skipDefaultChildren', { | |
| 905 | - silent: true | |
| 906 | - }); | |
| 907 | - return; | |
| 908 | - } | |
| 909 | 849 | this.set('elements', this.getDefaultChildren().map(function (element) { |
| 910 | 850 | return _this.buildElement(element); |
| 911 | 851 | })); |
| 912 | 852 | } |
| @@ -930,10 +870,9 @@ | ||
| 930 | 870 | id: id, |
| 931 | 871 | settings: (_element$settings = element.settings) !== null && _element$settings !== void 0 ? _element$settings : {}, |
| 932 | 872 | elements: elements, |
| 933 | 873 | isLocked: element.isLocked || false, |
| 934 | - editor_settings: element.editor_settings || {}, | |
| 935 | - meta: element.meta || {} | |
| 874 | + editor_settings: element.editor_settings || {} | |
| 936 | 875 | }; |
| 937 | 876 | } |
| 938 | 877 | }]); |
| 939 | 878 | }(elementor.modules.elements.models.Element); |
| @@ -1041,29 +980,8 @@ | ||
| 1041 | 980 | var _default = exports["default"] = createFlexboxType; |
| 1042 | 981 | |
| 1043 | 982 | /***/ }), |
| 1044 | 983 | |
| 1045 | -/***/ "../modules/atomic-widgets/assets/js/editor/atomic-element-types/create-grid-type.js": | |
| 1046 | -/*!*******************************************************************************************!*\ | |
| 1047 | - !*** ../modules/atomic-widgets/assets/js/editor/atomic-element-types/create-grid-type.js ***! | |
| 1048 | - \*******************************************************************************************/ | |
| 1049 | -/***/ ((__unused_webpack_module, exports) => { | |
| 1050 | - | |
| 1051 | -"use strict"; | |
| 1052 | - | |
| 1053 | - | |
| 1054 | -Object.defineProperty(exports, "__esModule", ({ | |
| 1055 | - value: true | |
| 1056 | -})); | |
| 1057 | -exports["default"] = void 0; | |
| 1058 | -var createGridType = function createGridType() { | |
| 1059 | - var GridView = elementor.modules.elements.views.createAtomicElementBase('e-grid'); | |
| 1060 | - return new elementor.modules.elements.types.AtomicElementBase('e-grid', GridView); | |
| 1061 | -}; | |
| 1062 | -var _default = exports["default"] = createGridType; | |
| 1063 | - | |
| 1064 | -/***/ }), | |
| 1065 | - | |
| 1066 | 984 | /***/ "../modules/atomic-widgets/assets/js/editor/component.js": |
| 1067 | 985 | /*!***************************************************************!*\ |
| 1068 | 986 | !*** ../modules/atomic-widgets/assets/js/editor/component.js ***! |
| 1069 | 987 | \***************************************************************/ |
| @@ -1198,26 +1116,38 @@ | ||
| 1198 | 1116 | value: true |
| 1199 | 1117 | })); |
| 1200 | 1118 | exports["default"] = createAtomicElementBaseView; |
| 1201 | 1119 | var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "../node_modules/@babel/runtime/regenerator/index.js")); |
| 1120 | +var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js")); | |
| 1202 | 1121 | var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "../node_modules/@babel/runtime/helpers/asyncToGenerator.js")); |
| 1122 | +var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js")); | |
| 1203 | 1123 | var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js")); |
| 1204 | 1124 | var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js")); |
| 1205 | 1125 | var _elementTypes = __webpack_require__(/*! elementor-editor/utils/element-types */ "../assets/dev/js/editor/utils/element-types.js"); |
| 1206 | 1126 | var _atomicElementEmptyView = _interopRequireDefault(__webpack_require__(/*! ./container/atomic-element-empty-view */ "../modules/atomic-widgets/assets/js/editor/container/atomic-element-empty-view.js")); |
| 1127 | +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | |
| 1128 | +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } | |
| 1207 | 1129 | var BaseElementView = elementor.modules.elements.views.BaseElement; |
| 1208 | 1130 | function createAtomicElementBaseView(type) { |
| 1131 | + var resolvedTagCache = new WeakMap(); | |
| 1209 | 1132 | var AtomicElementView = BaseElementView.extend({ |
| 1210 | 1133 | template: Marionette.TemplateCache.get("#tmpl-elementor-".concat(type, "-content")), |
| 1211 | 1134 | emptyView: _atomicElementEmptyView.default, |
| 1212 | 1135 | _childrenRenderPromises: [], |
| 1213 | - _createElement: function _createElement(tag) { | |
| 1214 | - var _elementor$$preview; | |
| 1215 | - var previewDocument = (_elementor$$preview = elementor.$preview) === null || _elementor$$preview === void 0 || (_elementor$$preview = _elementor$$preview[0]) === null || _elementor$$preview === void 0 ? void 0 : _elementor$$preview.contentDocument; | |
| 1216 | - if (previewDocument) { | |
| 1217 | - return previewDocument.createElement(tag); | |
| 1136 | + tagName: function tagName() { | |
| 1137 | + var _resolvedTagCache$get; | |
| 1138 | + return (_resolvedTagCache$get = resolvedTagCache.get(this.model)) !== null && _resolvedTagCache$get !== void 0 ? _resolvedTagCache$get : this._resolveTag(); | |
| 1139 | + }, | |
| 1140 | + _resolveTag: function _resolveTag() { | |
| 1141 | + var _this$getResolverRend, _resolvedTag$value; | |
| 1142 | + var renderContext = (_this$getResolverRend = this.getResolverRenderContext) === null || _this$getResolverRend === void 0 ? void 0 : _this$getResolverRend.call(this); | |
| 1143 | + var tagSetting = this.model.getSetting('tag'); | |
| 1144 | + var resolvedTag = this._resolvePropValue(tagSetting, renderContext); | |
| 1145 | + var tagValue = (_resolvedTag$value = resolvedTag === null || resolvedTag === void 0 ? void 0 : resolvedTag.value) !== null && _resolvedTag$value !== void 0 ? _resolvedTag$value : resolvedTag; | |
| 1146 | + if (this._hasLink(renderContext)) { | |
| 1147 | + return 'a'; | |
| 1218 | 1148 | } |
| 1219 | - return document.createElement(tag); | |
| 1149 | + return tagValue || this.model.config.default_html_tag || 'div'; | |
| 1220 | 1150 | }, |
| 1221 | 1151 | getChildViewContainer: function getChildViewContainer() { |
| 1222 | 1152 | this.childViewContainer = ''; |
| 1223 | 1153 | return Marionette.CompositeView.prototype.getChildViewContainer.apply(this, arguments); |
| @@ -1241,16 +1171,157 @@ | ||
| 1241 | 1171 | getResolverRenderContext: function getResolverRenderContext() { |
| 1242 | 1172 | var _this$_parent2, _this$_parent2$getRes; |
| 1243 | 1173 | return (_this$_parent2 = this._parent) === null || _this$_parent2 === void 0 || (_this$_parent2$getRes = _this$_parent2.getResolverRenderContext) === null || _this$_parent2$getRes === void 0 ? void 0 : _this$_parent2$getRes.call(_this$_parent2); |
| 1244 | 1174 | }, |
| 1175 | + className: function className() { | |
| 1176 | + var generatedClasses = this.getGeneratedClasses(); | |
| 1177 | + return "".concat(BaseElementView.prototype.className.apply(this), " e-con e-atomic-element ").concat(this.getClassString(), " ").concat(generatedClasses); | |
| 1178 | + }, | |
| 1179 | + getGeneratedClasses: function getGeneratedClasses() { | |
| 1180 | + var _this = this; | |
| 1181 | + var propsSchema = this.model.config.atomic_props_schema || {}; | |
| 1182 | + var generatedClasses = []; | |
| 1183 | + Object.keys(propsSchema).forEach(function (key) { | |
| 1184 | + var _propsSchema$key; | |
| 1185 | + var propMeta = (_propsSchema$key = propsSchema[key]) === null || _propsSchema$key === void 0 ? void 0 : _propsSchema$key.meta; | |
| 1186 | + if (propMeta !== null && propMeta !== void 0 && propMeta.generates_class) { | |
| 1187 | + var _settingValue$value; | |
| 1188 | + var classPattern = propMeta.generates_class; | |
| 1189 | + var settingValue = _this.model.getSetting(key); | |
| 1190 | + var value = (_settingValue$value = settingValue === null || settingValue === void 0 ? void 0 : settingValue.value) !== null && _settingValue$value !== void 0 ? _settingValue$value : settingValue; | |
| 1191 | + if (value && 'string' === typeof value) { | |
| 1192 | + var className = classPattern.replace('{value}', value); | |
| 1193 | + generatedClasses.push(className); | |
| 1194 | + } | |
| 1195 | + } | |
| 1196 | + }); | |
| 1197 | + return generatedClasses.join(' '); | |
| 1198 | + }, | |
| 1199 | + // TODO: Copied from `views/column.js`. | |
| 1200 | + ui: function ui() { | |
| 1201 | + var ui = BaseElementView.prototype.ui.apply(this, arguments); | |
| 1202 | + ui.percentsTooltip = '> .elementor-element-overlay .elementor-column-percents-tooltip'; | |
| 1203 | + return ui; | |
| 1204 | + }, | |
| 1205 | + attributes: function attributes() { | |
| 1206 | + var _this$model$getSettin, _this$model$getSettin2, _this$model$config$in, _this$model; | |
| 1207 | + var attr = BaseElementView.prototype.attributes.apply(this); | |
| 1208 | + var local = {}; | |
| 1209 | + var cssId = this.model.getSetting('_cssid'); | |
| 1210 | + var customAttributes = (_this$model$getSettin = (_this$model$getSettin2 = this.model.getSetting('attributes')) === null || _this$model$getSettin2 === void 0 ? void 0 : _this$model$getSettin2.value) !== null && _this$model$getSettin !== void 0 ? _this$model$getSettin : []; | |
| 1211 | + var initialAttributes = (_this$model$config$in = this === null || this === void 0 || (_this$model = this.model) === null || _this$model === void 0 || (_this$model = _this$model.config) === null || _this$model === void 0 ? void 0 : _this$model.initial_attributes) !== null && _this$model$config$in !== void 0 ? _this$model$config$in : {}; | |
| 1212 | + if (cssId) { | |
| 1213 | + local.id = cssId.value; | |
| 1214 | + } | |
| 1215 | + local['data-interaction-id'] = this.getInteractionId(); | |
| 1216 | + customAttributes.forEach(function (attribute) { | |
| 1217 | + var _attribute$value, _attribute$value2; | |
| 1218 | + var key = (_attribute$value = attribute.value) === null || _attribute$value === void 0 || (_attribute$value = _attribute$value.key) === null || _attribute$value === void 0 ? void 0 : _attribute$value.value; | |
| 1219 | + var value = (_attribute$value2 = attribute.value) === null || _attribute$value2 === void 0 || (_attribute$value2 = _attribute$value2.value) === null || _attribute$value2 === void 0 ? void 0 : _attribute$value2.value; | |
| 1220 | + if (key && value) { | |
| 1221 | + local[key] = value; | |
| 1222 | + } | |
| 1223 | + }); | |
| 1224 | + return _objectSpread(_objectSpread(_objectSpread({}, attr), initialAttributes), local); | |
| 1225 | + }, | |
| 1226 | + // TODO: Copied from `views/column.js`. | |
| 1227 | + attachElContent: function attachElContent() { | |
| 1228 | + BaseElementView.prototype.attachElContent.apply(this, arguments); | |
| 1229 | + var $tooltip = jQuery('<div>', { | |
| 1230 | + class: 'elementor-column-percents-tooltip', | |
| 1231 | + 'data-side': elementorCommon.config.isRTL ? 'right' : 'left' | |
| 1232 | + }); | |
| 1233 | + this.$el.children('.elementor-element-overlay').append($tooltip); | |
| 1234 | + }, | |
| 1235 | + // TODO: Copied from `views/column.js`. | |
| 1236 | + getPercentSize: function getPercentSize(size) { | |
| 1237 | + if (!size) { | |
| 1238 | + size = this.el.getBoundingClientRect().width; | |
| 1239 | + } | |
| 1240 | + return +(size / this.$el.parent().width() * 100).toFixed(3); | |
| 1241 | + }, | |
| 1242 | + // TODO: Copied from `views/column.js`. | |
| 1243 | + getPercentsForDisplay: function getPercentsForDisplay() { | |
| 1244 | + var width = +this.model.getSetting('width') || this.getPercentSize(); | |
| 1245 | + return width.toFixed(1) + '%'; | |
| 1246 | + }, | |
| 1247 | + renderOnChange: function renderOnChange(settings) { | |
| 1248 | + var _this2 = this; | |
| 1249 | + var changed = settings.changedAttributes(); | |
| 1250 | + setTimeout(function () { | |
| 1251 | + _this2.updateHandlesPosition(); | |
| 1252 | + }); | |
| 1253 | + if (!changed) { | |
| 1254 | + return; | |
| 1255 | + } | |
| 1256 | + BaseElementView.prototype.renderOnChange.apply(this, settings); | |
| 1257 | + if (changed.attributes) { | |
| 1258 | + var $elAttrs = this.$el[0].attributes; | |
| 1259 | + for (var i = $elAttrs.length - 1; i >= 0; i--) { | |
| 1260 | + var attrName = $elAttrs[i].name; | |
| 1261 | + if (attrName !== 'class') { | |
| 1262 | + this.$el.removeAttr(attrName); | |
| 1263 | + } | |
| 1264 | + } | |
| 1265 | + var newAttrs = this.attributes(); | |
| 1266 | + Object.entries(newAttrs).forEach(function (_ref5) { | |
| 1267 | + var _ref6 = (0, _slicedToArray2.default)(_ref5, 2), | |
| 1268 | + key = _ref6[0], | |
| 1269 | + value = _ref6[1]; | |
| 1270 | + if (key !== 'class' && value !== undefined) { | |
| 1271 | + _this2.$el.attr(key, value); | |
| 1272 | + } | |
| 1273 | + }); | |
| 1274 | + return; | |
| 1275 | + } | |
| 1276 | + | |
| 1277 | + // Check if classes changed OR if any setting with generates_class metadata changed | |
| 1278 | + var propsSchema = this.model.config.atomic_props_schema || {}; | |
| 1279 | + var hasGeneratesClassChange = Object.keys(changed).some(function (key) { | |
| 1280 | + var _propsSchema$key2; | |
| 1281 | + return (_propsSchema$key2 = propsSchema[key]) === null || _propsSchema$key2 === void 0 || (_propsSchema$key2 = _propsSchema$key2.meta) === null || _propsSchema$key2 === void 0 ? void 0 : _propsSchema$key2.generates_class; | |
| 1282 | + }); | |
| 1283 | + if (changed.classes || hasGeneratesClassChange) { | |
| 1284 | + // Preserve runtime state classes (e.g., e--selected) that are managed by Alpine | |
| 1285 | + // and would be lost when replacing the class attribute. | |
| 1286 | + var preservedClasses = Array.from(this.$el[0].classList).filter(function (cls) { | |
| 1287 | + return cls.startsWith('e--'); | |
| 1288 | + }); | |
| 1289 | + this.$el.attr('class', this.className()); | |
| 1290 | + preservedClasses.forEach(function (cls) { | |
| 1291 | + return _this2.$el[0].classList.add(cls); | |
| 1292 | + }); | |
| 1293 | + return; | |
| 1294 | + } | |
| 1295 | + if (changed._cssid) { | |
| 1296 | + if (changed._cssid.value) { | |
| 1297 | + this.$el.attr('id', changed._cssid.value); | |
| 1298 | + } else { | |
| 1299 | + this.$el.removeAttr('id'); | |
| 1300 | + } | |
| 1301 | + return; | |
| 1302 | + } | |
| 1303 | + this.$el.addClass(this.getClasses()); | |
| 1304 | + if (this.isTagChanged(changed)) { | |
| 1305 | + this.rerenderEntireView(); | |
| 1306 | + } | |
| 1307 | + }, | |
| 1308 | + isTagChanged: function isTagChanged(changed) { | |
| 1309 | + return ((changed === null || changed === void 0 ? void 0 : changed.tag) !== undefined || (changed === null || changed === void 0 ? void 0 : changed.link) !== undefined) && this._parent && this.tagName() !== this.el.tagName; | |
| 1310 | + }, | |
| 1311 | + rerenderEntireView: function rerenderEntireView() { | |
| 1312 | + var parent = this._parent; | |
| 1313 | + this._parent.removeChildView(this); | |
| 1314 | + parent.addChild(this.model, AtomicElementView, this._index); | |
| 1315 | + }, | |
| 1245 | 1316 | render: function render() { |
| 1246 | - var _this = this; | |
| 1317 | + var _this3 = this; | |
| 1247 | 1318 | this._currentRenderPromise = new Promise(function (resolve) { |
| 1248 | 1319 | // Optimize rendering by reusing existing child views instead of recreating them. |
| 1249 | - if (_this._shouldSkipFullRender()) { | |
| 1250 | - _this._renderWithoutDomRecreation(resolve); | |
| 1320 | + if (_this3._shouldSkipFullRender()) { | |
| 1321 | + _this3._renderWithoutDomRecreation(resolve); | |
| 1251 | 1322 | } else { |
| 1252 | - _this._renderWithDomRecreation(resolve); | |
| 1323 | + _this3._renderWithDomRecreation(resolve); | |
| 1253 | 1324 | } |
| 1254 | 1325 | }); |
| 1255 | 1326 | return this; |
| 1256 | 1327 | }, |
| @@ -1267,43 +1338,80 @@ | ||
| 1267 | 1338 | var firstChild = this.children.findByIndex(0); |
| 1268 | 1339 | return (_firstChild$$el$get$i = firstChild === null || firstChild === void 0 || (_firstChild$$el = firstChild.$el) === null || _firstChild$$el === void 0 || (_firstChild$$el = _firstChild$$el.get(0)) === null || _firstChild$$el === void 0 ? void 0 : _firstChild$$el.isConnected) !== null && _firstChild$$el$get$i !== void 0 ? _firstChild$$el$get$i : false; |
| 1269 | 1340 | }, |
| 1270 | 1341 | _renderWithoutDomRecreation: function _renderWithoutDomRecreation(resolve) { |
| 1271 | - var _this2 = this; | |
| 1342 | + var _this4 = this; | |
| 1272 | 1343 | this._beforeRender(); |
| 1273 | 1344 | this._renderChildren(); |
| 1274 | 1345 | this._waitForChildrenToComplete().then(function () { |
| 1275 | - _this2._afterRender(); | |
| 1346 | + _this4._afterRender(); | |
| 1276 | 1347 | resolve(); |
| 1277 | 1348 | }); |
| 1278 | 1349 | }, |
| 1279 | 1350 | _renderWithDomRecreation: function _renderWithDomRecreation(resolve) { |
| 1351 | + var _this5 = this; | |
| 1280 | 1352 | BaseElementView.prototype.render.apply(this, arguments); |
| 1281 | 1353 | this._waitForChildrenToComplete().then(function () { |
| 1354 | + _this5._applyResolvedAttributes(); | |
| 1282 | 1355 | resolve(); |
| 1283 | 1356 | }); |
| 1284 | 1357 | }, |
| 1285 | 1358 | _beforeRender: function _beforeRender() { |
| 1286 | 1359 | this._isRendering = true; |
| 1360 | + this._invalidateTagCache(); | |
| 1287 | 1361 | this.triggerMethod('before:render', this); |
| 1288 | 1362 | }, |
| 1363 | + _invalidateTagCache: function _invalidateTagCache() { | |
| 1364 | + resolvedTagCache.delete(this.model); | |
| 1365 | + }, | |
| 1366 | + _cacheResolvedTag: function _cacheResolvedTag(tag) { | |
| 1367 | + resolvedTagCache.set(this.model, tag); | |
| 1368 | + }, | |
| 1289 | 1369 | _afterRender: function _afterRender() { |
| 1290 | 1370 | this._isRendering = false; |
| 1291 | 1371 | this.isRendered = true; |
| 1292 | 1372 | this.triggerMethod('render', this); |
| 1373 | + this._applyResolvedAttributes(); | |
| 1293 | 1374 | }, |
| 1375 | + _applyResolvedAttributes: function _applyResolvedAttributes() { | |
| 1376 | + if (!this._parent) { | |
| 1377 | + return; | |
| 1378 | + } | |
| 1379 | + if (this._shouldRecreateForTagChange()) { | |
| 1380 | + return; | |
| 1381 | + } | |
| 1382 | + this._applyLinkAttributes(); | |
| 1383 | + }, | |
| 1384 | + _shouldRecreateForTagChange: function _shouldRecreateForTagChange() { | |
| 1385 | + var resolvedTag = this.tagName(); | |
| 1386 | + var currentTag = this.el.tagName.toLowerCase(); | |
| 1387 | + if (resolvedTag === currentTag) { | |
| 1388 | + return false; | |
| 1389 | + } | |
| 1390 | + this._cacheResolvedTag(resolvedTag); | |
| 1391 | + this.rerenderEntireView(); | |
| 1392 | + return true; | |
| 1393 | + }, | |
| 1394 | + _applyLinkAttributes: function _applyLinkAttributes() { | |
| 1395 | + this.$el.removeAttr('href'); | |
| 1396 | + this.$el.removeAttr('data-action-link'); | |
| 1397 | + var link = this.getLink(); | |
| 1398 | + if (link) { | |
| 1399 | + this.$el.attr(link.attr, link.value); | |
| 1400 | + } | |
| 1401 | + }, | |
| 1294 | 1402 | _waitForChildrenToComplete: function _waitForChildrenToComplete() { |
| 1295 | - var _this3 = this; | |
| 1403 | + var _this6 = this; | |
| 1296 | 1404 | return (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() { |
| 1297 | 1405 | return _regenerator.default.wrap(function (_context) { |
| 1298 | 1406 | while (1) switch (_context.prev = _context.next) { |
| 1299 | 1407 | case 0: |
| 1300 | - if (!(_this3._childrenRenderPromises.length > 0)) { | |
| 1408 | + if (!(_this6._childrenRenderPromises.length > 0)) { | |
| 1301 | 1409 | _context.next = 1; |
| 1302 | 1410 | break; |
| 1303 | 1411 | } |
| 1304 | 1412 | _context.next = 1; |
| 1305 | - return Promise.all(_this3._childrenRenderPromises); | |
| 1413 | + return Promise.all(_this6._childrenRenderPromises); | |
| 1306 | 1414 | case 1: |
| 1307 | 1415 | case "end": |
| 1308 | 1416 | return _context.stop(); |
| 1309 | 1417 | } |
| @@ -1322,47 +1430,27 @@ | ||
| 1322 | 1430 | this._collectChildrenRenderPromises(); |
| 1323 | 1431 | }, |
| 1324 | 1432 | _collectChildrenRenderPromises: function _collectChildrenRenderPromises() { |
| 1325 | 1433 | var _this$children3, |
| 1326 | - _this4 = this; | |
| 1434 | + _this7 = this; | |
| 1327 | 1435 | this._childrenRenderPromises = []; |
| 1328 | 1436 | (_this$children3 = this.children) === null || _this$children3 === void 0 || _this$children3.each(function (childView) { |
| 1329 | 1437 | if (childView._currentRenderPromise) { |
| 1330 | - _this4._childrenRenderPromises.push(childView._currentRenderPromise); | |
| 1438 | + _this7._childrenRenderPromises.push(childView._currentRenderPromise); | |
| 1331 | 1439 | } |
| 1332 | 1440 | }); |
| 1333 | 1441 | }, |
| 1334 | 1442 | onRender: function onRender() { |
| 1335 | - var _this5 = this; | |
| 1443 | + var _this8 = this; | |
| 1336 | 1444 | this.dispatchPreviewEvent('elementor/element/render'); |
| 1337 | 1445 | BaseElementView.prototype.onRender.apply(this, arguments); |
| 1338 | 1446 | |
| 1339 | 1447 | // Defer to wait for everything to render. |
| 1340 | 1448 | setTimeout(function () { |
| 1341 | - if (_this5.isAtomicGridContainer()) { | |
| 1342 | - _this5.reInitEmptyView(); | |
| 1343 | - } | |
| 1344 | - _this5.droppableInitialize(); | |
| 1345 | - _this5.updateHandlesPosition(); | |
| 1449 | + _this8.droppableInitialize(); | |
| 1450 | + _this8.updateHandlesPosition(); | |
| 1346 | 1451 | }); |
| 1347 | 1452 | }, |
| 1348 | - destroyEmptyView: function destroyEmptyView() { | |
| 1349 | - if (this.isAtomicGridContainer()) { | |
| 1350 | - return; | |
| 1351 | - } | |
| 1352 | - return Marionette.CompositeView.prototype.destroyEmptyView.apply(this, arguments); | |
| 1353 | - }, | |
| 1354 | - isAtomicGridContainer: function isAtomicGridContainer() { | |
| 1355 | - return 'e-grid' === type; | |
| 1356 | - }, | |
| 1357 | - reInitEmptyView: function reInitEmptyView() { | |
| 1358 | - var _this$el; | |
| 1359 | - if ((_this$el = this.el) !== null && _this$el !== void 0 && _this$el.querySelector(':scope > .elementor-empty-view')) { | |
| 1360 | - return; | |
| 1361 | - } | |
| 1362 | - delete this._showingEmptyView; | |
| 1363 | - this.showEmptyView(); | |
| 1364 | - }, | |
| 1365 | 1453 | onDestroy: function onDestroy() { |
| 1366 | 1454 | BaseElementView.prototype.onDestroy.apply(this, arguments); |
| 1367 | 1455 | this.dispatchPreviewEvent('elementor/element/destroy'); |
| 1368 | 1456 | }, |
| @@ -1375,8 +1463,50 @@ | ||
| 1375 | 1463 | element: this.getDomElement().get(0) |
| 1376 | 1464 | } |
| 1377 | 1465 | })); |
| 1378 | 1466 | }, |
| 1467 | + _hasLink: function _hasLink(renderContext) { | |
| 1468 | + var _resolvedLink$value; | |
| 1469 | + var linkSetting = this.model.getSetting('link'); | |
| 1470 | + var resolvedLink = this._resolvePropValue(linkSetting, renderContext); | |
| 1471 | + if ('link' !== (resolvedLink === null || resolvedLink === void 0 ? void 0 : resolvedLink.$$type)) { | |
| 1472 | + return false; | |
| 1473 | + } | |
| 1474 | + var destination = this._resolvePropValue((_resolvedLink$value = resolvedLink.value) === null || _resolvedLink$value === void 0 ? void 0 : _resolvedLink$value.destination, renderContext); | |
| 1475 | + return !!(destination !== null && destination !== void 0 && destination.value); | |
| 1476 | + }, | |
| 1477 | + getLink: function getLink() { | |
| 1478 | + var _this$getResolverRend2, _resolvedLink$value2; | |
| 1479 | + var renderContext = (_this$getResolverRend2 = this.getResolverRenderContext) === null || _this$getResolverRend2 === void 0 ? void 0 : _this$getResolverRend2.call(this); | |
| 1480 | + var linkSetting = this.model.getSetting('link'); | |
| 1481 | + var resolvedLink = this._resolvePropValue(linkSetting, renderContext); | |
| 1482 | + if ('link' !== (resolvedLink === null || resolvedLink === void 0 ? void 0 : resolvedLink.$$type)) { | |
| 1483 | + return null; | |
| 1484 | + } | |
| 1485 | + var destination = this._resolvePropValue((_resolvedLink$value2 = resolvedLink.value) === null || _resolvedLink$value2 === void 0 ? void 0 : _resolvedLink$value2.destination, renderContext); | |
| 1486 | + if (!(destination !== null && destination !== void 0 && destination.value)) { | |
| 1487 | + return null; | |
| 1488 | + } | |
| 1489 | + var $$type = destination.$$type, | |
| 1490 | + value = destination.value; | |
| 1491 | + if ('dynamic' === $$type) { | |
| 1492 | + var _value$settings; | |
| 1493 | + var resolvedValue = this.handleDynamicLink(value); | |
| 1494 | + if (!resolvedValue) { | |
| 1495 | + return null; | |
| 1496 | + } | |
| 1497 | + return { | |
| 1498 | + attr: 'action' === ((_value$settings = value.settings) === null || _value$settings === void 0 ? void 0 : _value$settings.group) ? 'data-action-link' : 'href', | |
| 1499 | + value: resolvedValue | |
| 1500 | + }; | |
| 1501 | + } | |
| 1502 | + var isPostId = 'number' === $$type; | |
| 1503 | + var hrefPrefix = isPostId ? elementor.config.home_url + '/?p=' : ''; | |
| 1504 | + return { | |
| 1505 | + attr: 'href', | |
| 1506 | + value: hrefPrefix + value | |
| 1507 | + }; | |
| 1508 | + }, | |
| 1379 | 1509 | droppableInitialize: function droppableInitialize() { |
| 1380 | 1510 | this.$el.html5Droppable(this.getDroppableOptions()); |
| 1381 | 1511 | }, |
| 1382 | 1512 | /** |
| @@ -1384,9 +1514,9 @@ | ||
| 1384 | 1514 | * |
| 1385 | 1515 | * @return {Object} groups |
| 1386 | 1516 | */ |
| 1387 | 1517 | getContextMenuGroups: function getContextMenuGroups() { |
| 1388 | - var _this6 = this, | |
| 1518 | + var _this9 = this, | |
| 1389 | 1519 | _elementorCommon$conf; |
| 1390 | 1520 | var saveActions = [{ |
| 1391 | 1521 | name: 'save', |
| 1392 | 1522 | title: __('Save as a template', 'elementor'), |
| @@ -1391,9 +1521,9 @@ | ||
| 1391 | 1521 | name: 'save', |
| 1392 | 1522 | title: __('Save as a template', 'elementor'), |
| 1393 | 1523 | callback: this.saveAsTemplate.bind(this), |
| 1394 | 1524 | isEnabled: function isEnabled() { |
| 1395 | - return !_this6.getContainer().isLocked(); | |
| 1525 | + return !_this9.getContainer().isLocked(); | |
| 1396 | 1526 | } |
| 1397 | 1527 | }]; |
| 1398 | 1528 | var isAdministrator = elementor.config.user.is_administrator; |
| 1399 | 1529 | var isExperimentalFeaturesEnabled = (_elementorCommon$conf = elementorCommon.config.experimentalFeatures) === null || _elementorCommon$conf === void 0 ? void 0 : _elementorCommon$conf.e_components; |
| @@ -1412,9 +1542,9 @@ | ||
| 1412 | 1542 | shortcut: isProActive || isProOutdated ? newBadge : proBadge, |
| 1413 | 1543 | hasShortcutAction: showPromoBadge, |
| 1414 | 1544 | callback: this.saveAsComponent.bind(this), |
| 1415 | 1545 | isEnabled: function isEnabled() { |
| 1416 | - return (isProActive || isProOutdated) && !_this6.getContainer().isLocked(); | |
| 1546 | + return (isProActive || isProOutdated) && !_this9.getContainer().isLocked(); | |
| 1417 | 1547 | } |
| 1418 | 1548 | }); |
| 1419 | 1549 | } |
| 1420 | 1550 | var groups = BaseElementView.prototype.getContextMenuGroups.apply(this, arguments), |
| @@ -1497,12 +1627,12 @@ | ||
| 1497 | 1627 | preventInit: true |
| 1498 | 1628 | }; |
| 1499 | 1629 | }, |
| 1500 | 1630 | getDroppableOptions: function getDroppableOptions() { |
| 1501 | - var _this7 = this; | |
| 1631 | + var _this0 = this; | |
| 1502 | 1632 | var items = '> .elementor-element, > .elementor-empty-view .elementor-first-add'; |
| 1503 | 1633 | return { |
| 1504 | - axis: this.isAtomicGridContainer() ? 'vertical' : null, | |
| 1634 | + axis: null, | |
| 1505 | 1635 | items: items, |
| 1506 | 1636 | groups: ['elementor-element'], |
| 1507 | 1637 | horizontalThreshold: 0, |
| 1508 | 1638 | isDroppingAllowed: this.isDroppingAllowed.bind(this), |
| @@ -1509,9 +1639,9 @@ | ||
| 1509 | 1639 | currentElementClass: 'elementor-html5dnd-current-element', |
| 1510 | 1640 | placeholderClass: 'elementor-sortable-placeholder elementor-widget-placeholder', |
| 1511 | 1641 | hasDraggingOnChildClass: 'e-dragging-over', |
| 1512 | 1642 | getDropContainer: function getDropContainer() { |
| 1513 | - return _this7.getContainer(); | |
| 1643 | + return _this0.getContainer(); | |
| 1514 | 1644 | }, |
| 1515 | 1645 | onDropping: function onDropping(side, event) { |
| 1516 | 1646 | event.stopPropagation(); |
| 1517 | 1647 | |
| @@ -1518,29 +1648,44 @@ | ||
| 1518 | 1648 | // Triggering the drag end manually, since it won't fire above the iframe |
| 1519 | 1649 | elementor.getPreviewView().onPanelElementDragEnd(); |
| 1520 | 1650 | var draggedView = elementor.channels.editor.request('element:dragged'), |
| 1521 | 1651 | draggedElement = draggedView === null || draggedView === void 0 ? void 0 : draggedView.getContainer().view.el, |
| 1522 | - isEmptyViewTarget = _this7.emptyViewIsCurrentlyBeingDraggedOver(), | |
| 1523 | - containerElement = isEmptyViewTarget ? _this7.el : event.currentTarget.parentElement, | |
| 1652 | + containerElement = event.currentTarget.parentElement, | |
| 1524 | 1653 | elements = Array.from((containerElement === null || containerElement === void 0 ? void 0 : containerElement.querySelectorAll(':scope > .elementor-element')) || []); |
| 1525 | - var targetIndex = isEmptyViewTarget ? elements.length : elements.indexOf(event.currentTarget); | |
| 1526 | - if (_this7.isPanelElement(draggedView, draggedElement)) { | |
| 1527 | - if (_this7.draggingOnBottomOrRightSide(side) && !isEmptyViewTarget) { | |
| 1654 | + var targetIndex = elements.indexOf(event.currentTarget); | |
| 1655 | + if (_this0.isPanelElement(draggedView, draggedElement)) { | |
| 1656 | + var _elementorCommon; | |
| 1657 | + if (_this0.draggingOnBottomOrRightSide(side) && !_this0.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1528 | 1658 | targetIndex++; |
| 1529 | 1659 | } |
| 1530 | - _this7.onDrop(event, { | |
| 1660 | + _this0.onDrop(event, { | |
| 1531 | 1661 | at: targetIndex |
| 1532 | 1662 | }); |
| 1663 | + if ((_elementorCommon = elementorCommon) !== null && _elementorCommon !== void 0 && (_elementorCommon = _elementorCommon.eventsManager) !== null && _elementorCommon !== void 0 && _elementorCommon.dispatchEvent) { | |
| 1664 | + var selectedElement = elementor.channels.panelElements.request('element:selected'); | |
| 1665 | + if (selectedElement) { | |
| 1666 | + var _selectedElement$mode, _selectedElement$mode2, _selectedElement$mode3, _selectedElement$mode4; | |
| 1667 | + var elType = (_selectedElement$mode = (_selectedElement$mode2 = selectedElement.model) === null || _selectedElement$mode2 === void 0 ? void 0 : _selectedElement$mode2.get('elType')) !== null && _selectedElement$mode !== void 0 ? _selectedElement$mode : ''; | |
| 1668 | + var widgetType = (_selectedElement$mode3 = (_selectedElement$mode4 = selectedElement.model) === null || _selectedElement$mode4 === void 0 ? void 0 : _selectedElement$mode4.get('widgetType')) !== null && _selectedElement$mode3 !== void 0 ? _selectedElement$mode3 : ''; | |
| 1669 | + var elementName = 'widget' === elType ? widgetType : elType; | |
| 1670 | + elementorCommon.eventsManager.dispatchEvent('add_element', { | |
| 1671 | + location: 'editor_panel', | |
| 1672 | + element_name: elementName, | |
| 1673 | + element_type: elType, | |
| 1674 | + widget_type: widgetType | |
| 1675 | + }); | |
| 1676 | + } | |
| 1677 | + } | |
| 1533 | 1678 | return; |
| 1534 | 1679 | } |
| 1535 | - if (_this7.isParentElement(draggedView.getContainer().id)) { | |
| 1680 | + if (_this0.isParentElement(draggedView.getContainer().id)) { | |
| 1536 | 1681 | return; |
| 1537 | 1682 | } |
| 1538 | - if (isEmptyViewTarget) { | |
| 1539 | - _this7.moveDroppedItem(draggedView, targetIndex); | |
| 1683 | + if (_this0.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1684 | + _this0.moveDroppedItem(draggedView, 0); | |
| 1540 | 1685 | return; |
| 1541 | 1686 | } |
| 1542 | - _this7.moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement); | |
| 1687 | + _this0.moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement); | |
| 1543 | 1688 | } |
| 1544 | 1689 | }; |
| 1545 | 1690 | }, |
| 1546 | 1691 | moveExistingElement: function moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement) { |
| @@ -1658,8 +1803,26 @@ | ||
| 1658 | 1803 | }); |
| 1659 | 1804 | }); |
| 1660 | 1805 | this.addSectionView = addSectionView; |
| 1661 | 1806 | }, |
| 1807 | + getClasses: function getClasses() { | |
| 1808 | + var _window, _window$get, _this$options; | |
| 1809 | + var transformer = (_window = window) === null || _window === void 0 || (_window = _window.elementorV2) === null || _window === void 0 || (_window = _window.editorCanvas) === null || _window === void 0 || (_window = _window.settingsTransformersRegistry) === null || _window === void 0 || (_window$get = _window.get) === null || _window$get === void 0 ? void 0 : _window$get.call(_window, 'classes'); | |
| 1810 | + if (!transformer) { | |
| 1811 | + return []; | |
| 1812 | + } | |
| 1813 | + return transformer(((_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.model) === null || _this$options === void 0 || (_this$options = _this$options.getSetting('classes')) === null || _this$options === void 0 ? void 0 : _this$options.value) || []); | |
| 1814 | + }, | |
| 1815 | + getClassString: function getClassString() { | |
| 1816 | + var classes = this.getClasses(); | |
| 1817 | + var base = this.getBaseClass(); | |
| 1818 | + return [base].concat((0, _toConsumableArray2.default)(classes)).join(' '); | |
| 1819 | + }, | |
| 1820 | + getBaseClass: function getBaseClass() { | |
| 1821 | + var _this$options2, _Object$keys$; | |
| 1822 | + var baseStyles = elementor.helpers.getAtomicWidgetBaseStyles((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.model); | |
| 1823 | + return (_Object$keys$ = Object.keys(baseStyles !== null && baseStyles !== void 0 ? baseStyles : {})[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : ''; | |
| 1824 | + }, | |
| 1662 | 1825 | isOverflowHidden: function isOverflowHidden() { |
| 1663 | 1826 | var elementStyles = window.getComputedStyle(this.el); |
| 1664 | 1827 | var overflowStyles = [elementStyles.overflowX, elementStyles.overflowY, elementStyles.overflow]; |
| 1665 | 1828 | return overflowStyles.includes('hidden') || overflowStyles.includes('auto'); |
| @@ -1684,8 +1847,75 @@ | ||
| 1684 | 1847 | return true; |
| 1685 | 1848 | } |
| 1686 | 1849 | return 0 === this.model.collection.indexOf(this.model); |
| 1687 | 1850 | }, |
| 1851 | + getDynamicLinkValue: function getDynamicLinkValue(name, settings) { | |
| 1852 | + var simpleTransform = function simpleTransform(props) { | |
| 1853 | + var transformed = Object.entries(props).map(function (_ref7) { | |
| 1854 | + var _ref8 = (0, _slicedToArray2.default)(_ref7, 2), | |
| 1855 | + settingKey = _ref8[0], | |
| 1856 | + settingValue = _ref8[1]; | |
| 1857 | + var value = 'object' === (0, _typeof2.default)(settingValue) && 'value' in settingValue ? settingValue.value : settingValue; | |
| 1858 | + return [settingKey, value]; | |
| 1859 | + }); | |
| 1860 | + return Object.fromEntries(transformed); | |
| 1861 | + }; | |
| 1862 | + var getTagValue = function getTagValue() { | |
| 1863 | + var _elementor$dynamicTag; | |
| 1864 | + var tag = elementor.dynamicTags.createTag('v4-dynamic-tag', name, simpleTransform(settings)); | |
| 1865 | + if (!tag) { | |
| 1866 | + return null; | |
| 1867 | + } | |
| 1868 | + return (_elementor$dynamicTag = elementor.dynamicTags.loadTagDataFromCache(tag)) !== null && _elementor$dynamicTag !== void 0 ? _elementor$dynamicTag : null; | |
| 1869 | + }; | |
| 1870 | + var tagValue = getTagValue(); | |
| 1871 | + if (tagValue !== null) { | |
| 1872 | + return tagValue; | |
| 1873 | + } | |
| 1874 | + return new Promise(function (resolve) { | |
| 1875 | + elementor.dynamicTags.refreshCacheFromServer(function () { | |
| 1876 | + resolve(getTagValue()); | |
| 1877 | + }); | |
| 1878 | + }); | |
| 1879 | + }, | |
| 1880 | + handleDynamicLink: function handleDynamicLink(linkValue) { | |
| 1881 | + var _this1 = this; | |
| 1882 | + var result = this.getDynamicLinkValue(linkValue.name, linkValue.settings); | |
| 1883 | + if (!result) { | |
| 1884 | + return null; | |
| 1885 | + } | |
| 1886 | + if ('string' === typeof result) { | |
| 1887 | + return result; | |
| 1888 | + } | |
| 1889 | + result.then(function (href) { | |
| 1890 | + _this1.el.removeAttribute('href'); | |
| 1891 | + var attribute = 'action' === linkValue.group ? 'data-action-link' : 'href'; | |
| 1892 | + _this1.el.setAttribute(attribute, href); | |
| 1893 | + }).then(function () { | |
| 1894 | + return _this1.dispatchPreviewEvent('elementor/element/render'); | |
| 1895 | + }); | |
| 1896 | + return null; | |
| 1897 | + }, | |
| 1898 | + _resolvePropValue: function _resolvePropValue(prop, renderContext) { | |
| 1899 | + var _window2, _registry$get; | |
| 1900 | + if (!prop || (0, _typeof2.default)(prop) !== 'object') { | |
| 1901 | + return prop; | |
| 1902 | + } | |
| 1903 | + if ('overridable' !== prop.$$type) { | |
| 1904 | + return prop; | |
| 1905 | + } | |
| 1906 | + var registry = (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.elementorV2) === null || _window2 === void 0 || (_window2 = _window2.editorCanvas) === null || _window2 === void 0 ? void 0 : _window2.settingsTransformersRegistry; | |
| 1907 | + var transformer = registry === null || registry === void 0 || (_registry$get = registry.get) === null || _registry$get === void 0 ? void 0 : _registry$get.call(registry, 'overridable'); | |
| 1908 | + if (!transformer) { | |
| 1909 | + var _prop$value; | |
| 1910 | + return (_prop$value = prop.value) === null || _prop$value === void 0 ? void 0 : _prop$value.origin_value; | |
| 1911 | + } | |
| 1912 | + var transformed = transformer(prop.value, { | |
| 1913 | + key: 'overridable', | |
| 1914 | + renderContext: renderContext | |
| 1915 | + }); | |
| 1916 | + return this._resolvePropValue(transformed, renderContext); | |
| 1917 | + }, | |
| 1688 | 1918 | getInteractionId: function getInteractionId() { |
| 1689 | 1919 | var originId = this.model.get('originId'); |
| 1690 | 1920 | var id = this.model.get('id'); |
| 1691 | 1921 | return originId !== null && originId !== void 0 ? originId : id; |
| @@ -1895,12 +2125,9 @@ | ||
| 1895 | 2125 | exports.getElementChildren = getElementChildren; |
| 1896 | 2126 | var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js")); |
| 1897 | 2127 | function getElementChildren(model) { |
| 1898 | 2128 | var _model$get$models, _model$get; |
| 1899 | - if (!model) { | |
| 1900 | - return []; | |
| 1901 | - } | |
| 1902 | - var childModels = (_model$get$models = (_model$get = model.get('elements')) === null || _model$get === void 0 ? void 0 : _model$get.models) !== null && _model$get$models !== void 0 ? _model$get$models : []; | |
| 2129 | + var childModels = (_model$get$models = model === null || model === void 0 || (_model$get = model.get('elements')) === null || _model$get === void 0 ? void 0 : _model$get.models) !== null && _model$get$models !== void 0 ? _model$get$models : []; | |
| 1903 | 2130 | var children = childModels.flatMap(getElementChildren); |
| 1904 | 2131 | return [model].concat((0, _toConsumableArray2.default)(children)); |
| 1905 | 2132 | } |
| 1906 | 2133 | |
| @@ -1959,15 +2186,12 @@ | ||
| 1959 | 2186 | var _getRandomStyleId = __webpack_require__(/*! ./get-random-style-id */ "../modules/atomic-widgets/assets/js/editor/utils/get-random-style-id.js"); |
| 1960 | 2187 | function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } |
| 1961 | 2188 | function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } |
| 1962 | 2189 | function regenerateLocalStyleIds(container) { |
| 1963 | - if (!(container !== null && container !== void 0 && container.model)) { | |
| 1964 | - return; | |
| 1965 | - } | |
| 1966 | 2190 | var allElements = (0, _getElementChildren.getElementChildren)(container.model); |
| 1967 | 2191 | var styledElements = allElements.filter(function (model) { |
| 1968 | 2192 | var _model$get; |
| 1969 | - return model && Object.keys((_model$get = model.get('styles')) !== null && _model$get !== void 0 ? _model$get : {}).length > 0; | |
| 2193 | + return Object.keys((_model$get = model.get('styles')) !== null && _model$get !== void 0 ? _model$get : {}).length > 0; | |
| 1970 | 2194 | }); |
| 1971 | 2195 | updateElementsStyleIdsInsideOut(styledElements); |
| 1972 | 2196 | } |
| 1973 | 2197 | function isClassesProp(prop) { |
| @@ -2983,9 +3207,8 @@ | ||
| 2983 | 3207 | var _createAtomicElementBaseView = _interopRequireDefault(__webpack_require__(/*! ./create-atomic-element-base-view */ "../modules/atomic-widgets/assets/js/editor/create-atomic-element-base-view.js")); |
| 2984 | 3208 | var _atomicElementBaseModel = _interopRequireDefault(__webpack_require__(/*! ./atomic-element-base-model */ "../modules/atomic-widgets/assets/js/editor/atomic-element-base-model.js")); |
| 2985 | 3209 | var _createDivBlockType = _interopRequireDefault(__webpack_require__(/*! ./atomic-element-types/create-div-block-type */ "../modules/atomic-widgets/assets/js/editor/atomic-element-types/create-div-block-type.js")); |
| 2986 | 3210 | var _createFlexboxType = _interopRequireDefault(__webpack_require__(/*! ./atomic-element-types/create-flexbox-type */ "../modules/atomic-widgets/assets/js/editor/atomic-element-types/create-flexbox-type.js")); |
| 2987 | -var _createGridType = _interopRequireDefault(__webpack_require__(/*! ./atomic-element-types/create-grid-type */ "../modules/atomic-widgets/assets/js/editor/atomic-element-types/create-grid-type.js")); | |
| 2988 | 3211 | function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); } |
| 2989 | 3212 | function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } |
| 2990 | 3213 | var Module = /*#__PURE__*/function (_elementorModules$edi) { |
| 2991 | 3214 | function Module() { |
| @@ -3009,19 +3232,10 @@ | ||
| 3009 | 3232 | } |
| 3010 | 3233 | }, { |
| 3011 | 3234 | key: "registerAtomicElements", |
| 3012 | 3235 | value: function registerAtomicElements() { |
| 3013 | - this.registerAtomicElementTypeIfAbsent((0, _createDivBlockType.default)()); | |
| 3014 | - this.registerAtomicElementTypeIfAbsent((0, _createFlexboxType.default)()); | |
| 3015 | - this.registerAtomicElementTypeIfAbsent((0, _createGridType.default)()); | |
| 3016 | - } | |
| 3017 | - }, { | |
| 3018 | - key: "registerAtomicElementTypeIfAbsent", | |
| 3019 | - value: function registerAtomicElementTypeIfAbsent(elementType) { | |
| 3020 | - if (elementor.elementsManager.getElementTypeClass(elementType.getType())) { | |
| 3021 | - return; | |
| 3022 | - } | |
| 3023 | - elementor.elementsManager.registerElementType(elementType); | |
| 3236 | + elementor.elementsManager.registerElementType((0, _createDivBlockType.default)()); | |
| 3237 | + elementor.elementsManager.registerElementType((0, _createFlexboxType.default)()); | |
| 3024 | 3238 | } |
| 3025 | 3239 | }]); |
| 3026 | 3240 | }(elementorModules.editor.utils.Module); |
| 3027 | 3241 | new Module(); |