@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.mjs CHANGED
@@ -11,7 +11,7 @@ import { __privateListenTo as listenTo2, commandStartEvent, registerDataHook } f
11
11
  import { __registerSlice as registerSlice } from "@elementor/store";
12
12
  import { __ as __8 } from "@wordpress/i18n";
13
13
 
14
- // src/component-id-transformer.ts
14
+ // src/component-instance-transformer.ts
15
15
  import { createTransformer } from "@elementor/editor-canvas";
16
16
  import { __getState as getState } from "@elementor/store";
17
17
 
@@ -168,9 +168,9 @@ function getDocumentsManager() {
168
168
  return documentManager;
169
169
  }
170
170
 
171
- // src/component-id-transformer.ts
172
- var componentIdTransformer = createTransformer(
173
- async (id) => {
171
+ // src/component-instance-transformer.ts
172
+ var componentInstanceTransformer = createTransformer(
173
+ async ({ component_id: id }) => {
174
174
  const unpublishedComponents = selectUnpublishedComponents(getState());
175
175
  const unpublishedComponent = unpublishedComponents.find(({ uid }) => uid === id);
176
176
  if (unpublishedComponent) {
@@ -261,13 +261,15 @@ import { Box as Box2, ListItemButton, ListItemIcon, ListItemText, Typography } f
261
261
  import { __dispatch as dispatch, __getState as getState2 } from "@elementor/store";
262
262
 
263
263
  // src/utils/get-component-ids.ts
264
- import { isTransformable } from "@elementor/editor-props";
265
264
  var getComponentIds = (elements) => {
266
265
  const result = elements.flatMap((element) => {
267
266
  const ids = [];
268
267
  const type = element.widgetType || element.elType;
269
- if (type === "e-component" && element.settings?.component && isTransformable(element.settings?.component)) {
270
- ids.push(element.settings.component.value);
268
+ if (type === "e-component") {
269
+ const componentId = element.settings?.component_instance?.value?.component_id;
270
+ if (Boolean(componentId)) {
271
+ ids.push(componentId);
272
+ }
271
273
  }
272
274
  if (element.elements) {
273
275
  ids.push(...getComponentIds(element.elements));
@@ -364,9 +366,11 @@ var createComponentModel = (component) => {
364
366
  elType: "widget",
365
367
  widgetType: "e-component",
366
368
  settings: {
367
- component: {
368
- $$type: "component-id",
369
- value: component.id ?? component.uid
369
+ component_instance: {
370
+ $$type: "component-instance",
371
+ value: {
372
+ component_id: component.id ?? component.uid
373
+ }
370
374
  }
371
375
  },
372
376
  editor_settings: {
@@ -1197,13 +1201,15 @@ function createComponentView(options) {
1197
1201
  eventsManagerConfig = this.legacyWindow.elementorCommon.eventsManager.config;
1198
1202
  isComponentCurrentlyEdited() {
1199
1203
  const currentDocument = getCurrentDocument();
1200
- return currentDocument?.id === this.getComponentId()?.value;
1204
+ return currentDocument?.id === this.getComponentId();
1201
1205
  }
1202
1206
  afterSettingsResolve(settings) {
1203
- if (settings.component) {
1204
- this.collection = this.legacyWindow.elementor.createBackboneElementsCollection(settings.component);
1207
+ if (settings.component_instance) {
1208
+ this.collection = this.legacyWindow.elementor.createBackboneElementsCollection(
1209
+ settings.component_instance
1210
+ );
1205
1211
  this.collection.models.forEach(setInactiveRecursively);
1206
- settings.component = "<template data-children-placeholder></template>";
1212
+ settings.component_instance = "<template data-children-placeholder></template>";
1207
1213
  }
1208
1214
  return settings;
1209
1215
  }
@@ -1219,11 +1225,12 @@ function createComponentView(options) {
1219
1225
  childrenPlaceholder.replaceWith(buffer);
1220
1226
  }
1221
1227
  getComponentId() {
1222
- return this.options?.model?.get("settings")?.get("component");
1228
+ const componentInstance = this.options?.model?.get("settings")?.get("component_instance")?.value;
1229
+ return componentInstance.component_id;
1223
1230
  }
1224
1231
  getContextMenuGroups() {
1225
1232
  const filteredGroups = super.getContextMenuGroups().filter((group) => group.name !== "save");
1226
- const componentId = this.getComponentId()?.value;
1233
+ const componentId = this.getComponentId();
1227
1234
  if (!componentId) {
1228
1235
  return filteredGroups;
1229
1236
  }
@@ -1245,13 +1252,13 @@ function createComponentView(options) {
1245
1252
  }
1246
1253
  async switchDocument() {
1247
1254
  const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
1248
- this.getComponentId()?.value
1255
+ this.getComponentId()
1249
1256
  );
1250
1257
  if (!isAllowedToSwitchDocument) {
1251
1258
  options.showLockedByModal?.(lockedBy || "");
1252
1259
  } else {
1253
1260
  runCommand3("editor/documents/switch", {
1254
- id: this.getComponentId()?.value,
1261
+ id: this.getComponentId(),
1255
1262
  mode: "autosave",
1256
1263
  selector: `[data-id="${this.model.get("id")}"]`,
1257
1264
  shouldScroll: false
@@ -1291,7 +1298,7 @@ function createComponentView(options) {
1291
1298
  attributes() {
1292
1299
  return {
1293
1300
  ...super.attributes(),
1294
- "data-elementor-id": this.getComponentId().value
1301
+ "data-elementor-id": this.getComponentId()
1295
1302
  };
1296
1303
  }
1297
1304
  };
@@ -1405,7 +1412,7 @@ function updateComponentInstances(elements, uidToComponentId) {
1405
1412
  }
1406
1413
  function shouldUpdateElement(element, uidToComponentId) {
1407
1414
  if (element.widgetType === "e-component") {
1408
- const currentComponentId = element.settings?.component?.value;
1415
+ const currentComponentId = element.settings?.component_instance?.value?.component_id;
1409
1416
  if (currentComponentId && uidToComponentId.has(currentComponentId)) {
1410
1417
  return { shouldUpdate: true, newComponentId: uidToComponentId.get(currentComponentId) };
1411
1418
  }
@@ -1416,9 +1423,9 @@ function updateElementComponentId(elementId, componentId) {
1416
1423
  updateElementSettings({
1417
1424
  id: elementId,
1418
1425
  props: {
1419
- component: {
1420
- $$type: "component-id",
1421
- value: componentId
1426
+ component_instance: {
1427
+ $$type: "component-instance",
1428
+ value: { component_id: componentId }
1422
1429
  }
1423
1430
  },
1424
1431
  withHistory: false
@@ -1496,7 +1503,7 @@ function init() {
1496
1503
  }
1497
1504
  loadComponentsStyles(config?.elements ?? []);
1498
1505
  });
1499
- settingsTransformersRegistry.register("component-id", componentIdTransformer);
1506
+ settingsTransformersRegistry.register("component-instance", componentInstanceTransformer);
1500
1507
  }
1501
1508
  export {
1502
1509
  init