@elementor/editor-components 3.33.0-290 → 3.33.0-291

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
44
44
  var import_store20 = require("@elementor/store");
45
45
  var import_i18n8 = require("@wordpress/i18n");
46
46
 
47
- // src/component-id-transformer.ts
47
+ // src/component-instance-transformer.ts
48
48
  var import_editor_canvas = require("@elementor/editor-canvas");
49
49
  var import_store3 = require("@elementor/store");
50
50
 
@@ -198,9 +198,9 @@ function getDocumentsManager() {
198
198
  return documentManager;
199
199
  }
200
200
 
201
- // src/component-id-transformer.ts
202
- var componentIdTransformer = (0, import_editor_canvas.createTransformer)(
203
- async (id) => {
201
+ // src/component-instance-transformer.ts
202
+ var componentInstanceTransformer = (0, import_editor_canvas.createTransformer)(
203
+ async ({ component_id: id }) => {
204
204
  const unpublishedComponents = selectUnpublishedComponents((0, import_store3.__getState)());
205
205
  const unpublishedComponent = unpublishedComponents.find(({ uid }) => uid === id);
206
206
  if (unpublishedComponent) {
@@ -291,13 +291,15 @@ var import_ui2 = require("@elementor/ui");
291
291
  var import_store7 = require("@elementor/store");
292
292
 
293
293
  // src/utils/get-component-ids.ts
294
- var import_editor_props = require("@elementor/editor-props");
295
294
  var getComponentIds = (elements) => {
296
295
  const result = elements.flatMap((element) => {
297
296
  const ids = [];
298
297
  const type = element.widgetType || element.elType;
299
- if (type === "e-component" && element.settings?.component && (0, import_editor_props.isTransformable)(element.settings?.component)) {
300
- ids.push(element.settings.component.value);
298
+ if (type === "e-component") {
299
+ const componentId = element.settings?.component_instance?.value?.component_id;
300
+ if (Boolean(componentId)) {
301
+ ids.push(componentId);
302
+ }
301
303
  }
302
304
  if (element.elements) {
303
305
  ids.push(...getComponentIds(element.elements));
@@ -390,9 +392,11 @@ var createComponentModel = (component) => {
390
392
  elType: "widget",
391
393
  widgetType: "e-component",
392
394
  settings: {
393
- component: {
394
- $$type: "component-id",
395
- value: component.id ?? component.uid
395
+ component_instance: {
396
+ $$type: "component-instance",
397
+ value: {
398
+ component_id: component.id ?? component.uid
399
+ }
396
400
  }
397
401
  },
398
402
  editor_settings: {
@@ -1217,13 +1221,15 @@ function createComponentView(options) {
1217
1221
  eventsManagerConfig = this.legacyWindow.elementorCommon.eventsManager.config;
1218
1222
  isComponentCurrentlyEdited() {
1219
1223
  const currentDocument = (0, import_editor_documents2.getCurrentDocument)();
1220
- return currentDocument?.id === this.getComponentId()?.value;
1224
+ return currentDocument?.id === this.getComponentId();
1221
1225
  }
1222
1226
  afterSettingsResolve(settings) {
1223
- if (settings.component) {
1224
- this.collection = this.legacyWindow.elementor.createBackboneElementsCollection(settings.component);
1227
+ if (settings.component_instance) {
1228
+ this.collection = this.legacyWindow.elementor.createBackboneElementsCollection(
1229
+ settings.component_instance
1230
+ );
1225
1231
  this.collection.models.forEach(setInactiveRecursively);
1226
- settings.component = "<template data-children-placeholder></template>";
1232
+ settings.component_instance = "<template data-children-placeholder></template>";
1227
1233
  }
1228
1234
  return settings;
1229
1235
  }
@@ -1239,11 +1245,12 @@ function createComponentView(options) {
1239
1245
  childrenPlaceholder.replaceWith(buffer);
1240
1246
  }
1241
1247
  getComponentId() {
1242
- return this.options?.model?.get("settings")?.get("component");
1248
+ const componentInstance = this.options?.model?.get("settings")?.get("component_instance")?.value;
1249
+ return componentInstance.component_id;
1243
1250
  }
1244
1251
  getContextMenuGroups() {
1245
1252
  const filteredGroups = super.getContextMenuGroups().filter((group) => group.name !== "save");
1246
- const componentId = this.getComponentId()?.value;
1253
+ const componentId = this.getComponentId();
1247
1254
  if (!componentId) {
1248
1255
  return filteredGroups;
1249
1256
  }
@@ -1265,13 +1272,13 @@ function createComponentView(options) {
1265
1272
  }
1266
1273
  async switchDocument() {
1267
1274
  const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
1268
- this.getComponentId()?.value
1275
+ this.getComponentId()
1269
1276
  );
1270
1277
  if (!isAllowedToSwitchDocument) {
1271
1278
  options.showLockedByModal?.(lockedBy || "");
1272
1279
  } else {
1273
1280
  (0, import_editor_v1_adapters5.__privateRunCommand)("editor/documents/switch", {
1274
- id: this.getComponentId()?.value,
1281
+ id: this.getComponentId(),
1275
1282
  mode: "autosave",
1276
1283
  selector: `[data-id="${this.model.get("id")}"]`,
1277
1284
  shouldScroll: false
@@ -1311,7 +1318,7 @@ function createComponentView(options) {
1311
1318
  attributes() {
1312
1319
  return {
1313
1320
  ...super.attributes(),
1314
- "data-elementor-id": this.getComponentId().value
1321
+ "data-elementor-id": this.getComponentId()
1315
1322
  };
1316
1323
  }
1317
1324
  };
@@ -1425,7 +1432,7 @@ function updateComponentInstances(elements, uidToComponentId) {
1425
1432
  }
1426
1433
  function shouldUpdateElement(element, uidToComponentId) {
1427
1434
  if (element.widgetType === "e-component") {
1428
- const currentComponentId = element.settings?.component?.value;
1435
+ const currentComponentId = element.settings?.component_instance?.value?.component_id;
1429
1436
  if (currentComponentId && uidToComponentId.has(currentComponentId)) {
1430
1437
  return { shouldUpdate: true, newComponentId: uidToComponentId.get(currentComponentId) };
1431
1438
  }
@@ -1436,9 +1443,9 @@ function updateElementComponentId(elementId, componentId) {
1436
1443
  (0, import_editor_elements5.updateElementSettings)({
1437
1444
  id: elementId,
1438
1445
  props: {
1439
- component: {
1440
- $$type: "component-id",
1441
- value: componentId
1446
+ component_instance: {
1447
+ $$type: "component-instance",
1448
+ value: { component_id: componentId }
1442
1449
  }
1443
1450
  },
1444
1451
  withHistory: false
@@ -1516,7 +1523,7 @@ function init() {
1516
1523
  }
1517
1524
  loadComponentsStyles(config?.elements ?? []);
1518
1525
  });
1519
- import_editor_canvas5.settingsTransformersRegistry.register("component-id", componentIdTransformer);
1526
+ import_editor_canvas5.settingsTransformersRegistry.register("component-instance", componentInstanceTransformer);
1520
1527
  }
1521
1528
  // Annotate the CommonJS export names for ESM import in node:
1522
1529
  0 && (module.exports = {