@elementor/editor-components 4.0.0-544 → 4.0.0-545

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
@@ -3304,13 +3304,20 @@ async function createUnpublishedComponent({
3304
3304
  return { uid: generatedUid, instanceId: componentInstance.id };
3305
3305
  }
3306
3306
  function restoreOriginalElement(originalElement, componentInstanceId) {
3307
- (0, import_editor_elements11.deleteElement)({ elementId: componentInstanceId, options: { useHistory: false } });
3307
+ const componentContainer = (0, import_editor_elements11.getContainer)(componentInstanceId);
3308
+ if (componentContainer) {
3309
+ (0, import_editor_elements11.deleteElement)({ container: componentContainer, options: { useHistory: false } });
3310
+ }
3311
+ const parentContainer = (0, import_editor_elements11.getContainer)(originalElement.parentId);
3312
+ if (!parentContainer) {
3313
+ return;
3314
+ }
3308
3315
  const clonedModel = structuredClone(originalElement.model);
3309
3316
  (0, import_editor_elements11.createElements)({
3310
3317
  title: (0, import_i18n22.__)("Restore Element", "elementor"),
3311
3318
  elements: [
3312
3319
  {
3313
- containerId: originalElement.parentId,
3320
+ container: parentContainer,
3314
3321
  model: clonedModel,
3315
3322
  options: { at: originalElement.index }
3316
3323
  }
@@ -5582,7 +5589,7 @@ function initRedirectDropIntoComponent() {
5582
5589
  }
5583
5590
  function createEmptyTopLevelContainer(container) {
5584
5591
  const newContainer = (0, import_editor_elements23.createElement)({
5585
- containerId: container.id,
5592
+ container,
5586
5593
  model: { elType: V4_DEFAULT_CONTAINER_TYPE }
5587
5594
  });
5588
5595
  (0, import_editor_elements23.selectElement)(newContainer.id);