@elementor/editor-editing-panel 3.33.0-187 → 3.33.0-189
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 +477 -450
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +466 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -19
- package/src/controls-registry/controls-registry.tsx +1 -5
- package/src/controls-registry/element-controls/registry.ts +16 -0
- package/src/controls-registry/element-controls/tabs-control/tabs-control.tsx +89 -88
- package/src/init.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -4716,30 +4716,148 @@ var controlActionsMenu = (0, import_menus.createMenu)({
|
|
|
4716
4716
|
});
|
|
4717
4717
|
|
|
4718
4718
|
// src/controls-registry/controls-registry.tsx
|
|
4719
|
-
var
|
|
4720
|
-
var
|
|
4719
|
+
var import_editor_controls50 = require("@elementor/editor-controls");
|
|
4720
|
+
var import_editor_props13 = require("@elementor/editor-props");
|
|
4721
|
+
var controlTypes = {
|
|
4722
|
+
image: { component: import_editor_controls50.ImageControl, layout: "full", propTypeUtil: import_editor_props13.imagePropTypeUtil },
|
|
4723
|
+
"svg-media": { component: import_editor_controls50.SvgMediaControl, layout: "full", propTypeUtil: import_editor_props13.imageSrcPropTypeUtil },
|
|
4724
|
+
text: { component: import_editor_controls50.TextControl, layout: "full", propTypeUtil: import_editor_props13.stringPropTypeUtil },
|
|
4725
|
+
textarea: { component: import_editor_controls50.TextAreaControl, layout: "full", propTypeUtil: import_editor_props13.stringPropTypeUtil },
|
|
4726
|
+
size: { component: import_editor_controls50.SizeControl, layout: "two-columns", propTypeUtil: import_editor_props13.sizePropTypeUtil },
|
|
4727
|
+
select: { component: import_editor_controls50.SelectControlWrapper, layout: "two-columns", propTypeUtil: import_editor_props13.stringPropTypeUtil },
|
|
4728
|
+
link: { component: import_editor_controls50.LinkControl, layout: "custom", propTypeUtil: import_editor_props13.linkPropTypeUtil },
|
|
4729
|
+
query: { component: import_editor_controls50.QueryControl, layout: "full", propTypeUtil: import_editor_props13.queryPropTypeUtil },
|
|
4730
|
+
url: { component: import_editor_controls50.UrlControl, layout: "full", propTypeUtil: import_editor_props13.stringPropTypeUtil },
|
|
4731
|
+
switch: { component: import_editor_controls50.SwitchControl, layout: "two-columns", propTypeUtil: import_editor_props13.booleanPropTypeUtil },
|
|
4732
|
+
number: { component: import_editor_controls50.NumberControl, layout: "two-columns", propTypeUtil: import_editor_props13.numberPropTypeUtil },
|
|
4733
|
+
repeatable: { component: import_editor_controls50.RepeatableControl, layout: "full", propTypeUtil: void 0 },
|
|
4734
|
+
"key-value": { component: import_editor_controls50.KeyValueControl, layout: "full", propTypeUtil: import_editor_props13.keyValuePropTypeUtil },
|
|
4735
|
+
"html-tag": { component: import_editor_controls50.HtmlTagControl, layout: "two-columns", propTypeUtil: import_editor_props13.stringPropTypeUtil },
|
|
4736
|
+
toggle: { component: import_editor_controls50.ToggleControl, layout: "full", propTypeUtil: import_editor_props13.stringPropTypeUtil }
|
|
4737
|
+
};
|
|
4738
|
+
var ControlsRegistry = class {
|
|
4739
|
+
constructor(controlsRegistry2) {
|
|
4740
|
+
this.controlsRegistry = controlsRegistry2;
|
|
4741
|
+
this.controlsRegistry = controlsRegistry2;
|
|
4742
|
+
}
|
|
4743
|
+
get(type) {
|
|
4744
|
+
return this.controlsRegistry[type]?.component;
|
|
4745
|
+
}
|
|
4746
|
+
getLayout(type) {
|
|
4747
|
+
return this.controlsRegistry[type]?.layout;
|
|
4748
|
+
}
|
|
4749
|
+
getPropTypeUtil(type) {
|
|
4750
|
+
return this.controlsRegistry[type]?.propTypeUtil;
|
|
4751
|
+
}
|
|
4752
|
+
registry() {
|
|
4753
|
+
return this.controlsRegistry;
|
|
4754
|
+
}
|
|
4755
|
+
register(type, component, layout, propTypeUtil) {
|
|
4756
|
+
if (this.controlsRegistry[type]) {
|
|
4757
|
+
throw new ControlTypeAlreadyRegisteredError({ context: { controlType: type } });
|
|
4758
|
+
}
|
|
4759
|
+
this.controlsRegistry[type] = { component, layout, propTypeUtil };
|
|
4760
|
+
}
|
|
4761
|
+
unregister(type) {
|
|
4762
|
+
if (!this.controlsRegistry[type]) {
|
|
4763
|
+
throw new ControlTypeNotRegisteredError({ context: { controlType: type } });
|
|
4764
|
+
}
|
|
4765
|
+
delete this.controlsRegistry[type];
|
|
4766
|
+
}
|
|
4767
|
+
};
|
|
4768
|
+
var controlsRegistry = new ControlsRegistry(controlTypes);
|
|
4721
4769
|
|
|
4722
|
-
// src/
|
|
4723
|
-
var
|
|
4724
|
-
var
|
|
4725
|
-
var
|
|
4726
|
-
|
|
4770
|
+
// src/init.ts
|
|
4771
|
+
var import_editor = require("@elementor/editor");
|
|
4772
|
+
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
4773
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
4774
|
+
|
|
4775
|
+
// src/hooks/use-open-editor-panel.ts
|
|
4776
|
+
var import_react39 = require("react");
|
|
4777
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
4778
|
+
|
|
4779
|
+
// src/panel.ts
|
|
4780
|
+
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
4781
|
+
|
|
4782
|
+
// src/components/editing-panel.tsx
|
|
4783
|
+
var React90 = __toESM(require("react"));
|
|
4784
|
+
var import_editor_controls53 = require("@elementor/editor-controls");
|
|
4785
|
+
var import_editor_elements13 = require("@elementor/editor-elements");
|
|
4786
|
+
var import_editor_panels = require("@elementor/editor-panels");
|
|
4787
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
4727
4788
|
var import_icons24 = require("@elementor/icons");
|
|
4728
|
-
var
|
|
4789
|
+
var import_session8 = require("@elementor/session");
|
|
4790
|
+
var import_ui45 = require("@elementor/ui");
|
|
4729
4791
|
var import_i18n62 = require("@wordpress/i18n");
|
|
4730
4792
|
|
|
4731
|
-
// src/
|
|
4793
|
+
// src/components/editing-panel-error-fallback.tsx
|
|
4732
4794
|
var React84 = __toESM(require("react"));
|
|
4795
|
+
var import_ui41 = require("@elementor/ui");
|
|
4796
|
+
function EditorPanelErrorFallback() {
|
|
4797
|
+
return /* @__PURE__ */ React84.createElement(import_ui41.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React84.createElement(import_ui41.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React84.createElement("strong", null, "Something went wrong")));
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
// src/components/editing-panel-tabs.tsx
|
|
4801
|
+
var React89 = __toESM(require("react"));
|
|
4802
|
+
var import_react38 = require("react");
|
|
4803
|
+
var import_ui44 = require("@elementor/ui");
|
|
4804
|
+
var import_i18n61 = require("@wordpress/i18n");
|
|
4805
|
+
|
|
4806
|
+
// src/components/settings-tab.tsx
|
|
4807
|
+
var React88 = __toESM(require("react"));
|
|
4808
|
+
var import_editor_controls52 = require("@elementor/editor-controls");
|
|
4809
|
+
var import_session7 = require("@elementor/session");
|
|
4810
|
+
var import_ui43 = require("@elementor/ui");
|
|
4811
|
+
|
|
4812
|
+
// src/controls-registry/control.tsx
|
|
4813
|
+
var React85 = __toESM(require("react"));
|
|
4814
|
+
var Control = ({ props, type }) => {
|
|
4815
|
+
const ControlByType = controlsRegistry.get(type);
|
|
4816
|
+
const { element } = useElement();
|
|
4817
|
+
if (!ControlByType) {
|
|
4818
|
+
throw new ControlTypeNotFoundError({
|
|
4819
|
+
context: { controlType: type }
|
|
4820
|
+
});
|
|
4821
|
+
}
|
|
4822
|
+
return /* @__PURE__ */ React85.createElement(ControlByType, { ...props, context: { elementId: element.id } });
|
|
4823
|
+
};
|
|
4824
|
+
|
|
4825
|
+
// src/controls-registry/control-type-container.tsx
|
|
4826
|
+
var React86 = __toESM(require("react"));
|
|
4827
|
+
var import_ui42 = require("@elementor/ui");
|
|
4828
|
+
var ControlTypeContainer = ({ children, layout }) => {
|
|
4829
|
+
if (layout === "custom") {
|
|
4830
|
+
return children;
|
|
4831
|
+
}
|
|
4832
|
+
return /* @__PURE__ */ React86.createElement(StyledContainer, { layout }, children);
|
|
4833
|
+
};
|
|
4834
|
+
var StyledContainer = (0, import_ui42.styled)(import_ui42.Box, {
|
|
4835
|
+
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
4836
|
+
})(({ layout, theme }) => ({
|
|
4837
|
+
display: "grid",
|
|
4838
|
+
gridGap: theme.spacing(1),
|
|
4839
|
+
...getGridLayout(layout)
|
|
4840
|
+
}));
|
|
4841
|
+
var getGridLayout = (layout) => ({
|
|
4842
|
+
justifyContent: "space-between",
|
|
4843
|
+
gridTemplateColumns: {
|
|
4844
|
+
full: "minmax(0, 1fr)",
|
|
4845
|
+
"two-columns": "repeat(2, minmax(0, 1fr))"
|
|
4846
|
+
}[layout]
|
|
4847
|
+
});
|
|
4848
|
+
|
|
4849
|
+
// src/controls-registry/settings-field.tsx
|
|
4850
|
+
var React87 = __toESM(require("react"));
|
|
4733
4851
|
var import_react37 = require("react");
|
|
4734
|
-
var
|
|
4852
|
+
var import_editor_controls51 = require("@elementor/editor-controls");
|
|
4735
4853
|
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
4736
4854
|
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
4737
|
-
var
|
|
4855
|
+
var import_editor_props15 = require("@elementor/editor-props");
|
|
4738
4856
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
4739
4857
|
var import_i18n60 = require("@wordpress/i18n");
|
|
4740
4858
|
|
|
4741
4859
|
// src/utils/prop-dependency-utils.ts
|
|
4742
|
-
var
|
|
4860
|
+
var import_editor_props14 = require("@elementor/editor-props");
|
|
4743
4861
|
var import_session6 = require("@elementor/session");
|
|
4744
4862
|
function extractOrderedDependencies(bind, propsSchema, elementValues, dependenciesPerTargetMapping) {
|
|
4745
4863
|
const prop = getPropType(propsSchema, elementValues, bind.split("."));
|
|
@@ -4788,8 +4906,8 @@ function getUpdatedValues(values, dependencies, propsSchema, elementValues, elem
|
|
|
4788
4906
|
return newValues;
|
|
4789
4907
|
}
|
|
4790
4908
|
const testDependencies = {
|
|
4791
|
-
previousValues: (0,
|
|
4792
|
-
newValues: (0,
|
|
4909
|
+
previousValues: (0, import_editor_props14.isDependencyMet)(propType.dependencies, elementValues),
|
|
4910
|
+
newValues: (0, import_editor_props14.isDependencyMet)(propType.dependencies, combinedValues)
|
|
4793
4911
|
};
|
|
4794
4912
|
if (!testDependencies.newValues.isMet) {
|
|
4795
4913
|
const newValue = handleUnmetCondition({
|
|
@@ -4839,7 +4957,7 @@ function evaluatePropType(props) {
|
|
|
4839
4957
|
const { key, index, path, elementValues, basePropKey } = props;
|
|
4840
4958
|
switch (prop.kind) {
|
|
4841
4959
|
case "union":
|
|
4842
|
-
const value = (0,
|
|
4960
|
+
const value = (0, import_editor_props14.extractValue)(path.slice(0, index + 1), elementValues);
|
|
4843
4961
|
const type = value?.$$type ?? null;
|
|
4844
4962
|
return getPropType(
|
|
4845
4963
|
{ [basePropKey]: prop.prop_types?.[type] },
|
|
@@ -4871,7 +4989,7 @@ function updateValue(path, value, values) {
|
|
|
4871
4989
|
function handleUnmetCondition(props) {
|
|
4872
4990
|
const { failingDependencies, dependency, elementValues, defaultValue, elementId } = props;
|
|
4873
4991
|
const newValue = failingDependencies.find((term) => term.newValue)?.newValue ?? null;
|
|
4874
|
-
const currentValue = (0,
|
|
4992
|
+
const currentValue = (0, import_editor_props14.extractValue)(dependency.split("."), elementValues) ?? defaultValue;
|
|
4875
4993
|
savePreviousValueToStorage({
|
|
4876
4994
|
path: dependency,
|
|
4877
4995
|
elementId,
|
|
@@ -4923,8 +5041,8 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
|
|
|
4923
5041
|
const settings = getUpdatedValues(newValue, dependents, propsSchema, elementSettingValues, elementId);
|
|
4924
5042
|
undoableUpdateElementProp(settings);
|
|
4925
5043
|
};
|
|
4926
|
-
const isDisabled = (prop) => !(0,
|
|
4927
|
-
return /* @__PURE__ */
|
|
5044
|
+
const isDisabled = (prop) => !(0, import_editor_props15.isDependencyMet)(prop?.dependencies, elementSettingValues).isMet;
|
|
5045
|
+
return /* @__PURE__ */ React87.createElement(import_editor_controls51.PropProvider, { propType, value, setValue, isDisabled }, /* @__PURE__ */ React87.createElement(import_editor_controls51.PropKeyProvider, { bind }, children));
|
|
4928
5046
|
};
|
|
4929
5047
|
function useUndoableUpdateElementProp({
|
|
4930
5048
|
elementId,
|
|
@@ -4953,119 +5071,282 @@ function useUndoableUpdateElementProp({
|
|
|
4953
5071
|
}, [elementId, propDisplayName]);
|
|
4954
5072
|
}
|
|
4955
5073
|
|
|
4956
|
-
// src/
|
|
4957
|
-
var
|
|
4958
|
-
|
|
4959
|
-
const
|
|
4960
|
-
|
|
4961
|
-
|
|
5074
|
+
// src/components/settings-tab.tsx
|
|
5075
|
+
var SettingsTab = () => {
|
|
5076
|
+
const { elementType, element } = useElement();
|
|
5077
|
+
const settingsDefault = useDefaultPanelSettings();
|
|
5078
|
+
const isDefaultExpanded = (sectionId) => settingsDefault.defaultSectionsExpanded.settings?.includes(sectionId);
|
|
5079
|
+
return /* @__PURE__ */ React88.createElement(import_session7.SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React88.createElement(SectionsList, null, elementType.controls.map((control, index) => {
|
|
5080
|
+
if (isControl(control)) {
|
|
5081
|
+
return /* @__PURE__ */ React88.createElement(Control2, { key: getKey(control, element), control });
|
|
5082
|
+
}
|
|
5083
|
+
const { type, value } = control;
|
|
5084
|
+
if (type === "section") {
|
|
5085
|
+
return /* @__PURE__ */ React88.createElement(
|
|
5086
|
+
Section,
|
|
5087
|
+
{
|
|
5088
|
+
title: value.label,
|
|
5089
|
+
key: type + "." + index,
|
|
5090
|
+
defaultExpanded: isDefaultExpanded(value.label)
|
|
5091
|
+
},
|
|
5092
|
+
value.items?.map((item) => {
|
|
5093
|
+
if (isControl(item)) {
|
|
5094
|
+
return /* @__PURE__ */ React88.createElement(Control2, { key: getKey(item, element), control: item });
|
|
5095
|
+
}
|
|
5096
|
+
return null;
|
|
5097
|
+
})
|
|
5098
|
+
);
|
|
5099
|
+
}
|
|
5100
|
+
return null;
|
|
5101
|
+
})));
|
|
5102
|
+
};
|
|
5103
|
+
var Control2 = ({ control: { value, type } }) => {
|
|
5104
|
+
if (!controlsRegistry.get(value.type)) {
|
|
5105
|
+
return null;
|
|
4962
5106
|
}
|
|
4963
|
-
|
|
4964
|
-
|
|
5107
|
+
const layout = value.meta?.layout || controlsRegistry.getLayout(value.type);
|
|
5108
|
+
const controlProps = populateChildControlProps(value.props);
|
|
5109
|
+
if (layout === "custom") {
|
|
5110
|
+
controlProps.label = value.label;
|
|
4965
5111
|
}
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
throw new Error(`Child element ${type} not found`);
|
|
5112
|
+
if (type === "element-control") {
|
|
5113
|
+
return /* @__PURE__ */ React88.createElement(ControlLayout, { control: value, layout, controlProps });
|
|
4969
5114
|
}
|
|
4970
|
-
return
|
|
4971
|
-
};
|
|
4972
|
-
|
|
4973
|
-
// src/controls-registry/element-controls/tabs-control/actions.ts
|
|
4974
|
-
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
4975
|
-
var import_editor_props15 = require("@elementor/editor-props");
|
|
4976
|
-
var import_i18n61 = require("@wordpress/i18n");
|
|
4977
|
-
var TAB_ELEMENT_TYPE = "e-tab";
|
|
4978
|
-
var TAB_PANEL_ELEMENT_TYPE = "e-tab-panel";
|
|
4979
|
-
var duplicateItem = ({ items: items3 }) => {
|
|
4980
|
-
items3.forEach(({ item }) => {
|
|
4981
|
-
const tabId = item.id;
|
|
4982
|
-
const { value: tabPanelId } = (0, import_editor_elements14.getElementSetting)(tabId, "tab-panel-id") ?? {};
|
|
4983
|
-
if (!tabPanelId) {
|
|
4984
|
-
throw new Error("Original panel ID is required for duplication");
|
|
4985
|
-
}
|
|
4986
|
-
(0, import_editor_elements14.duplicateElements)({
|
|
4987
|
-
elementIds: [tabId, tabPanelId],
|
|
4988
|
-
title: (0, import_i18n61.__)("Duplicate Tab", "elementor"),
|
|
4989
|
-
onCreate: (duplicatedElements) => {
|
|
4990
|
-
const tab = duplicatedElements.find((element) => element.originalElementId === tabId);
|
|
4991
|
-
const tabPanel = duplicatedElements.find((element) => element.originalElementId === tabPanelId);
|
|
4992
|
-
if (tabPanel && tab) {
|
|
4993
|
-
(0, import_editor_elements14.updateElementSettings)({
|
|
4994
|
-
withHistory: false,
|
|
4995
|
-
id: tab.id,
|
|
4996
|
-
props: {
|
|
4997
|
-
"tab-panel-id": import_editor_props15.stringPropTypeUtil.create(tabPanel.id)
|
|
4998
|
-
}
|
|
4999
|
-
});
|
|
5000
|
-
(0, import_editor_elements14.updateElementSettings)({
|
|
5001
|
-
withHistory: false,
|
|
5002
|
-
id: tabPanel.id,
|
|
5003
|
-
props: {
|
|
5004
|
-
"tab-id": import_editor_props15.stringPropTypeUtil.create(tab.id)
|
|
5005
|
-
}
|
|
5006
|
-
});
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
});
|
|
5010
|
-
});
|
|
5115
|
+
return /* @__PURE__ */ React88.createElement(SettingsField, { bind: value.bind, propDisplayName: value.label || value.bind }, /* @__PURE__ */ React88.createElement(ControlLayout, { control: value, layout, controlProps }));
|
|
5011
5116
|
};
|
|
5012
|
-
var
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
movedElementId
|
|
5117
|
+
var ControlLayout = ({
|
|
5118
|
+
control,
|
|
5119
|
+
layout,
|
|
5120
|
+
controlProps
|
|
5017
5121
|
}) => {
|
|
5018
|
-
|
|
5019
|
-
if (!tabPanelId) {
|
|
5020
|
-
throw new Error("Required tab elements not found for reordering");
|
|
5021
|
-
}
|
|
5022
|
-
(0, import_editor_elements14.moveElements)({
|
|
5023
|
-
title: (0, import_i18n61.__)("Reorder Tabs", "elementor"),
|
|
5024
|
-
moves: [
|
|
5025
|
-
{
|
|
5026
|
-
elementId: movedElementId,
|
|
5027
|
-
targetContainerId: tabListId,
|
|
5028
|
-
options: { at: toIndex }
|
|
5029
|
-
},
|
|
5030
|
-
{
|
|
5031
|
-
elementId: tabPanelId,
|
|
5032
|
-
targetContainerId: tabContentId,
|
|
5033
|
-
options: { at: toIndex }
|
|
5034
|
-
}
|
|
5035
|
-
]
|
|
5036
|
-
});
|
|
5122
|
+
return /* @__PURE__ */ React88.createElement(React88.Fragment, null, control.meta?.topDivider && /* @__PURE__ */ React88.createElement(import_ui43.Divider, null), /* @__PURE__ */ React88.createElement(ControlTypeContainer, { layout }, control.label && layout !== "custom" ? /* @__PURE__ */ React88.createElement(import_editor_controls52.ControlFormLabel, null, control.label) : null, /* @__PURE__ */ React88.createElement(Control, { type: control.type, props: controlProps })));
|
|
5037
5123
|
};
|
|
5038
|
-
|
|
5039
|
-
(
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5124
|
+
function populateChildControlProps(props) {
|
|
5125
|
+
if (props.childControlType) {
|
|
5126
|
+
const childComponent = controlsRegistry.get(props.childControlType);
|
|
5127
|
+
const childPropType = controlsRegistry.getPropTypeUtil(props.childControlType);
|
|
5128
|
+
props = {
|
|
5129
|
+
...props,
|
|
5130
|
+
childControlConfig: {
|
|
5131
|
+
component: childComponent,
|
|
5132
|
+
props: props.childControlProps || {},
|
|
5133
|
+
propTypeUtil: childPropType
|
|
5046
5134
|
}
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
}
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5135
|
+
};
|
|
5136
|
+
}
|
|
5137
|
+
return props;
|
|
5138
|
+
}
|
|
5139
|
+
function getKey(control, element) {
|
|
5140
|
+
if (control.type === "control") {
|
|
5141
|
+
return control.value.bind + "." + element.id;
|
|
5142
|
+
}
|
|
5143
|
+
return control.value.type + "." + element.id;
|
|
5144
|
+
}
|
|
5145
|
+
function isControl(control) {
|
|
5146
|
+
return control.type === "control" || control.type === "element-control";
|
|
5147
|
+
}
|
|
5148
|
+
|
|
5149
|
+
// src/components/editing-panel-tabs.tsx
|
|
5150
|
+
var EditingPanelTabs = () => {
|
|
5151
|
+
const { element } = useElement();
|
|
5152
|
+
return (
|
|
5153
|
+
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
5154
|
+
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
5155
|
+
/* @__PURE__ */ React89.createElement(import_react38.Fragment, { key: element.id }, /* @__PURE__ */ React89.createElement(PanelTabContent, null))
|
|
5156
|
+
);
|
|
5157
|
+
};
|
|
5158
|
+
var PanelTabContent = () => {
|
|
5159
|
+
const editorDefaults = useDefaultPanelSettings();
|
|
5160
|
+
const defaultComponentTab = editorDefaults.defaultTab;
|
|
5161
|
+
const [currentTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
5162
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui44.useTabs)(currentTab);
|
|
5163
|
+
return /* @__PURE__ */ React89.createElement(ScrollProvider, null, /* @__PURE__ */ React89.createElement(import_ui44.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React89.createElement(import_ui44.Stack, { sx: { ...stickyHeaderStyles, top: 0 } }, /* @__PURE__ */ React89.createElement(
|
|
5164
|
+
import_ui44.Tabs,
|
|
5165
|
+
{
|
|
5166
|
+
variant: "fullWidth",
|
|
5167
|
+
size: "small",
|
|
5168
|
+
sx: { mt: 0.5 },
|
|
5169
|
+
...getTabsProps(),
|
|
5170
|
+
onChange: (_, newValue) => {
|
|
5171
|
+
getTabsProps().onChange(_, newValue);
|
|
5172
|
+
setCurrentTab(newValue);
|
|
5173
|
+
}
|
|
5174
|
+
},
|
|
5175
|
+
/* @__PURE__ */ React89.createElement(import_ui44.Tab, { label: (0, import_i18n61.__)("General", "elementor"), ...getTabProps("settings") }),
|
|
5176
|
+
/* @__PURE__ */ React89.createElement(import_ui44.Tab, { label: (0, import_i18n61.__)("Style", "elementor"), ...getTabProps("style") })
|
|
5177
|
+
), /* @__PURE__ */ React89.createElement(import_ui44.Divider, null)), /* @__PURE__ */ React89.createElement(import_ui44.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React89.createElement(SettingsTab, null)), /* @__PURE__ */ React89.createElement(import_ui44.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React89.createElement(StyleTab, null))));
|
|
5178
|
+
};
|
|
5179
|
+
|
|
5180
|
+
// src/components/editing-panel.tsx
|
|
5181
|
+
var { useMenuItems } = controlActionsMenu;
|
|
5182
|
+
var EditingPanel = () => {
|
|
5183
|
+
const { element, elementType } = (0, import_editor_elements13.useSelectedElement)();
|
|
5184
|
+
const controlReplacements = getControlReplacements();
|
|
5185
|
+
const menuItems = useMenuItems().default;
|
|
5186
|
+
if (!element || !elementType) {
|
|
5187
|
+
return null;
|
|
5188
|
+
}
|
|
5189
|
+
const panelTitle = (0, import_i18n62.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
5190
|
+
return /* @__PURE__ */ React90.createElement(import_ui45.ErrorBoundary, { fallback: /* @__PURE__ */ React90.createElement(EditorPanelErrorFallback, null) }, /* @__PURE__ */ React90.createElement(import_session8.SessionStorageProvider, { prefix: "elementor" }, /* @__PURE__ */ React90.createElement(import_editor_ui6.ThemeProvider, null, /* @__PURE__ */ React90.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React90.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React90.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle), /* @__PURE__ */ React90.createElement(import_icons24.AtomIcon, { fontSize: "small", sx: { color: "text.tertiary" } })), /* @__PURE__ */ React90.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React90.createElement(import_editor_controls53.ControlActionsProvider, { items: menuItems }, /* @__PURE__ */ React90.createElement(import_editor_controls53.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React90.createElement(ElementProvider, { element, elementType }, /* @__PURE__ */ React90.createElement(EditingPanelTabs, null)))))))));
|
|
5191
|
+
};
|
|
5192
|
+
|
|
5193
|
+
// src/panel.ts
|
|
5194
|
+
var { panel, usePanelActions, usePanelStatus } = (0, import_editor_panels2.__createPanel)({
|
|
5195
|
+
id: "editing-panel",
|
|
5196
|
+
component: EditingPanel
|
|
5197
|
+
});
|
|
5198
|
+
|
|
5199
|
+
// src/sync/is-atomic-widget-selected.ts
|
|
5200
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
5201
|
+
var isAtomicWidgetSelected = () => {
|
|
5202
|
+
const selectedElements = (0, import_editor_elements14.getSelectedElements)();
|
|
5203
|
+
const widgetCache = (0, import_editor_elements14.getWidgetsCache)();
|
|
5204
|
+
if (selectedElements.length !== 1) {
|
|
5205
|
+
return false;
|
|
5206
|
+
}
|
|
5207
|
+
return !!widgetCache?.[selectedElements[0].type]?.atomic_controls;
|
|
5208
|
+
};
|
|
5209
|
+
|
|
5210
|
+
// src/hooks/use-open-editor-panel.ts
|
|
5211
|
+
var useOpenEditorPanel = () => {
|
|
5212
|
+
const { open } = usePanelActions();
|
|
5213
|
+
(0, import_react39.useEffect)(() => {
|
|
5214
|
+
return (0, import_editor_v1_adapters6.__privateListenTo)((0, import_editor_v1_adapters6.commandStartEvent)("panel/editor/open"), () => {
|
|
5215
|
+
if (isAtomicWidgetSelected()) {
|
|
5216
|
+
open();
|
|
5217
|
+
}
|
|
5218
|
+
});
|
|
5219
|
+
}, []);
|
|
5220
|
+
};
|
|
5221
|
+
|
|
5222
|
+
// src/components/editing-panel-hooks.tsx
|
|
5223
|
+
var EditingPanelHooks = () => {
|
|
5224
|
+
useOpenEditorPanel();
|
|
5225
|
+
return null;
|
|
5226
|
+
};
|
|
5227
|
+
|
|
5228
|
+
// src/controls-registry/element-controls/tabs-control/tabs-control.tsx
|
|
5229
|
+
var React91 = __toESM(require("react"));
|
|
5230
|
+
var import_editor_controls54 = require("@elementor/editor-controls");
|
|
5231
|
+
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
5232
|
+
var import_editor_props17 = require("@elementor/editor-props");
|
|
5233
|
+
var import_icons25 = require("@elementor/icons");
|
|
5234
|
+
var import_ui46 = require("@elementor/ui");
|
|
5235
|
+
var import_i18n64 = require("@wordpress/i18n");
|
|
5236
|
+
|
|
5237
|
+
// src/controls-registry/element-controls/get-element-by-type.ts
|
|
5238
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
5239
|
+
var getElementByType = (elementId, type) => {
|
|
5240
|
+
const currentElement = (0, import_editor_elements15.getContainer)(elementId);
|
|
5241
|
+
if (!currentElement) {
|
|
5242
|
+
throw new Error(`Current element not found, elementId: ${elementId}`);
|
|
5243
|
+
}
|
|
5244
|
+
if (currentElement.model.get("elType") === type) {
|
|
5245
|
+
return currentElement;
|
|
5246
|
+
}
|
|
5247
|
+
const element = currentElement.children?.findRecursive?.((child) => child.model.get("elType") === type);
|
|
5248
|
+
if (!element) {
|
|
5249
|
+
throw new Error(`Child element ${type} not found`);
|
|
5250
|
+
}
|
|
5251
|
+
return element;
|
|
5252
|
+
};
|
|
5253
|
+
|
|
5254
|
+
// src/controls-registry/element-controls/tabs-control/actions.ts
|
|
5255
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
5256
|
+
var import_editor_props16 = require("@elementor/editor-props");
|
|
5257
|
+
var import_i18n63 = require("@wordpress/i18n");
|
|
5258
|
+
var TAB_ELEMENT_TYPE = "e-tab";
|
|
5259
|
+
var TAB_PANEL_ELEMENT_TYPE = "e-tab-panel";
|
|
5260
|
+
var duplicateItem = ({ items: items3 }) => {
|
|
5261
|
+
items3.forEach(({ item }) => {
|
|
5262
|
+
const tabId = item.id;
|
|
5263
|
+
const { value: tabPanelId } = (0, import_editor_elements16.getElementSetting)(tabId, "tab-panel-id") ?? {};
|
|
5264
|
+
if (!tabPanelId) {
|
|
5265
|
+
throw new Error("Original panel ID is required for duplication");
|
|
5266
|
+
}
|
|
5267
|
+
(0, import_editor_elements16.duplicateElements)({
|
|
5268
|
+
elementIds: [tabId, tabPanelId],
|
|
5269
|
+
title: (0, import_i18n63.__)("Duplicate Tab", "elementor"),
|
|
5270
|
+
onCreate: (duplicatedElements) => {
|
|
5271
|
+
const tab = duplicatedElements.find((element) => element.originalElementId === tabId);
|
|
5272
|
+
const tabPanel = duplicatedElements.find((element) => element.originalElementId === tabPanelId);
|
|
5273
|
+
if (tabPanel && tab) {
|
|
5274
|
+
(0, import_editor_elements16.updateElementSettings)({
|
|
5275
|
+
withHistory: false,
|
|
5276
|
+
id: tab.id,
|
|
5277
|
+
props: {
|
|
5278
|
+
"tab-panel-id": import_editor_props16.stringPropTypeUtil.create(tabPanel.id)
|
|
5279
|
+
}
|
|
5280
|
+
});
|
|
5281
|
+
(0, import_editor_elements16.updateElementSettings)({
|
|
5282
|
+
withHistory: false,
|
|
5283
|
+
id: tabPanel.id,
|
|
5284
|
+
props: {
|
|
5285
|
+
"tab-id": import_editor_props16.stringPropTypeUtil.create(tab.id)
|
|
5286
|
+
}
|
|
5287
|
+
});
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
});
|
|
5291
|
+
});
|
|
5292
|
+
};
|
|
5293
|
+
var moveItem = ({
|
|
5294
|
+
toIndex,
|
|
5295
|
+
tabListId,
|
|
5296
|
+
tabContentId,
|
|
5297
|
+
movedElementId
|
|
5298
|
+
}) => {
|
|
5299
|
+
const { value: tabPanelId } = (0, import_editor_elements16.getElementSetting)(movedElementId, "tab-panel-id") ?? {};
|
|
5300
|
+
if (!tabPanelId) {
|
|
5301
|
+
throw new Error("Required tab elements not found for reordering");
|
|
5302
|
+
}
|
|
5303
|
+
(0, import_editor_elements16.moveElements)({
|
|
5304
|
+
title: (0, import_i18n63.__)("Reorder Tabs", "elementor"),
|
|
5305
|
+
moves: [
|
|
5306
|
+
{
|
|
5307
|
+
elementId: movedElementId,
|
|
5308
|
+
targetContainerId: tabListId,
|
|
5309
|
+
options: { at: toIndex }
|
|
5310
|
+
},
|
|
5311
|
+
{
|
|
5312
|
+
elementId: tabPanelId,
|
|
5313
|
+
targetContainerId: tabContentId,
|
|
5314
|
+
options: { at: toIndex }
|
|
5315
|
+
}
|
|
5316
|
+
]
|
|
5317
|
+
});
|
|
5318
|
+
};
|
|
5319
|
+
var removeItem = ({ items: items3 }) => {
|
|
5320
|
+
(0, import_editor_elements16.removeElements)({
|
|
5321
|
+
title: (0, import_i18n63.__)("Tabs", "elementor"),
|
|
5322
|
+
elementIds: items3.flatMap(({ item }) => {
|
|
5323
|
+
const tabId = item.id;
|
|
5324
|
+
const { value: panelId } = (0, import_editor_elements16.getElementSetting)(tabId, "tab-panel-id") ?? {};
|
|
5325
|
+
if (!panelId) {
|
|
5326
|
+
throw new Error("Pane ID is required");
|
|
5327
|
+
}
|
|
5328
|
+
return [tabId, panelId];
|
|
5329
|
+
})
|
|
5330
|
+
});
|
|
5331
|
+
};
|
|
5332
|
+
var addItem = ({
|
|
5333
|
+
tabContentId,
|
|
5334
|
+
tabListId,
|
|
5335
|
+
items: items3
|
|
5336
|
+
}) => {
|
|
5337
|
+
items3.forEach(({ item, index }) => {
|
|
5338
|
+
const newTabPanelId = (0, import_editor_elements16.generateElementId)();
|
|
5339
|
+
const newTabId = (0, import_editor_elements16.generateElementId)();
|
|
5340
|
+
(0, import_editor_elements16.createElements)({
|
|
5341
|
+
title: (0, import_i18n63.__)("Tabs", "elementor"),
|
|
5342
|
+
elements: [
|
|
5343
|
+
{
|
|
5344
|
+
containerId: tabContentId,
|
|
5345
|
+
model: {
|
|
5346
|
+
id: newTabPanelId,
|
|
5347
|
+
elType: TAB_PANEL_ELEMENT_TYPE,
|
|
5067
5348
|
settings: {
|
|
5068
|
-
"tab-id":
|
|
5349
|
+
"tab-id": import_editor_props16.stringPropTypeUtil.create(newTabId)
|
|
5069
5350
|
},
|
|
5070
5351
|
editor_settings: { title: `Tab ${index + 1} panel` }
|
|
5071
5352
|
}
|
|
@@ -5077,7 +5358,7 @@ var addItem = ({
|
|
|
5077
5358
|
elType: TAB_ELEMENT_TYPE,
|
|
5078
5359
|
settings: {
|
|
5079
5360
|
...item,
|
|
5080
|
-
"tab-panel-id":
|
|
5361
|
+
"tab-panel-id": import_editor_props16.stringPropTypeUtil.create(newTabPanelId)
|
|
5081
5362
|
},
|
|
5082
5363
|
editor_settings: { title: `Tab ${index + 1}` }
|
|
5083
5364
|
}
|
|
@@ -5092,14 +5373,14 @@ var TAB_LIST_ELEMENT_TYPE = "e-tabs-list";
|
|
|
5092
5373
|
var TAB_CONTENT_ELEMENT_TYPE = "e-tabs-content";
|
|
5093
5374
|
var TabsControl = ({ label }) => {
|
|
5094
5375
|
const { element } = useElement();
|
|
5095
|
-
const { [TAB_ELEMENT_TYPE]: tabLinks } = (0,
|
|
5376
|
+
const { [TAB_ELEMENT_TYPE]: tabLinks } = (0, import_editor_elements17.useElementChildren)(element.id, [
|
|
5096
5377
|
TAB_ELEMENT_TYPE,
|
|
5097
5378
|
TAB_PANEL_ELEMENT_TYPE
|
|
5098
5379
|
]);
|
|
5099
5380
|
const tabList = getElementByType(element.id, TAB_LIST_ELEMENT_TYPE);
|
|
5100
5381
|
const tabContent = getElementByType(element.id, TAB_CONTENT_ELEMENT_TYPE);
|
|
5101
5382
|
const repeaterValues = tabLinks.map((tabLink) => {
|
|
5102
|
-
const { title: titleSetting } = (0,
|
|
5383
|
+
const { title: titleSetting } = (0, import_editor_elements17.getElementEditorSettings)(tabLink.id) ?? {};
|
|
5103
5384
|
return {
|
|
5104
5385
|
id: tabLink.id,
|
|
5105
5386
|
title: titleSetting
|
|
@@ -5128,8 +5409,8 @@ var TabsControl = ({ label }) => {
|
|
|
5128
5409
|
});
|
|
5129
5410
|
}
|
|
5130
5411
|
};
|
|
5131
|
-
return /* @__PURE__ */
|
|
5132
|
-
|
|
5412
|
+
return /* @__PURE__ */ React91.createElement(
|
|
5413
|
+
import_editor_controls54.Repeater,
|
|
5133
5414
|
{
|
|
5134
5415
|
addToBottom: true,
|
|
5135
5416
|
showToggle: false,
|
|
@@ -5139,360 +5420,105 @@ var TabsControl = ({ label }) => {
|
|
|
5139
5420
|
label,
|
|
5140
5421
|
itemSettings: {
|
|
5141
5422
|
initialValues: { title: "Tab" },
|
|
5142
|
-
Label:
|
|
5143
|
-
Content:
|
|
5423
|
+
Label: ItemLabel,
|
|
5424
|
+
Content: ItemContent,
|
|
5144
5425
|
Icon: () => null
|
|
5145
5426
|
}
|
|
5146
5427
|
}
|
|
5147
|
-
)
|
|
5428
|
+
);
|
|
5148
5429
|
};
|
|
5149
5430
|
var ItemLabel = ({ value }) => {
|
|
5150
5431
|
const id = value.id ?? "";
|
|
5151
|
-
const
|
|
5152
|
-
const isDefault = defaultItem === id;
|
|
5153
|
-
const editorSettings = (0, import_editor_elements15.useElementEditorSettings)(id);
|
|
5432
|
+
const editorSettings = (0, import_editor_elements17.useElementEditorSettings)(id);
|
|
5154
5433
|
const elementTitle = editorSettings?.title;
|
|
5155
|
-
return /* @__PURE__ */
|
|
5434
|
+
return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { sx: { minHeight: 20 }, direction: "row", alignItems: "center", gap: 1.5 }, /* @__PURE__ */ React91.createElement("span", null, elementTitle), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n64.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(ItemDefaultTab, { value })));
|
|
5156
5435
|
};
|
|
5157
|
-
var
|
|
5158
|
-
const
|
|
5159
|
-
const
|
|
5160
|
-
const
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5436
|
+
var ItemDefaultTab = ({ value }) => {
|
|
5437
|
+
const id = value.id ?? "";
|
|
5438
|
+
const { value: defaultItem } = (0, import_editor_controls54.useBoundProp)(import_editor_props17.stringPropTypeUtil);
|
|
5439
|
+
const isDefault = defaultItem === id;
|
|
5440
|
+
if (!isDefault) {
|
|
5441
|
+
return null;
|
|
5442
|
+
}
|
|
5443
|
+
return /* @__PURE__ */ React91.createElement(import_ui46.Chip, { size: "tiny", shape: "rounded", label: (0, import_i18n64.__)("Default", "elementor") });
|
|
5444
|
+
};
|
|
5445
|
+
var ItemContent = ({ value }) => {
|
|
5446
|
+
if (!value.id) {
|
|
5447
|
+
return null;
|
|
5448
|
+
}
|
|
5449
|
+
return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { p: 2, gap: 1.5 }, /* @__PURE__ */ React91.createElement(TabLabelControl, { elementId: value.id }), /* @__PURE__ */ React91.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: (0, import_i18n64.__)("Tabs", "elementor") }, /* @__PURE__ */ React91.createElement(DefaultTabControl, { elementId: value.id })));
|
|
5450
|
+
};
|
|
5451
|
+
var DefaultTabControl = ({ elementId }) => {
|
|
5452
|
+
const { value, setValue } = (0, import_editor_controls54.useBoundProp)(import_editor_props17.stringPropTypeUtil);
|
|
5453
|
+
const isDefault = value === elementId;
|
|
5454
|
+
return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, /* @__PURE__ */ React91.createElement(import_editor_controls54.ControlFormLabel, null, (0, import_i18n64.__)("Set as default tab", "elementor")), /* @__PURE__ */ React91.createElement(ConditionalTooltip, { showTooltip: isDefault, placement: "right" }, /* @__PURE__ */ React91.createElement(
|
|
5455
|
+
import_ui46.Switch,
|
|
5177
5456
|
{
|
|
5178
5457
|
size: "small",
|
|
5179
5458
|
checked: isDefault,
|
|
5180
5459
|
disabled: isDefault,
|
|
5181
5460
|
onChange: ({ target }) => {
|
|
5182
|
-
|
|
5461
|
+
setValue(target.checked ? elementId : null);
|
|
5183
5462
|
},
|
|
5184
5463
|
inputProps: {
|
|
5185
5464
|
...isDefault ? { style: { opacity: 0, cursor: "not-allowed" } } : {}
|
|
5186
5465
|
}
|
|
5187
5466
|
}
|
|
5188
|
-
)))
|
|
5467
|
+
)));
|
|
5189
5468
|
};
|
|
5190
|
-
var
|
|
5191
|
-
const
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5469
|
+
var TabLabelControl = ({ elementId }) => {
|
|
5470
|
+
const editorSettings = (0, import_editor_elements17.useElementEditorSettings)(elementId);
|
|
5471
|
+
const label = editorSettings?.title ?? "";
|
|
5472
|
+
return /* @__PURE__ */ React91.createElement(import_ui46.Stack, { gap: 1 }, /* @__PURE__ */ React91.createElement(import_editor_controls54.ControlFormLabel, null, (0, import_i18n64.__)("Tab name", "elementor")), /* @__PURE__ */ React91.createElement(
|
|
5473
|
+
import_ui46.TextField,
|
|
5474
|
+
{
|
|
5475
|
+
size: "tiny",
|
|
5476
|
+
value: label,
|
|
5477
|
+
onChange: ({ target }) => {
|
|
5478
|
+
(0, import_editor_elements17.updateElementEditorSettings)({
|
|
5479
|
+
elementId,
|
|
5480
|
+
settings: { title: target.value }
|
|
5481
|
+
});
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5484
|
+
));
|
|
5200
5485
|
};
|
|
5201
|
-
var tooltipContent = /* @__PURE__ */ React85.createElement(import_ui41.Alert, { color: "secondary", icon: /* @__PURE__ */ React85.createElement(import_icons24.InfoCircleFilledIcon, { fontSize: "tiny" }), size: "small", sx: { width: 288 } }, /* @__PURE__ */ React85.createElement(import_ui41.Typography, { variant: "body2" }, (0, import_i18n62.__)("To change the default tab, simply set another tab as default.", "elementor")));
|
|
5202
5486
|
var ConditionalTooltip = ({
|
|
5203
5487
|
showTooltip,
|
|
5204
|
-
children
|
|
5205
|
-
content,
|
|
5206
|
-
...props
|
|
5488
|
+
children
|
|
5207
5489
|
}) => {
|
|
5208
5490
|
if (!showTooltip) {
|
|
5209
5491
|
return children;
|
|
5210
5492
|
}
|
|
5211
|
-
return /* @__PURE__ */
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
"svg-media": { component: import_editor_controls52.SvgMediaControl, layout: "full", propTypeUtil: import_editor_props17.imageSrcPropTypeUtil },
|
|
5218
|
-
text: { component: import_editor_controls52.TextControl, layout: "full", propTypeUtil: import_editor_props17.stringPropTypeUtil },
|
|
5219
|
-
textarea: { component: import_editor_controls52.TextAreaControl, layout: "full", propTypeUtil: import_editor_props17.stringPropTypeUtil },
|
|
5220
|
-
size: { component: import_editor_controls52.SizeControl, layout: "two-columns", propTypeUtil: import_editor_props17.sizePropTypeUtil },
|
|
5221
|
-
select: { component: import_editor_controls52.SelectControlWrapper, layout: "two-columns", propTypeUtil: import_editor_props17.stringPropTypeUtil },
|
|
5222
|
-
link: { component: import_editor_controls52.LinkControl, layout: "custom", propTypeUtil: import_editor_props17.linkPropTypeUtil },
|
|
5223
|
-
query: { component: import_editor_controls52.QueryControl, layout: "full", propTypeUtil: import_editor_props17.queryPropTypeUtil },
|
|
5224
|
-
url: { component: import_editor_controls52.UrlControl, layout: "full", propTypeUtil: import_editor_props17.stringPropTypeUtil },
|
|
5225
|
-
switch: { component: import_editor_controls52.SwitchControl, layout: "two-columns", propTypeUtil: import_editor_props17.booleanPropTypeUtil },
|
|
5226
|
-
number: { component: import_editor_controls52.NumberControl, layout: "two-columns", propTypeUtil: import_editor_props17.numberPropTypeUtil },
|
|
5227
|
-
repeatable: { component: import_editor_controls52.RepeatableControl, layout: "full", propTypeUtil: void 0 },
|
|
5228
|
-
"key-value": { component: import_editor_controls52.KeyValueControl, layout: "full", propTypeUtil: import_editor_props17.keyValuePropTypeUtil },
|
|
5229
|
-
"html-tag": { component: import_editor_controls52.HtmlTagControl, layout: "two-columns", propTypeUtil: import_editor_props17.stringPropTypeUtil },
|
|
5230
|
-
toggle: { component: import_editor_controls52.ToggleControl, layout: "full", propTypeUtil: import_editor_props17.stringPropTypeUtil }
|
|
5231
|
-
};
|
|
5232
|
-
var ControlsRegistry = class {
|
|
5233
|
-
constructor(controlsRegistry2) {
|
|
5234
|
-
this.controlsRegistry = controlsRegistry2;
|
|
5235
|
-
this.controlsRegistry = controlsRegistry2;
|
|
5236
|
-
}
|
|
5237
|
-
get(type) {
|
|
5238
|
-
return this.controlsRegistry[type]?.component;
|
|
5239
|
-
}
|
|
5240
|
-
getLayout(type) {
|
|
5241
|
-
return this.controlsRegistry[type]?.layout;
|
|
5242
|
-
}
|
|
5243
|
-
getPropTypeUtil(type) {
|
|
5244
|
-
return this.controlsRegistry[type]?.propTypeUtil;
|
|
5245
|
-
}
|
|
5246
|
-
registry() {
|
|
5247
|
-
return this.controlsRegistry;
|
|
5248
|
-
}
|
|
5249
|
-
register(type, component, layout, propTypeUtil) {
|
|
5250
|
-
if (this.controlsRegistry[type]) {
|
|
5251
|
-
throw new ControlTypeAlreadyRegisteredError({ context: { controlType: type } });
|
|
5252
|
-
}
|
|
5253
|
-
this.controlsRegistry[type] = { component, layout, propTypeUtil };
|
|
5254
|
-
}
|
|
5255
|
-
unregister(type) {
|
|
5256
|
-
if (!this.controlsRegistry[type]) {
|
|
5257
|
-
throw new ControlTypeNotRegisteredError({ context: { controlType: type } });
|
|
5258
|
-
}
|
|
5259
|
-
delete this.controlsRegistry[type];
|
|
5260
|
-
}
|
|
5261
|
-
};
|
|
5262
|
-
var controlsRegistry = new ControlsRegistry(controlTypes);
|
|
5263
|
-
controlsRegistry.register("tabs", TabsControl, "full", void 0);
|
|
5264
|
-
|
|
5265
|
-
// src/init.ts
|
|
5266
|
-
var import_editor = require("@elementor/editor");
|
|
5267
|
-
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
5268
|
-
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
5269
|
-
|
|
5270
|
-
// src/hooks/use-open-editor-panel.ts
|
|
5271
|
-
var import_react39 = require("react");
|
|
5272
|
-
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
5273
|
-
|
|
5274
|
-
// src/panel.ts
|
|
5275
|
-
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
5276
|
-
|
|
5277
|
-
// src/components/editing-panel.tsx
|
|
5278
|
-
var React91 = __toESM(require("react"));
|
|
5279
|
-
var import_editor_controls54 = require("@elementor/editor-controls");
|
|
5280
|
-
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
5281
|
-
var import_editor_panels = require("@elementor/editor-panels");
|
|
5282
|
-
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
5283
|
-
var import_icons25 = require("@elementor/icons");
|
|
5284
|
-
var import_session8 = require("@elementor/session");
|
|
5285
|
-
var import_ui46 = require("@elementor/ui");
|
|
5286
|
-
var import_i18n64 = require("@wordpress/i18n");
|
|
5287
|
-
|
|
5288
|
-
// src/components/editing-panel-error-fallback.tsx
|
|
5289
|
-
var React86 = __toESM(require("react"));
|
|
5290
|
-
var import_ui42 = require("@elementor/ui");
|
|
5291
|
-
function EditorPanelErrorFallback() {
|
|
5292
|
-
return /* @__PURE__ */ React86.createElement(import_ui42.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React86.createElement(import_ui42.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React86.createElement("strong", null, "Something went wrong")));
|
|
5293
|
-
}
|
|
5294
|
-
|
|
5295
|
-
// src/components/editing-panel-tabs.tsx
|
|
5296
|
-
var React90 = __toESM(require("react"));
|
|
5297
|
-
var import_react38 = require("react");
|
|
5298
|
-
var import_ui45 = require("@elementor/ui");
|
|
5299
|
-
var import_i18n63 = require("@wordpress/i18n");
|
|
5300
|
-
|
|
5301
|
-
// src/components/settings-tab.tsx
|
|
5302
|
-
var React89 = __toESM(require("react"));
|
|
5303
|
-
var import_editor_controls53 = require("@elementor/editor-controls");
|
|
5304
|
-
var import_session7 = require("@elementor/session");
|
|
5305
|
-
var import_ui44 = require("@elementor/ui");
|
|
5306
|
-
|
|
5307
|
-
// src/controls-registry/control.tsx
|
|
5308
|
-
var React87 = __toESM(require("react"));
|
|
5309
|
-
var Control = ({ props, type }) => {
|
|
5310
|
-
const ControlByType = controlsRegistry.get(type);
|
|
5311
|
-
const { element } = useElement();
|
|
5312
|
-
if (!ControlByType) {
|
|
5313
|
-
throw new ControlTypeNotFoundError({
|
|
5314
|
-
context: { controlType: type }
|
|
5315
|
-
});
|
|
5316
|
-
}
|
|
5317
|
-
return /* @__PURE__ */ React87.createElement(ControlByType, { ...props, context: { elementId: element.id } });
|
|
5318
|
-
};
|
|
5319
|
-
|
|
5320
|
-
// src/controls-registry/control-type-container.tsx
|
|
5321
|
-
var React88 = __toESM(require("react"));
|
|
5322
|
-
var import_ui43 = require("@elementor/ui");
|
|
5323
|
-
var ControlTypeContainer = ({ children, layout }) => {
|
|
5324
|
-
if (layout === "custom") {
|
|
5325
|
-
return children;
|
|
5326
|
-
}
|
|
5327
|
-
return /* @__PURE__ */ React88.createElement(StyledContainer, { layout }, children);
|
|
5328
|
-
};
|
|
5329
|
-
var StyledContainer = (0, import_ui43.styled)(import_ui43.Box, {
|
|
5330
|
-
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
5331
|
-
})(({ layout, theme }) => ({
|
|
5332
|
-
display: "grid",
|
|
5333
|
-
gridGap: theme.spacing(1),
|
|
5334
|
-
...getGridLayout(layout)
|
|
5335
|
-
}));
|
|
5336
|
-
var getGridLayout = (layout) => ({
|
|
5337
|
-
justifyContent: "space-between",
|
|
5338
|
-
gridTemplateColumns: {
|
|
5339
|
-
full: "minmax(0, 1fr)",
|
|
5340
|
-
"two-columns": "repeat(2, minmax(0, 1fr))"
|
|
5341
|
-
}[layout]
|
|
5342
|
-
});
|
|
5343
|
-
|
|
5344
|
-
// src/components/settings-tab.tsx
|
|
5345
|
-
var SettingsTab = () => {
|
|
5346
|
-
const { elementType, element } = useElement();
|
|
5347
|
-
const settingsDefault = useDefaultPanelSettings();
|
|
5348
|
-
const isDefaultExpanded = (sectionId) => settingsDefault.defaultSectionsExpanded.settings?.includes(sectionId);
|
|
5349
|
-
return /* @__PURE__ */ React89.createElement(import_session7.SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React89.createElement(SectionsList, null, elementType.controls.map((control, index) => {
|
|
5350
|
-
if (isControl(control)) {
|
|
5351
|
-
return /* @__PURE__ */ React89.createElement(Control2, { key: getKey(control, element), control });
|
|
5352
|
-
}
|
|
5353
|
-
const { type, value } = control;
|
|
5354
|
-
if (type === "section") {
|
|
5355
|
-
return /* @__PURE__ */ React89.createElement(
|
|
5356
|
-
Section,
|
|
5493
|
+
return /* @__PURE__ */ React91.createElement(
|
|
5494
|
+
import_ui46.Infotip,
|
|
5495
|
+
{
|
|
5496
|
+
arrow: false,
|
|
5497
|
+
content: /* @__PURE__ */ React91.createElement(
|
|
5498
|
+
import_ui46.Alert,
|
|
5357
5499
|
{
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5500
|
+
color: "secondary",
|
|
5501
|
+
icon: /* @__PURE__ */ React91.createElement(import_icons25.InfoCircleFilledIcon, { fontSize: "tiny" }),
|
|
5502
|
+
size: "small",
|
|
5503
|
+
sx: { width: 288 }
|
|
5361
5504
|
},
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
return /* @__PURE__ */ React89.createElement(Control2, { key: getKey(item, element), control: item });
|
|
5365
|
-
}
|
|
5366
|
-
return null;
|
|
5367
|
-
})
|
|
5368
|
-
);
|
|
5369
|
-
}
|
|
5370
|
-
return null;
|
|
5371
|
-
})));
|
|
5372
|
-
};
|
|
5373
|
-
var Control2 = ({ control: { value, type } }) => {
|
|
5374
|
-
if (!controlsRegistry.get(value.type)) {
|
|
5375
|
-
return null;
|
|
5376
|
-
}
|
|
5377
|
-
const layout = value.meta?.layout || controlsRegistry.getLayout(value.type);
|
|
5378
|
-
const controlProps = populateChildControlProps(value.props);
|
|
5379
|
-
if (layout === "custom") {
|
|
5380
|
-
controlProps.label = value.label;
|
|
5381
|
-
}
|
|
5382
|
-
if (type === "element-control") {
|
|
5383
|
-
return /* @__PURE__ */ React89.createElement(ControlLayout, { control: value, layout, controlProps });
|
|
5384
|
-
}
|
|
5385
|
-
return /* @__PURE__ */ React89.createElement(SettingsField, { bind: value.bind, propDisplayName: value.label || value.bind }, /* @__PURE__ */ React89.createElement(ControlLayout, { control: value, layout, controlProps }));
|
|
5386
|
-
};
|
|
5387
|
-
var ControlLayout = ({
|
|
5388
|
-
control,
|
|
5389
|
-
layout,
|
|
5390
|
-
controlProps
|
|
5391
|
-
}) => {
|
|
5392
|
-
return /* @__PURE__ */ React89.createElement(React89.Fragment, null, control.meta?.topDivider && /* @__PURE__ */ React89.createElement(import_ui44.Divider, null), /* @__PURE__ */ React89.createElement(ControlTypeContainer, { layout }, control.label && layout !== "custom" ? /* @__PURE__ */ React89.createElement(import_editor_controls53.ControlFormLabel, null, control.label) : null, /* @__PURE__ */ React89.createElement(Control, { type: control.type, props: controlProps })));
|
|
5393
|
-
};
|
|
5394
|
-
function populateChildControlProps(props) {
|
|
5395
|
-
if (props.childControlType) {
|
|
5396
|
-
const childComponent = controlsRegistry.get(props.childControlType);
|
|
5397
|
-
const childPropType = controlsRegistry.getPropTypeUtil(props.childControlType);
|
|
5398
|
-
props = {
|
|
5399
|
-
...props,
|
|
5400
|
-
childControlConfig: {
|
|
5401
|
-
component: childComponent,
|
|
5402
|
-
props: props.childControlProps || {},
|
|
5403
|
-
propTypeUtil: childPropType
|
|
5404
|
-
}
|
|
5405
|
-
};
|
|
5406
|
-
}
|
|
5407
|
-
return props;
|
|
5408
|
-
}
|
|
5409
|
-
function getKey(control, element) {
|
|
5410
|
-
if (control.type === "control") {
|
|
5411
|
-
return control.value.bind + "." + element.id;
|
|
5412
|
-
}
|
|
5413
|
-
return control.value.type + "." + element.id;
|
|
5414
|
-
}
|
|
5415
|
-
function isControl(control) {
|
|
5416
|
-
return control.type === "control" || control.type === "element-control";
|
|
5417
|
-
}
|
|
5418
|
-
|
|
5419
|
-
// src/components/editing-panel-tabs.tsx
|
|
5420
|
-
var EditingPanelTabs = () => {
|
|
5421
|
-
const { element } = useElement();
|
|
5422
|
-
return (
|
|
5423
|
-
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
5424
|
-
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
5425
|
-
/* @__PURE__ */ React90.createElement(import_react38.Fragment, { key: element.id }, /* @__PURE__ */ React90.createElement(PanelTabContent, null))
|
|
5426
|
-
);
|
|
5427
|
-
};
|
|
5428
|
-
var PanelTabContent = () => {
|
|
5429
|
-
const editorDefaults = useDefaultPanelSettings();
|
|
5430
|
-
const defaultComponentTab = editorDefaults.defaultTab;
|
|
5431
|
-
const [currentTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
5432
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui45.useTabs)(currentTab);
|
|
5433
|
-
return /* @__PURE__ */ React90.createElement(ScrollProvider, null, /* @__PURE__ */ React90.createElement(import_ui45.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React90.createElement(import_ui45.Stack, { sx: { ...stickyHeaderStyles, top: 0 } }, /* @__PURE__ */ React90.createElement(
|
|
5434
|
-
import_ui45.Tabs,
|
|
5435
|
-
{
|
|
5436
|
-
variant: "fullWidth",
|
|
5437
|
-
size: "small",
|
|
5438
|
-
sx: { mt: 0.5 },
|
|
5439
|
-
...getTabsProps(),
|
|
5440
|
-
onChange: (_, newValue) => {
|
|
5441
|
-
getTabsProps().onChange(_, newValue);
|
|
5442
|
-
setCurrentTab(newValue);
|
|
5443
|
-
}
|
|
5505
|
+
/* @__PURE__ */ React91.createElement(import_ui46.Typography, { variant: "body2" }, (0, import_i18n64.__)("To change the default tab, simply set another tab as default.", "elementor"))
|
|
5506
|
+
)
|
|
5444
5507
|
},
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
|
|
5447
|
-
), /* @__PURE__ */ React90.createElement(import_ui45.Divider, null)), /* @__PURE__ */ React90.createElement(import_ui45.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React90.createElement(SettingsTab, null)), /* @__PURE__ */ React90.createElement(import_ui45.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React90.createElement(StyleTab, null))));
|
|
5448
|
-
};
|
|
5449
|
-
|
|
5450
|
-
// src/components/editing-panel.tsx
|
|
5451
|
-
var { useMenuItems } = controlActionsMenu;
|
|
5452
|
-
var EditingPanel = () => {
|
|
5453
|
-
const { element, elementType } = (0, import_editor_elements16.useSelectedElement)();
|
|
5454
|
-
const controlReplacements = getControlReplacements();
|
|
5455
|
-
const menuItems = useMenuItems().default;
|
|
5456
|
-
if (!element || !elementType) {
|
|
5457
|
-
return null;
|
|
5458
|
-
}
|
|
5459
|
-
const panelTitle = (0, import_i18n64.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
5460
|
-
return /* @__PURE__ */ React91.createElement(import_ui46.ErrorBoundary, { fallback: /* @__PURE__ */ React91.createElement(EditorPanelErrorFallback, null) }, /* @__PURE__ */ React91.createElement(import_session8.SessionStorageProvider, { prefix: "elementor" }, /* @__PURE__ */ React91.createElement(import_editor_ui6.ThemeProvider, null, /* @__PURE__ */ React91.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React91.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React91.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle), /* @__PURE__ */ React91.createElement(import_icons25.AtomIcon, { fontSize: "small", sx: { color: "text.tertiary" } })), /* @__PURE__ */ React91.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React91.createElement(import_editor_controls54.ControlActionsProvider, { items: menuItems }, /* @__PURE__ */ React91.createElement(import_editor_controls54.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React91.createElement(ElementProvider, { element, elementType }, /* @__PURE__ */ React91.createElement(EditingPanelTabs, null)))))))));
|
|
5461
|
-
};
|
|
5462
|
-
|
|
5463
|
-
// src/panel.ts
|
|
5464
|
-
var { panel, usePanelActions, usePanelStatus } = (0, import_editor_panels2.__createPanel)({
|
|
5465
|
-
id: "editing-panel",
|
|
5466
|
-
component: EditingPanel
|
|
5467
|
-
});
|
|
5468
|
-
|
|
5469
|
-
// src/sync/is-atomic-widget-selected.ts
|
|
5470
|
-
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
5471
|
-
var isAtomicWidgetSelected = () => {
|
|
5472
|
-
const selectedElements = (0, import_editor_elements17.getSelectedElements)();
|
|
5473
|
-
const widgetCache = (0, import_editor_elements17.getWidgetsCache)();
|
|
5474
|
-
if (selectedElements.length !== 1) {
|
|
5475
|
-
return false;
|
|
5476
|
-
}
|
|
5477
|
-
return !!widgetCache?.[selectedElements[0].type]?.atomic_controls;
|
|
5508
|
+
/* @__PURE__ */ React91.createElement("span", null, children)
|
|
5509
|
+
);
|
|
5478
5510
|
};
|
|
5479
5511
|
|
|
5480
|
-
// src/
|
|
5481
|
-
var
|
|
5482
|
-
|
|
5483
|
-
(0, import_react39.useEffect)(() => {
|
|
5484
|
-
return (0, import_editor_v1_adapters6.__privateListenTo)((0, import_editor_v1_adapters6.commandStartEvent)("panel/editor/open"), () => {
|
|
5485
|
-
if (isAtomicWidgetSelected()) {
|
|
5486
|
-
open();
|
|
5487
|
-
}
|
|
5488
|
-
});
|
|
5489
|
-
}, []);
|
|
5512
|
+
// src/controls-registry/element-controls/registry.ts
|
|
5513
|
+
var controlTypes2 = {
|
|
5514
|
+
tabs: { component: TabsControl, layout: "full" }
|
|
5490
5515
|
};
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5516
|
+
var registerElementControls = () => {
|
|
5517
|
+
Object.entries(controlTypes2).forEach(
|
|
5518
|
+
([type, { component, layout }]) => {
|
|
5519
|
+
controlsRegistry.register(type, component, layout);
|
|
5520
|
+
}
|
|
5521
|
+
);
|
|
5496
5522
|
};
|
|
5497
5523
|
|
|
5498
5524
|
// src/dynamics/init.ts
|
|
@@ -6272,6 +6298,7 @@ function init3() {
|
|
|
6272
6298
|
});
|
|
6273
6299
|
init();
|
|
6274
6300
|
init2();
|
|
6301
|
+
registerElementControls();
|
|
6275
6302
|
initResetStyleProps();
|
|
6276
6303
|
}
|
|
6277
6304
|
var blockV1Panel = () => {
|