| @@ -827,10 +827,14 @@ | ||
| 827 | 827 | } |
| 828 | 828 | }, { |
| 829 | 829 | key: "initialize", |
| 830 | 830 | value: function initialize(attributes, options) { |
| 831 | + var _this$config; | |
| 831 | 832 | var elementType = this.get('elType'); |
| 832 | 833 | this.config = elementor.config.elements[elementType]; |
| 834 | + if ((_this$config = this.config) !== null && _this$config !== void 0 && (_this$config = _this$config.meta) !== null && _this$config !== void 0 && _this$config.permanently_locked) { | |
| 835 | + this.set('isLocked', true); | |
| 836 | + } | |
| 833 | 837 | var isNewElementCreate = 0 === this.get('elements').length && $e.commands.currentTrace.includes('document/elements/create'); |
| 834 | 838 | if (isNewElementCreate) { |
| 835 | 839 | this.onElementCreate(); |
| 836 | 840 | } |
| @@ -845,8 +849,14 @@ | ||
| 845 | 849 | }, { |
| 846 | 850 | key: "onElementCreate", |
| 847 | 851 | value: function onElementCreate() { |
| 848 | 852 | var _this = this; |
| 853 | + if (this.get('skipDefaultChildren')) { | |
| 854 | + this.unset('skipDefaultChildren', { | |
| 855 | + silent: true | |
| 856 | + }); | |
| 857 | + return; | |
| 858 | + } | |
| 849 | 859 | this.set('elements', this.getDefaultChildren().map(function (element) { |
| 850 | 860 | return _this.buildElement(element); |
| 851 | 861 | })); |
| 852 | 862 | } |
| @@ -1116,20 +1126,15 @@ | ||
| 1116 | 1126 | value: true |
| 1117 | 1127 | })); |
| 1118 | 1128 | exports["default"] = createAtomicElementBaseView; |
| 1119 | 1129 | 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")); | |
| 1121 | 1130 | 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")); | |
| 1123 | 1131 | var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js")); |
| 1124 | 1132 | var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js")); |
| 1125 | 1133 | var _elementTypes = __webpack_require__(/*! elementor-editor/utils/element-types */ "../assets/dev/js/editor/utils/element-types.js"); |
| 1126 | 1134 | 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; } | |
| 1129 | 1135 | var BaseElementView = elementor.modules.elements.views.BaseElement; |
| 1130 | 1136 | function createAtomicElementBaseView(type) { |
| 1131 | - var resolvedTagCache = new WeakMap(); | |
| 1132 | 1137 | var AtomicElementView = BaseElementView.extend({ |
| 1133 | 1138 | template: Marionette.TemplateCache.get("#tmpl-elementor-".concat(type, "-content")), |
| 1134 | 1139 | emptyView: _atomicElementEmptyView.default, |
| 1135 | 1140 | _childrenRenderPromises: [], |
| @@ -1140,24 +1145,8 @@ | ||
| 1140 | 1145 | return previewDocument.createElement(tag); |
| 1141 | 1146 | } |
| 1142 | 1147 | return document.createElement(tag); |
| 1143 | 1148 | }, |
| 1144 | - tagName: function tagName() { | |
| 1145 | - var _resolvedTagCache$get; | |
| 1146 | - return (_resolvedTagCache$get = resolvedTagCache.get(this.model)) !== null && _resolvedTagCache$get !== void 0 ? _resolvedTagCache$get : this._resolveTag(); | |
| 1147 | - }, | |
| 1148 | - _resolveTag: function _resolveTag() { | |
| 1149 | - var _this$getResolverRend, _linkSetting$value, _resolvedLinkTag$valu, _resolvedTag$value; | |
| 1150 | - var renderContext = (_this$getResolverRend = this.getResolverRenderContext) === null || _this$getResolverRend === void 0 ? void 0 : _this$getResolverRend.call(this); | |
| 1151 | - var tagSetting = this.model.getSetting('tag'); | |
| 1152 | - var resolvedTag = this._resolvePropValue(tagSetting, renderContext); | |
| 1153 | - var linkSetting = this.model.getSetting('link'); | |
| 1154 | - var resolvedLinkTag = this._resolvePropValue(linkSetting === null || linkSetting === void 0 || (_linkSetting$value = linkSetting.value) === null || _linkSetting$value === void 0 ? void 0 : _linkSetting$value.tag, renderContext); | |
| 1155 | - var linkTag = (_resolvedLinkTag$valu = resolvedLinkTag === null || resolvedLinkTag === void 0 ? void 0 : resolvedLinkTag.value) !== null && _resolvedLinkTag$valu !== void 0 ? _resolvedLinkTag$valu : resolvedLinkTag; | |
| 1156 | - var baseTag = (_resolvedTag$value = resolvedTag === null || resolvedTag === void 0 ? void 0 : resolvedTag.value) !== null && _resolvedTag$value !== void 0 ? _resolvedTag$value : resolvedTag; | |
| 1157 | - var resultTag = linkTag !== null && linkTag !== void 0 ? linkTag : baseTag; | |
| 1158 | - return resultTag || this.model.config.default_html_tag || 'div'; | |
| 1159 | - }, | |
| 1160 | 1149 | getChildViewContainer: function getChildViewContainer() { |
| 1161 | 1150 | this.childViewContainer = ''; |
| 1162 | 1151 | return Marionette.CompositeView.prototype.getChildViewContainer.apply(this, arguments); |
| 1163 | 1152 | }, |
| @@ -1180,157 +1169,16 @@ | ||
| 1180 | 1169 | getResolverRenderContext: function getResolverRenderContext() { |
| 1181 | 1170 | var _this$_parent2, _this$_parent2$getRes; |
| 1182 | 1171 | 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); |
| 1183 | 1172 | }, |
| 1184 | - className: function className() { | |
| 1185 | - var generatedClasses = this.getGeneratedClasses(); | |
| 1186 | - return "".concat(BaseElementView.prototype.className.apply(this), " e-con e-atomic-element ").concat(this.getClassString(), " ").concat(generatedClasses); | |
| 1187 | - }, | |
| 1188 | - getGeneratedClasses: function getGeneratedClasses() { | |
| 1173 | + render: function render() { | |
| 1189 | 1174 | var _this = this; |
| 1190 | - var propsSchema = this.model.config.atomic_props_schema || {}; | |
| 1191 | - var generatedClasses = []; | |
| 1192 | - Object.keys(propsSchema).forEach(function (key) { | |
| 1193 | - var _propsSchema$key; | |
| 1194 | - var propMeta = (_propsSchema$key = propsSchema[key]) === null || _propsSchema$key === void 0 ? void 0 : _propsSchema$key.meta; | |
| 1195 | - if (propMeta !== null && propMeta !== void 0 && propMeta.generates_class) { | |
| 1196 | - var _settingValue$value; | |
| 1197 | - var classPattern = propMeta.generates_class; | |
| 1198 | - var settingValue = _this.model.getSetting(key); | |
| 1199 | - var value = (_settingValue$value = settingValue === null || settingValue === void 0 ? void 0 : settingValue.value) !== null && _settingValue$value !== void 0 ? _settingValue$value : settingValue; | |
| 1200 | - if (value && 'string' === typeof value) { | |
| 1201 | - var className = classPattern.replace('{value}', value); | |
| 1202 | - generatedClasses.push(className); | |
| 1203 | - } | |
| 1204 | - } | |
| 1205 | - }); | |
| 1206 | - return generatedClasses.join(' '); | |
| 1207 | - }, | |
| 1208 | - // TODO: Copied from `views/column.js`. | |
| 1209 | - ui: function ui() { | |
| 1210 | - var ui = BaseElementView.prototype.ui.apply(this, arguments); | |
| 1211 | - ui.percentsTooltip = '> .elementor-element-overlay .elementor-column-percents-tooltip'; | |
| 1212 | - return ui; | |
| 1213 | - }, | |
| 1214 | - attributes: function attributes() { | |
| 1215 | - var _this$model$getSettin, _this$model$getSettin2, _this$model$config$in, _this$model; | |
| 1216 | - var attr = BaseElementView.prototype.attributes.apply(this); | |
| 1217 | - var local = {}; | |
| 1218 | - var cssId = this.model.getSetting('_cssid'); | |
| 1219 | - 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 : []; | |
| 1220 | - 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 : {}; | |
| 1221 | - if (cssId) { | |
| 1222 | - local.id = cssId.value; | |
| 1223 | - } | |
| 1224 | - local['data-interaction-id'] = this.getInteractionId(); | |
| 1225 | - customAttributes.forEach(function (attribute) { | |
| 1226 | - var _attribute$value, _attribute$value2; | |
| 1227 | - 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; | |
| 1228 | - 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; | |
| 1229 | - if (key && value) { | |
| 1230 | - local[key] = value; | |
| 1231 | - } | |
| 1232 | - }); | |
| 1233 | - return _objectSpread(_objectSpread(_objectSpread({}, attr), initialAttributes), local); | |
| 1234 | - }, | |
| 1235 | - // TODO: Copied from `views/column.js`. | |
| 1236 | - attachElContent: function attachElContent() { | |
| 1237 | - BaseElementView.prototype.attachElContent.apply(this, arguments); | |
| 1238 | - var $tooltip = jQuery('<div>', { | |
| 1239 | - class: 'elementor-column-percents-tooltip', | |
| 1240 | - 'data-side': elementorCommon.config.isRTL ? 'right' : 'left' | |
| 1241 | - }); | |
| 1242 | - this.$el.children('.elementor-element-overlay').append($tooltip); | |
| 1243 | - }, | |
| 1244 | - // TODO: Copied from `views/column.js`. | |
| 1245 | - getPercentSize: function getPercentSize(size) { | |
| 1246 | - if (!size) { | |
| 1247 | - size = this.el.getBoundingClientRect().width; | |
| 1248 | - } | |
| 1249 | - return +(size / this.$el.parent().width() * 100).toFixed(3); | |
| 1250 | - }, | |
| 1251 | - // TODO: Copied from `views/column.js`. | |
| 1252 | - getPercentsForDisplay: function getPercentsForDisplay() { | |
| 1253 | - var width = +this.model.getSetting('width') || this.getPercentSize(); | |
| 1254 | - return width.toFixed(1) + '%'; | |
| 1255 | - }, | |
| 1256 | - renderOnChange: function renderOnChange(settings) { | |
| 1257 | - var _this2 = this; | |
| 1258 | - var changed = settings.changedAttributes(); | |
| 1259 | - setTimeout(function () { | |
| 1260 | - _this2.updateHandlesPosition(); | |
| 1261 | - }); | |
| 1262 | - if (!changed) { | |
| 1263 | - return; | |
| 1264 | - } | |
| 1265 | - BaseElementView.prototype.renderOnChange.apply(this, settings); | |
| 1266 | - if (changed.attributes) { | |
| 1267 | - var $elAttrs = this.$el[0].attributes; | |
| 1268 | - for (var i = $elAttrs.length - 1; i >= 0; i--) { | |
| 1269 | - var attrName = $elAttrs[i].name; | |
| 1270 | - if (attrName !== 'class') { | |
| 1271 | - this.$el.removeAttr(attrName); | |
| 1272 | - } | |
| 1273 | - } | |
| 1274 | - var newAttrs = this.attributes(); | |
| 1275 | - Object.entries(newAttrs).forEach(function (_ref5) { | |
| 1276 | - var _ref6 = (0, _slicedToArray2.default)(_ref5, 2), | |
| 1277 | - key = _ref6[0], | |
| 1278 | - value = _ref6[1]; | |
| 1279 | - if (key !== 'class' && value !== undefined) { | |
| 1280 | - _this2.$el.attr(key, value); | |
| 1281 | - } | |
| 1282 | - }); | |
| 1283 | - return; | |
| 1284 | - } | |
| 1285 | - | |
| 1286 | - // Check if classes changed OR if any setting with generates_class metadata changed | |
| 1287 | - var propsSchema = this.model.config.atomic_props_schema || {}; | |
| 1288 | - var hasGeneratesClassChange = Object.keys(changed).some(function (key) { | |
| 1289 | - var _propsSchema$key2; | |
| 1290 | - 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; | |
| 1291 | - }); | |
| 1292 | - if (changed.classes || hasGeneratesClassChange) { | |
| 1293 | - // Preserve runtime state classes (e.g., e--selected) that are managed by Alpine | |
| 1294 | - // and would be lost when replacing the class attribute. | |
| 1295 | - var preservedClasses = Array.from(this.$el[0].classList).filter(function (cls) { | |
| 1296 | - return cls.startsWith('e--'); | |
| 1297 | - }); | |
| 1298 | - this.$el.attr('class', this.className()); | |
| 1299 | - preservedClasses.forEach(function (cls) { | |
| 1300 | - return _this2.$el[0].classList.add(cls); | |
| 1301 | - }); | |
| 1302 | - return; | |
| 1303 | - } | |
| 1304 | - if (changed._cssid) { | |
| 1305 | - if (changed._cssid.value) { | |
| 1306 | - this.$el.attr('id', changed._cssid.value); | |
| 1307 | - } else { | |
| 1308 | - this.$el.removeAttr('id'); | |
| 1309 | - } | |
| 1310 | - return; | |
| 1311 | - } | |
| 1312 | - this.$el.addClass(this.getClasses()); | |
| 1313 | - if (this.isTagChanged(changed)) { | |
| 1314 | - this.rerenderEntireView(); | |
| 1315 | - } | |
| 1316 | - }, | |
| 1317 | - isTagChanged: function isTagChanged(changed) { | |
| 1318 | - 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; | |
| 1319 | - }, | |
| 1320 | - rerenderEntireView: function rerenderEntireView() { | |
| 1321 | - var parent = this._parent; | |
| 1322 | - this._parent.removeChildView(this); | |
| 1323 | - parent.addChild(this.model, AtomicElementView, this._index); | |
| 1324 | - }, | |
| 1325 | - render: function render() { | |
| 1326 | - var _this3 = this; | |
| 1327 | 1175 | this._currentRenderPromise = new Promise(function (resolve) { |
| 1328 | 1176 | // Optimize rendering by reusing existing child views instead of recreating them. |
| 1329 | - if (_this3._shouldSkipFullRender()) { | |
| 1330 | - _this3._renderWithoutDomRecreation(resolve); | |
| 1177 | + if (_this._shouldSkipFullRender()) { | |
| 1178 | + _this._renderWithoutDomRecreation(resolve); | |
| 1331 | 1179 | } else { |
| 1332 | - _this3._renderWithDomRecreation(resolve); | |
| 1180 | + _this._renderWithDomRecreation(resolve); | |
| 1333 | 1181 | } |
| 1334 | 1182 | }); |
| 1335 | 1183 | return this; |
| 1336 | 1184 | }, |
| @@ -1347,87 +1195,43 @@ | ||
| 1347 | 1195 | var firstChild = this.children.findByIndex(0); |
| 1348 | 1196 | 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; |
| 1349 | 1197 | }, |
| 1350 | 1198 | _renderWithoutDomRecreation: function _renderWithoutDomRecreation(resolve) { |
| 1351 | - var _this4 = this; | |
| 1199 | + var _this2 = this; | |
| 1352 | 1200 | this._beforeRender(); |
| 1353 | 1201 | this._renderChildren(); |
| 1354 | 1202 | this._waitForChildrenToComplete().then(function () { |
| 1355 | - _this4._afterRender(); | |
| 1203 | + _this2._afterRender(); | |
| 1356 | 1204 | resolve(); |
| 1357 | 1205 | }); |
| 1358 | 1206 | }, |
| 1359 | 1207 | _renderWithDomRecreation: function _renderWithDomRecreation(resolve) { |
| 1360 | - var _this5 = this; | |
| 1361 | 1208 | BaseElementView.prototype.render.apply(this, arguments); |
| 1362 | 1209 | this._waitForChildrenToComplete().then(function () { |
| 1363 | - _this5._applyResolvedAttributes(); | |
| 1364 | 1210 | resolve(); |
| 1365 | 1211 | }); |
| 1366 | 1212 | }, |
| 1367 | 1213 | _beforeRender: function _beforeRender() { |
| 1368 | 1214 | this._isRendering = true; |
| 1369 | - this._invalidateTagCache(); | |
| 1370 | 1215 | this.triggerMethod('before:render', this); |
| 1371 | 1216 | }, |
| 1372 | - _invalidateTagCache: function _invalidateTagCache() { | |
| 1373 | - resolvedTagCache.delete(this.model); | |
| 1374 | - }, | |
| 1375 | - _cacheResolvedTag: function _cacheResolvedTag(tag) { | |
| 1376 | - resolvedTagCache.set(this.model, tag); | |
| 1377 | - }, | |
| 1378 | 1217 | _afterRender: function _afterRender() { |
| 1379 | 1218 | this._isRendering = false; |
| 1380 | 1219 | this.isRendered = true; |
| 1381 | 1220 | this.triggerMethod('render', this); |
| 1382 | - this._applyResolvedAttributes(); | |
| 1383 | 1221 | }, |
| 1384 | - _applyResolvedAttributes: function _applyResolvedAttributes() { | |
| 1385 | - if (!this._parent) { | |
| 1386 | - return; | |
| 1387 | - } | |
| 1388 | - if (this._shouldRecreateForTagChange()) { | |
| 1389 | - return; | |
| 1390 | - } | |
| 1391 | - this._applyLinkAttributes(); | |
| 1392 | - }, | |
| 1393 | - _shouldRecreateForTagChange: function _shouldRecreateForTagChange() { | |
| 1394 | - var resolvedTag = this.tagName(); | |
| 1395 | - var currentTag = this.el.tagName.toLowerCase(); | |
| 1396 | - if (resolvedTag === currentTag) { | |
| 1397 | - return false; | |
| 1398 | - } | |
| 1399 | - this._cacheResolvedTag(resolvedTag); | |
| 1400 | - this.rerenderEntireView(); | |
| 1401 | - return true; | |
| 1402 | - }, | |
| 1403 | - _applyLinkAttributes: function _applyLinkAttributes() { | |
| 1404 | - var _this6 = this; | |
| 1405 | - this.$el.removeAttr('href'); | |
| 1406 | - this.$el.removeAttr('data-action-link'); | |
| 1407 | - var link = this.getLinkAttributes(); | |
| 1408 | - if (!link) { | |
| 1409 | - return; | |
| 1410 | - } | |
| 1411 | - Object.entries(link).forEach(function (_ref7) { | |
| 1412 | - var _ref8 = (0, _slicedToArray2.default)(_ref7, 2), | |
| 1413 | - key = _ref8[0], | |
| 1414 | - value = _ref8[1]; | |
| 1415 | - _this6.$el.attr(key, value); | |
| 1416 | - }); | |
| 1417 | - }, | |
| 1418 | 1222 | _waitForChildrenToComplete: function _waitForChildrenToComplete() { |
| 1419 | - var _this7 = this; | |
| 1223 | + var _this3 = this; | |
| 1420 | 1224 | return (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() { |
| 1421 | 1225 | return _regenerator.default.wrap(function (_context) { |
| 1422 | 1226 | while (1) switch (_context.prev = _context.next) { |
| 1423 | 1227 | case 0: |
| 1424 | - if (!(_this7._childrenRenderPromises.length > 0)) { | |
| 1228 | + if (!(_this3._childrenRenderPromises.length > 0)) { | |
| 1425 | 1229 | _context.next = 1; |
| 1426 | 1230 | break; |
| 1427 | 1231 | } |
| 1428 | 1232 | _context.next = 1; |
| 1429 | - return Promise.all(_this7._childrenRenderPromises); | |
| 1233 | + return Promise.all(_this3._childrenRenderPromises); | |
| 1430 | 1234 | case 1: |
| 1431 | 1235 | case "end": |
| 1432 | 1236 | return _context.stop(); |
| 1433 | 1237 | } |
| @@ -1446,25 +1250,25 @@ | ||
| 1446 | 1250 | this._collectChildrenRenderPromises(); |
| 1447 | 1251 | }, |
| 1448 | 1252 | _collectChildrenRenderPromises: function _collectChildrenRenderPromises() { |
| 1449 | 1253 | var _this$children3, |
| 1450 | - _this8 = this; | |
| 1254 | + _this4 = this; | |
| 1451 | 1255 | this._childrenRenderPromises = []; |
| 1452 | 1256 | (_this$children3 = this.children) === null || _this$children3 === void 0 || _this$children3.each(function (childView) { |
| 1453 | 1257 | if (childView._currentRenderPromise) { |
| 1454 | - _this8._childrenRenderPromises.push(childView._currentRenderPromise); | |
| 1258 | + _this4._childrenRenderPromises.push(childView._currentRenderPromise); | |
| 1455 | 1259 | } |
| 1456 | 1260 | }); |
| 1457 | 1261 | }, |
| 1458 | 1262 | onRender: function onRender() { |
| 1459 | - var _this9 = this; | |
| 1263 | + var _this5 = this; | |
| 1460 | 1264 | this.dispatchPreviewEvent('elementor/element/render'); |
| 1461 | 1265 | BaseElementView.prototype.onRender.apply(this, arguments); |
| 1462 | 1266 | |
| 1463 | 1267 | // Defer to wait for everything to render. |
| 1464 | 1268 | setTimeout(function () { |
| 1465 | - _this9.droppableInitialize(); | |
| 1466 | - _this9.updateHandlesPosition(); | |
| 1269 | + _this5.droppableInitialize(); | |
| 1270 | + _this5.updateHandlesPosition(); | |
| 1467 | 1271 | }); |
| 1468 | 1272 | }, |
| 1469 | 1273 | onDestroy: function onDestroy() { |
| 1470 | 1274 | BaseElementView.prototype.onDestroy.apply(this, arguments); |
| @@ -1479,46 +1283,8 @@ | ||
| 1479 | 1283 | element: this.getDomElement().get(0) |
| 1480 | 1284 | } |
| 1481 | 1285 | })); |
| 1482 | 1286 | }, |
| 1483 | - _hasLink: function _hasLink(renderContext) { | |
| 1484 | - var _resolvedLink$value; | |
| 1485 | - var linkSetting = this.model.getSetting('link'); | |
| 1486 | - var resolvedLink = this._resolvePropValue(linkSetting, renderContext); | |
| 1487 | - if ('link' !== (resolvedLink === null || resolvedLink === void 0 ? void 0 : resolvedLink.$$type)) { | |
| 1488 | - return false; | |
| 1489 | - } | |
| 1490 | - var destination = this._resolvePropValue((_resolvedLink$value = resolvedLink.value) === null || _resolvedLink$value === void 0 ? void 0 : _resolvedLink$value.destination, renderContext); | |
| 1491 | - return !!(destination !== null && destination !== void 0 && destination.value); | |
| 1492 | - }, | |
| 1493 | - getLinkAttributes: function getLinkAttributes() { | |
| 1494 | - var _this$getResolverRend2, _resolvedLink$value2; | |
| 1495 | - var renderContext = (_this$getResolverRend2 = this.getResolverRenderContext) === null || _this$getResolverRend2 === void 0 ? void 0 : _this$getResolverRend2.call(this); | |
| 1496 | - var linkSetting = this.model.getSetting('link'); | |
| 1497 | - var resolvedLink = this._resolvePropValue(linkSetting, renderContext); | |
| 1498 | - if ('link' !== (resolvedLink === null || resolvedLink === void 0 ? void 0 : resolvedLink.$$type)) { | |
| 1499 | - return null; | |
| 1500 | - } | |
| 1501 | - var destination = this._resolvePropValue((_resolvedLink$value2 = resolvedLink.value) === null || _resolvedLink$value2 === void 0 ? void 0 : _resolvedLink$value2.destination, renderContext); | |
| 1502 | - if (!(destination !== null && destination !== void 0 && destination.value)) { | |
| 1503 | - return null; | |
| 1504 | - } | |
| 1505 | - var $$type = destination.$$type, | |
| 1506 | - value = destination.value; | |
| 1507 | - if ('dynamic' === $$type) { | |
| 1508 | - var resolvedValue = this.handleDynamicLink(value); | |
| 1509 | - if (!resolvedValue) { | |
| 1510 | - return null; | |
| 1511 | - } | |
| 1512 | - var attributeKey = 'action' === (value === null || value === void 0 ? void 0 : value.group) ? 'data-action-link' : 'href'; | |
| 1513 | - return (0, _defineProperty2.default)({}, attributeKey, resolvedValue); | |
| 1514 | - } | |
| 1515 | - var isPostId = 'number' === $$type; | |
| 1516 | - var hrefPrefix = isPostId ? elementor.config.home_url + '/?p=' : ''; | |
| 1517 | - return { | |
| 1518 | - href: hrefPrefix + value | |
| 1519 | - }; | |
| 1520 | - }, | |
| 1521 | 1287 | droppableInitialize: function droppableInitialize() { |
| 1522 | 1288 | this.$el.html5Droppable(this.getDroppableOptions()); |
| 1523 | 1289 | }, |
| 1524 | 1290 | /** |
| @@ -1526,9 +1292,9 @@ | ||
| 1526 | 1292 | * |
| 1527 | 1293 | * @return {Object} groups |
| 1528 | 1294 | */ |
| 1529 | 1295 | getContextMenuGroups: function getContextMenuGroups() { |
| 1530 | - var _this0 = this, | |
| 1296 | + var _this6 = this, | |
| 1531 | 1297 | _elementorCommon$conf; |
| 1532 | 1298 | var saveActions = [{ |
| 1533 | 1299 | name: 'save', |
| 1534 | 1300 | title: __('Save as a template', 'elementor'), |
| @@ -1533,9 +1299,9 @@ | ||
| 1533 | 1299 | name: 'save', |
| 1534 | 1300 | title: __('Save as a template', 'elementor'), |
| 1535 | 1301 | callback: this.saveAsTemplate.bind(this), |
| 1536 | 1302 | isEnabled: function isEnabled() { |
| 1537 | - return !_this0.getContainer().isLocked(); | |
| 1303 | + return !_this6.getContainer().isLocked(); | |
| 1538 | 1304 | } |
| 1539 | 1305 | }]; |
| 1540 | 1306 | var isAdministrator = elementor.config.user.is_administrator; |
| 1541 | 1307 | var isExperimentalFeaturesEnabled = (_elementorCommon$conf = elementorCommon.config.experimentalFeatures) === null || _elementorCommon$conf === void 0 ? void 0 : _elementorCommon$conf.e_components; |
| @@ -1554,9 +1320,9 @@ | ||
| 1554 | 1320 | shortcut: isProActive || isProOutdated ? newBadge : proBadge, |
| 1555 | 1321 | hasShortcutAction: showPromoBadge, |
| 1556 | 1322 | callback: this.saveAsComponent.bind(this), |
| 1557 | 1323 | isEnabled: function isEnabled() { |
| 1558 | - return (isProActive || isProOutdated) && !_this0.getContainer().isLocked(); | |
| 1324 | + return (isProActive || isProOutdated) && !_this6.getContainer().isLocked(); | |
| 1559 | 1325 | } |
| 1560 | 1326 | }); |
| 1561 | 1327 | } |
| 1562 | 1328 | var groups = BaseElementView.prototype.getContextMenuGroups.apply(this, arguments), |
| @@ -1639,9 +1405,9 @@ | ||
| 1639 | 1405 | preventInit: true |
| 1640 | 1406 | }; |
| 1641 | 1407 | }, |
| 1642 | 1408 | getDroppableOptions: function getDroppableOptions() { |
| 1643 | - var _this1 = this; | |
| 1409 | + var _this7 = this; | |
| 1644 | 1410 | var items = '> .elementor-element, > .elementor-empty-view .elementor-first-add'; |
| 1645 | 1411 | return { |
| 1646 | 1412 | axis: null, |
| 1647 | 1413 | items: items, |
| @@ -1651,9 +1417,9 @@ | ||
| 1651 | 1417 | currentElementClass: 'elementor-html5dnd-current-element', |
| 1652 | 1418 | placeholderClass: 'elementor-sortable-placeholder elementor-widget-placeholder', |
| 1653 | 1419 | hasDraggingOnChildClass: 'e-dragging-over', |
| 1654 | 1420 | getDropContainer: function getDropContainer() { |
| 1655 | - return _this1.getContainer(); | |
| 1421 | + return _this7.getContainer(); | |
| 1656 | 1422 | }, |
| 1657 | 1423 | onDropping: function onDropping(side, event) { |
| 1658 | 1424 | event.stopPropagation(); |
| 1659 | 1425 | |
| @@ -1663,14 +1429,14 @@ | ||
| 1663 | 1429 | draggedElement = draggedView === null || draggedView === void 0 ? void 0 : draggedView.getContainer().view.el, |
| 1664 | 1430 | containerElement = event.currentTarget.parentElement, |
| 1665 | 1431 | elements = Array.from((containerElement === null || containerElement === void 0 ? void 0 : containerElement.querySelectorAll(':scope > .elementor-element')) || []); |
| 1666 | 1432 | var targetIndex = elements.indexOf(event.currentTarget); |
| 1667 | - if (_this1.isPanelElement(draggedView, draggedElement)) { | |
| 1433 | + if (_this7.isPanelElement(draggedView, draggedElement)) { | |
| 1668 | 1434 | var _elementorCommon; |
| 1669 | - if (_this1.draggingOnBottomOrRightSide(side) && !_this1.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1435 | + if (_this7.draggingOnBottomOrRightSide(side) && !_this7.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1670 | 1436 | targetIndex++; |
| 1671 | 1437 | } |
| 1672 | - _this1.onDrop(event, { | |
| 1438 | + _this7.onDrop(event, { | |
| 1673 | 1439 | at: targetIndex |
| 1674 | 1440 | }); |
| 1675 | 1441 | if ((_elementorCommon = elementorCommon) !== null && _elementorCommon !== void 0 && (_elementorCommon = _elementorCommon.eventsManager) !== null && _elementorCommon !== void 0 && _elementorCommon.dispatchEvent) { |
| 1676 | 1442 | var selectedElement = elementor.channels.panelElements.request('element:selected'); |
| @@ -1688,16 +1454,16 @@ | ||
| 1688 | 1454 | } |
| 1689 | 1455 | } |
| 1690 | 1456 | return; |
| 1691 | 1457 | } |
| 1692 | - if (_this1.isParentElement(draggedView.getContainer().id)) { | |
| 1458 | + if (_this7.isParentElement(draggedView.getContainer().id)) { | |
| 1693 | 1459 | return; |
| 1694 | 1460 | } |
| 1695 | - if (_this1.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1696 | - _this1.moveDroppedItem(draggedView, 0); | |
| 1461 | + if (_this7.emptyViewIsCurrentlyBeingDraggedOver()) { | |
| 1462 | + _this7.moveDroppedItem(draggedView, 0); | |
| 1697 | 1463 | return; |
| 1698 | 1464 | } |
| 1699 | - _this1.moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement); | |
| 1465 | + _this7.moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement); | |
| 1700 | 1466 | } |
| 1701 | 1467 | }; |
| 1702 | 1468 | }, |
| 1703 | 1469 | moveExistingElement: function moveExistingElement(side, draggedView, containerElement, elements, targetIndex, draggedElement) { |
| @@ -1815,26 +1581,8 @@ | ||
| 1815 | 1581 | }); |
| 1816 | 1582 | }); |
| 1817 | 1583 | this.addSectionView = addSectionView; |
| 1818 | 1584 | }, |
| 1819 | - getClasses: function getClasses() { | |
| 1820 | - var _window, _window$get, _this$options; | |
| 1821 | - 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'); | |
| 1822 | - if (!transformer) { | |
| 1823 | - return []; | |
| 1824 | - } | |
| 1825 | - 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) || []); | |
| 1826 | - }, | |
| 1827 | - getClassString: function getClassString() { | |
| 1828 | - var classes = this.getClasses(); | |
| 1829 | - var base = this.getBaseClass(); | |
| 1830 | - return [base].concat((0, _toConsumableArray2.default)(classes)).join(' '); | |
| 1831 | - }, | |
| 1832 | - getBaseClass: function getBaseClass() { | |
| 1833 | - var _this$options2, _Object$keys$; | |
| 1834 | - var baseStyles = elementor.helpers.getAtomicWidgetBaseStyles((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.model); | |
| 1835 | - return (_Object$keys$ = Object.keys(baseStyles !== null && baseStyles !== void 0 ? baseStyles : {})[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : ''; | |
| 1836 | - }, | |
| 1837 | 1585 | isOverflowHidden: function isOverflowHidden() { |
| 1838 | 1586 | var elementStyles = window.getComputedStyle(this.el); |
| 1839 | 1587 | var overflowStyles = [elementStyles.overflowX, elementStyles.overflowY, elementStyles.overflow]; |
| 1840 | 1588 | return overflowStyles.includes('hidden') || overflowStyles.includes('auto'); |
| @@ -1858,75 +1606,8 @@ | ||
| 1858 | 1606 | if (!this.model.collection) { |
| 1859 | 1607 | return true; |
| 1860 | 1608 | } |
| 1861 | 1609 | return 0 === this.model.collection.indexOf(this.model); |
| 1862 | - }, | |
| 1863 | - getDynamicLinkValue: function getDynamicLinkValue(name, settings) { | |
| 1864 | - var simpleTransform = function simpleTransform(props) { | |
| 1865 | - var transformed = Object.entries(props).map(function (_ref0) { | |
| 1866 | - var _ref1 = (0, _slicedToArray2.default)(_ref0, 2), | |
| 1867 | - settingKey = _ref1[0], | |
| 1868 | - settingValue = _ref1[1]; | |
| 1869 | - var value = 'object' === (0, _typeof2.default)(settingValue) && 'value' in settingValue ? settingValue.value : settingValue; | |
| 1870 | - return [settingKey, value]; | |
| 1871 | - }); | |
| 1872 | - return Object.fromEntries(transformed); | |
| 1873 | - }; | |
| 1874 | - var getTagValue = function getTagValue() { | |
| 1875 | - var _elementor$dynamicTag; | |
| 1876 | - var tag = elementor.dynamicTags.createTag('v4-dynamic-tag', name, simpleTransform(settings)); | |
| 1877 | - if (!tag) { | |
| 1878 | - return null; | |
| 1879 | - } | |
| 1880 | - return (_elementor$dynamicTag = elementor.dynamicTags.loadTagDataFromCache(tag)) !== null && _elementor$dynamicTag !== void 0 ? _elementor$dynamicTag : null; | |
| 1881 | - }; | |
| 1882 | - var tagValue = getTagValue(); | |
| 1883 | - if (tagValue !== null) { | |
| 1884 | - return tagValue; | |
| 1885 | - } | |
| 1886 | - return new Promise(function (resolve) { | |
| 1887 | - elementor.dynamicTags.refreshCacheFromServer(function () { | |
| 1888 | - resolve(getTagValue()); | |
| 1889 | - }); | |
| 1890 | - }); | |
| 1891 | - }, | |
| 1892 | - handleDynamicLink: function handleDynamicLink(linkValue) { | |
| 1893 | - var _this10 = this; | |
| 1894 | - var result = this.getDynamicLinkValue(linkValue.name, linkValue.settings); | |
| 1895 | - if (!result) { | |
| 1896 | - return null; | |
| 1897 | - } | |
| 1898 | - if ('string' === typeof result) { | |
| 1899 | - return result; | |
| 1900 | - } | |
| 1901 | - result.then(function (href) { | |
| 1902 | - _this10.el.removeAttribute('href'); | |
| 1903 | - var attribute = 'action' === linkValue.group ? 'data-action-link' : 'href'; | |
| 1904 | - _this10.el.setAttribute(attribute, href); | |
| 1905 | - }).then(function () { | |
| 1906 | - return _this10.dispatchPreviewEvent('elementor/element/render'); | |
| 1907 | - }); | |
| 1908 | - return null; | |
| 1909 | - }, | |
| 1910 | - _resolvePropValue: function _resolvePropValue(prop, renderContext) { | |
| 1911 | - var _window2, _registry$get; | |
| 1912 | - if (!prop || (0, _typeof2.default)(prop) !== 'object') { | |
| 1913 | - return prop; | |
| 1914 | - } | |
| 1915 | - if ('overridable' !== prop.$$type) { | |
| 1916 | - return prop; | |
| 1917 | - } | |
| 1918 | - 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; | |
| 1919 | - var transformer = registry === null || registry === void 0 || (_registry$get = registry.get) === null || _registry$get === void 0 ? void 0 : _registry$get.call(registry, 'overridable'); | |
| 1920 | - if (!transformer) { | |
| 1921 | - var _prop$value; | |
| 1922 | - return (_prop$value = prop.value) === null || _prop$value === void 0 ? void 0 : _prop$value.origin_value; | |
| 1923 | - } | |
| 1924 | - var transformed = transformer(prop.value, { | |
| 1925 | - key: 'overridable', | |
| 1926 | - renderContext: renderContext | |
| 1927 | - }); | |
| 1928 | - return this._resolvePropValue(transformed, renderContext); | |
| 1929 | 1610 | }, |
| 1930 | 1611 | getInteractionId: function getInteractionId() { |
| 1931 | 1612 | var originId = this.model.get('originId'); |
| 1932 | 1613 | var id = this.model.get('id'); |