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

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
@@ -2325,10 +2325,15 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
2325
2325
  elementId,
2326
2326
  propDisplayName
2327
2327
  });
2328
- const setValue = (newValue) => {
2328
+ const setValue = (newValue, _ = {}, meta) => {
2329
+ const { withHistory = true } = meta ?? {};
2329
2330
  const dependents = extractOrderedDependencies(dependenciesPerTargetMapping);
2330
2331
  const settings = getUpdatedValues(newValue, dependents, propsSchema, migratedValues, elementId);
2331
- undoableUpdateElementProp(settings);
2332
+ if (withHistory) {
2333
+ undoableUpdateElementProp(settings);
2334
+ } else {
2335
+ (0, import_editor_elements7.updateElementSettings)({ id: elementId, props: settings, withHistory: false });
2336
+ }
2332
2337
  };
2333
2338
  const isDisabled = (prop) => !(0, import_editor_props6.isDependencyMet)(prop?.dependencies, migratedValues).isMet;
2334
2339
  return /* @__PURE__ */ React22.createElement(import_editor_controls4.PropProvider, { propType, value, setValue, isDisabled }, /* @__PURE__ */ React22.createElement(import_editor_controls4.PropKeyProvider, { bind }, children));
@@ -4959,6 +4964,10 @@ var useActions = () => {
4959
4964
  items: items3,
4960
4965
  tabContentAreaId
4961
4966
  }) => {
4967
+ const newDefault = calculateDefaultOnDuplicate({
4968
+ items: items3,
4969
+ defaultActiveTab
4970
+ });
4962
4971
  items3.forEach(({ item, index }) => {
4963
4972
  const tabId = item.id;
4964
4973
  const tabContentAreaContainer = (0, import_editor_elements16.getContainer)(tabContentAreaId);
@@ -4968,7 +4977,17 @@ var useActions = () => {
4968
4977
  }
4969
4978
  (0, import_editor_elements16.duplicateElements)({
4970
4979
  elementIds: [tabId, tabContentId],
4971
- title: (0, import_i18n58.__)("Duplicate Tab", "elementor")
4980
+ title: (0, import_i18n58.__)("Duplicate Tab", "elementor"),
4981
+ onDuplicateElements: () => {
4982
+ if (newDefault !== defaultActiveTab) {
4983
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
4984
+ }
4985
+ },
4986
+ onRestoreElements: () => {
4987
+ if (newDefault !== defaultActiveTab) {
4988
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
4989
+ }
4990
+ }
4972
4991
  });
4973
4992
  });
4974
4993
  };
@@ -5005,12 +5024,12 @@ var useActions = () => {
5005
5024
  ],
5006
5025
  onMoveElements: () => {
5007
5026
  if (newDefault !== defaultActiveTab) {
5008
- setDefaultActiveTab(newDefault);
5027
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
5009
5028
  }
5010
5029
  },
5011
5030
  onRestoreElements: () => {
5012
5031
  if (newDefault !== defaultActiveTab) {
5013
- setDefaultActiveTab(defaultActiveTab);
5032
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
5014
5033
  }
5015
5034
  }
5016
5035
  });
@@ -5036,12 +5055,12 @@ var useActions = () => {
5036
5055
  }),
5037
5056
  onRemoveElements: () => {
5038
5057
  if (newDefault !== defaultActiveTab) {
5039
- setDefaultActiveTab(newDefault);
5058
+ setDefaultActiveTab(newDefault, {}, { withHistory: false });
5040
5059
  }
5041
5060
  },
5042
5061
  onRestoreElements: () => {
5043
5062
  if (newDefault !== defaultActiveTab) {
5044
- setDefaultActiveTab(defaultActiveTab);
5063
+ setDefaultActiveTab(defaultActiveTab, {}, { withHistory: false });
5045
5064
  }
5046
5065
  }
5047
5066
  });
@@ -5108,6 +5127,16 @@ var calculateDefaultOnRemove = ({
5108
5127
  const defaultGap = items3.reduce((acc, { index }) => index < defaultActiveTab ? acc + 1 : acc, 0);
5109
5128
  return defaultActiveTab - defaultGap;
5110
5129
  };
5130
+ var calculateDefaultOnDuplicate = ({
5131
+ items: items3,
5132
+ defaultActiveTab
5133
+ }) => {
5134
+ const duplicatesBefore = items3.reduce((acc, { index }) => {
5135
+ const isDuplicatedBeforeDefault = index < defaultActiveTab;
5136
+ return isDuplicatedBeforeDefault ? acc + 1 : acc;
5137
+ }, 0);
5138
+ return defaultActiveTab + duplicatesBefore;
5139
+ };
5111
5140
 
5112
5141
  // src/controls-registry/element-controls/tabs-control/tabs-control.tsx
5113
5142
  var TAB_MENU_ELEMENT_TYPE = "e-tabs-menu";