@elementor/editor-editing-panel 3.35.0-346 → 3.35.0-347

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
@@ -2337,10 +2337,15 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
2337
2337
  elementId,
2338
2338
  propDisplayName
2339
2339
  });
2340
- const setValue = (newValue) => {
2340
+ const setValue = (newValue, _ = {}, meta) => {
2341
+ const { withHistory = true } = meta ?? {};
2341
2342
  const dependents = extractOrderedDependencies(dependenciesPerTargetMapping);
2342
2343
  const settings = getUpdatedValues(newValue, dependents, propsSchema, migratedValues, elementId);
2343
- undoableUpdateElementProp(settings);
2344
+ if (withHistory) {
2345
+ undoableUpdateElementProp(settings);
2346
+ } else {
2347
+ updateElementSettings3({ id: elementId, props: settings, withHistory: false });
2348
+ }
2344
2349
  };
2345
2350
  const isDisabled = (prop) => !isDependencyMet2(prop?.dependencies, migratedValues).isMet;
2346
2351
  return /* @__PURE__ */ React22.createElement(PropProvider, { propType, value, setValue, isDisabled }, /* @__PURE__ */ React22.createElement(PropKeyProvider, { bind }, children));
@@ -5035,6 +5040,10 @@ var useActions = () => {
5035
5040
  items: items3,
5036
5041
  tabContentAreaId
5037
5042
  }) => {
5043
+ const newDefault = calculateDefaultOnDuplicate({
5044
+ items: items3,
5045
+ defaultActiveTab
5046
+ });
5038
5047
  items3.forEach(({ item, index }) => {
5039
5048
  const tabId = item.id;
5040
5049
  const tabContentAreaContainer = getContainer2(tabContentAreaId);
@@ -5044,7 +5053,17 @@ var useActions = () => {
5044
5053
  }
5045
5054
  duplicateElements({
5046
5055
  elementIds: [tabId, tabContentId],
5047
- title: __58("Duplicate Tab", "elementor")
5056
+ title: __58("Duplicate Tab", "elementor"),
5057
+ onDuplicateElements: () => {
5058
+ if (newDefault !== defaultActiveTab) {
5059
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
5060
+ }
5061
+ },
5062
+ onRestoreElements: () => {
5063
+ if (newDefault !== defaultActiveTab) {
5064
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
5065
+ }
5066
+ }
5048
5067
  });
5049
5068
  });
5050
5069
  };
@@ -5081,12 +5100,12 @@ var useActions = () => {
5081
5100
  ],
5082
5101
  onMoveElements: () => {
5083
5102
  if (newDefault !== defaultActiveTab) {
5084
- setDefaultActiveTab(newDefault);
5103
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
5085
5104
  }
5086
5105
  },
5087
5106
  onRestoreElements: () => {
5088
5107
  if (newDefault !== defaultActiveTab) {
5089
- setDefaultActiveTab(defaultActiveTab);
5108
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
5090
5109
  }
5091
5110
  }
5092
5111
  });
@@ -5112,12 +5131,12 @@ var useActions = () => {
5112
5131
  }),
5113
5132
  onRemoveElements: () => {
5114
5133
  if (newDefault !== defaultActiveTab) {
5115
- setDefaultActiveTab(newDefault);
5134
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
5116
5135
  }
5117
5136
  },
5118
5137
  onRestoreElements: () => {
5119
5138
  if (newDefault !== defaultActiveTab) {
5120
- setDefaultActiveTab(defaultActiveTab);
5139
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
5121
5140
  }
5122
5141
  }
5123
5142
  });
@@ -5184,6 +5203,16 @@ var calculateDefaultOnRemove = ({
5184
5203
  const defaultGap = items3.reduce((acc, { index }) => index < defaultActiveTab ? acc + 1 : acc, 0);
5185
5204
  return defaultActiveTab - defaultGap;
5186
5205
  };
5206
+ var calculateDefaultOnDuplicate = ({
5207
+ items: items3,
5208
+ defaultActiveTab
5209
+ }) => {
5210
+ const duplicatesBefore = items3.reduce((acc, { index }) => {
5211
+ const isDuplicatedBeforeDefault = index < defaultActiveTab;
5212
+ return isDuplicatedBeforeDefault ? acc + 1 : acc;
5213
+ }, 0);
5214
+ return defaultActiveTab + duplicatesBefore;
5215
+ };
5187
5216
 
5188
5217
  // src/controls-registry/element-controls/tabs-control/tabs-control.tsx
5189
5218
  var TAB_MENU_ELEMENT_TYPE = "e-tabs-menu";