@elementor/editor-components 3.35.0-411 → 3.35.0-413
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 +387 -170
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +350 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/api.ts +15 -1
- package/src/components/component-panel-header/component-panel-header.tsx +11 -2
- package/src/components/components-tab/components-item.tsx +119 -37
- package/src/components/components-tab/components-list.tsx +8 -1
- package/src/components/create-component-form/utils/component-form-schema.ts +9 -11
- package/src/components/create-component-form/utils/replace-element-with-component.ts +0 -1
- package/src/components/edit-component/edit-component.tsx +31 -1
- package/src/create-component-type.ts +85 -1
- package/src/store/actions/rename-component.ts +7 -0
- package/src/store/store.ts +29 -0
- package/src/sync/before-save.ts +2 -0
- package/src/sync/update-component-title-before-save.ts +18 -0
- package/src/types.ts +5 -0
- package/src/utils/component-name-validation.ts +27 -0
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
|
43
43
|
var import_editor_panels4 = require("@elementor/editor-panels");
|
|
44
44
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
45
45
|
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
46
|
-
var
|
|
46
|
+
var import_store76 = require("@elementor/store");
|
|
47
47
|
var import_i18n26 = require("@wordpress/i18n");
|
|
48
48
|
|
|
49
49
|
// src/component-instance-transformer.ts
|
|
@@ -99,6 +99,12 @@ var apiClient = {
|
|
|
99
99
|
componentIds
|
|
100
100
|
}
|
|
101
101
|
).then((res) => res.data.data),
|
|
102
|
+
updateComponentTitle: (updatedComponentNames) => (0, import_http_client.httpService)().post(
|
|
103
|
+
`${BASE_URL}/update-titles`,
|
|
104
|
+
{
|
|
105
|
+
components: updatedComponentNames
|
|
106
|
+
}
|
|
107
|
+
).then((res) => res.data.data),
|
|
102
108
|
validate: async (payload) => await (0, import_http_client.httpService)().post(`${BASE_URL}/create-validate`, payload).then((res) => res.data)
|
|
103
109
|
};
|
|
104
110
|
|
|
@@ -117,7 +123,8 @@ var initialState = {
|
|
|
117
123
|
createdThisSession: [],
|
|
118
124
|
archivedData: [],
|
|
119
125
|
path: [],
|
|
120
|
-
currentComponentId: null
|
|
126
|
+
currentComponentId: null,
|
|
127
|
+
updatedComponentNames: {}
|
|
121
128
|
};
|
|
122
129
|
var SLICE_NAME = "components";
|
|
123
130
|
var slice = (0, import_store2.__createSlice)({
|
|
@@ -171,6 +178,19 @@ var slice = (0, import_store2.__createSlice)({
|
|
|
171
178
|
return;
|
|
172
179
|
}
|
|
173
180
|
component.overridableProps = payload.overridableProps;
|
|
181
|
+
},
|
|
182
|
+
rename: (state, { payload }) => {
|
|
183
|
+
const component = state.data.find((comp) => comp.uid === payload.componentUid);
|
|
184
|
+
if (!component) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (component.id) {
|
|
188
|
+
state.updatedComponentNames[component.id] = payload.name;
|
|
189
|
+
}
|
|
190
|
+
component.name = payload.name;
|
|
191
|
+
},
|
|
192
|
+
cleanUpdatedComponentNames: (state) => {
|
|
193
|
+
state.updatedComponentNames = {};
|
|
174
194
|
}
|
|
175
195
|
},
|
|
176
196
|
extraReducers: (builder) => {
|
|
@@ -198,6 +218,7 @@ var selectComponent = (state, componentId) => state[SLICE_NAME].data.find((compo
|
|
|
198
218
|
var useComponent = (componentId) => {
|
|
199
219
|
return (0, import_store2.__useSelector)((state) => componentId ? selectComponent(state, componentId) : null);
|
|
200
220
|
};
|
|
221
|
+
var selectComponentByUid = (state, componentUid) => state[SLICE_NAME].data.find((component) => component.uid === componentUid) ?? state[SLICE_NAME].unpublishedData.find((component) => component.uid === componentUid);
|
|
201
222
|
var selectComponents = (0, import_store2.__createSelector)(
|
|
202
223
|
selectData,
|
|
203
224
|
selectUnpublishedData,
|
|
@@ -261,6 +282,13 @@ var selectArchivedComponents = (0, import_store2.__createSelector)(
|
|
|
261
282
|
selectArchivedData,
|
|
262
283
|
(archivedData) => archivedData
|
|
263
284
|
);
|
|
285
|
+
var selectUpdatedComponentNames = (0, import_store2.__createSelector)(
|
|
286
|
+
(state) => state[SLICE_NAME].updatedComponentNames,
|
|
287
|
+
(updatedComponentNames) => Object.entries(updatedComponentNames).map(([componentId, title]) => ({
|
|
288
|
+
componentId: Number(componentId),
|
|
289
|
+
title
|
|
290
|
+
}))
|
|
291
|
+
);
|
|
264
292
|
|
|
265
293
|
// src/utils/component-document-data.ts
|
|
266
294
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
@@ -352,6 +380,7 @@ var React10 = __toESM(require("react"));
|
|
|
352
380
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
353
381
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
354
382
|
var import_icons7 = require("@elementor/icons");
|
|
383
|
+
var import_store25 = require("@elementor/store");
|
|
355
384
|
var import_ui10 = require("@elementor/ui");
|
|
356
385
|
var import_i18n11 = require("@wordpress/i18n");
|
|
357
386
|
|
|
@@ -1582,6 +1611,12 @@ var ComponentPanelHeader = () => {
|
|
|
1582
1611
|
));
|
|
1583
1612
|
};
|
|
1584
1613
|
function getComponentName() {
|
|
1614
|
+
const state = (0, import_store25.__getState)();
|
|
1615
|
+
const path = state[SLICE_NAME].path;
|
|
1616
|
+
const { instanceTitle } = path.at(-1) ?? {};
|
|
1617
|
+
if (instanceTitle) {
|
|
1618
|
+
return instanceTitle;
|
|
1619
|
+
}
|
|
1585
1620
|
const documentsManager = (0, import_editor_documents5.getV1DocumentsManager)();
|
|
1586
1621
|
const currentDocument = documentsManager.getCurrent();
|
|
1587
1622
|
return currentDocument?.container?.settings?.get("post_title") ?? "";
|
|
@@ -1643,35 +1678,42 @@ var ComponentSearch = () => {
|
|
|
1643
1678
|
var React15 = __toESM(require("react"));
|
|
1644
1679
|
var import_icons10 = require("@elementor/icons");
|
|
1645
1680
|
var import_ui14 = require("@elementor/ui");
|
|
1646
|
-
var
|
|
1681
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1647
1682
|
|
|
1648
1683
|
// src/hooks/use-components.ts
|
|
1649
|
-
var
|
|
1684
|
+
var import_store27 = require("@elementor/store");
|
|
1650
1685
|
var useComponents = () => {
|
|
1651
|
-
const components = (0,
|
|
1652
|
-
const isLoading = (0,
|
|
1686
|
+
const components = (0, import_store27.__useSelector)(selectComponents);
|
|
1687
|
+
const isLoading = (0, import_store27.__useSelector)(selectLoadIsPending);
|
|
1653
1688
|
return { components, isLoading };
|
|
1654
1689
|
};
|
|
1655
1690
|
|
|
1691
|
+
// src/store/actions/rename-component.ts
|
|
1692
|
+
var import_store29 = require("@elementor/store");
|
|
1693
|
+
var renameComponent = (componentUid, newName) => {
|
|
1694
|
+
(0, import_store29.__dispatch)(slice.actions.rename({ componentUid, name: newName }));
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1656
1697
|
// src/components/components-tab/components-item.tsx
|
|
1657
1698
|
var React13 = __toESM(require("react"));
|
|
1699
|
+
var import_react8 = require("react");
|
|
1658
1700
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
1659
1701
|
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1660
1702
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1661
1703
|
var import_icons9 = require("@elementor/icons");
|
|
1662
1704
|
var import_ui12 = require("@elementor/ui");
|
|
1663
|
-
var
|
|
1705
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
1664
1706
|
|
|
1665
1707
|
// src/store/actions/archive-component.ts
|
|
1666
1708
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1667
|
-
var
|
|
1709
|
+
var import_store31 = require("@elementor/store");
|
|
1668
1710
|
var archiveComponent = (componentId) => {
|
|
1669
|
-
const store = (0,
|
|
1670
|
-
const
|
|
1671
|
-
if (!
|
|
1711
|
+
const store = (0, import_store31.__getStore)();
|
|
1712
|
+
const dispatch18 = store?.dispatch;
|
|
1713
|
+
if (!dispatch18) {
|
|
1672
1714
|
return;
|
|
1673
1715
|
}
|
|
1674
|
-
|
|
1716
|
+
dispatch18(slice.actions.archive(componentId));
|
|
1675
1717
|
(0, import_editor_documents6.setDocumentModifiedStatus)(true);
|
|
1676
1718
|
};
|
|
1677
1719
|
|
|
@@ -1681,11 +1723,12 @@ var import_editor_documents8 = require("@elementor/editor-documents");
|
|
|
1681
1723
|
// src/create-component-type.ts
|
|
1682
1724
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
1683
1725
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
1726
|
+
var import_store35 = require("@elementor/store");
|
|
1684
1727
|
var import_i18n13 = require("@wordpress/i18n");
|
|
1685
1728
|
|
|
1686
1729
|
// src/utils/tracking.ts
|
|
1687
1730
|
var import_mixpanel = require("@elementor/mixpanel");
|
|
1688
|
-
var
|
|
1731
|
+
var import_store33 = require("@elementor/store");
|
|
1689
1732
|
var trackComponentEvent = ({ action, ...data }) => {
|
|
1690
1733
|
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
1691
1734
|
if (!config?.names?.components?.[action]) {
|
|
@@ -1702,7 +1745,7 @@ var onElementDrop = (_args, element) => {
|
|
|
1702
1745
|
const componentName = editorSettings?.title;
|
|
1703
1746
|
const componentUID = editorSettings?.component_uid;
|
|
1704
1747
|
const instanceId = element.id;
|
|
1705
|
-
const createdThisSession = selectCreatedThisSession((0,
|
|
1748
|
+
const createdThisSession = selectCreatedThisSession((0, import_store33.__getState)());
|
|
1706
1749
|
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1707
1750
|
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1708
1751
|
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
@@ -1736,13 +1779,17 @@ var updateGroups = (groups, config) => {
|
|
|
1736
1779
|
};
|
|
1737
1780
|
function createComponentType(options) {
|
|
1738
1781
|
const legacyWindow = window;
|
|
1739
|
-
|
|
1782
|
+
const WidgetType = legacyWindow.elementor.modules.elements.types.Widget;
|
|
1783
|
+
return class extends WidgetType {
|
|
1740
1784
|
getType() {
|
|
1741
1785
|
return options.type;
|
|
1742
1786
|
}
|
|
1743
1787
|
getView() {
|
|
1744
1788
|
return createComponentView({ ...options });
|
|
1745
1789
|
}
|
|
1790
|
+
getModel() {
|
|
1791
|
+
return createComponentModel();
|
|
1792
|
+
}
|
|
1746
1793
|
};
|
|
1747
1794
|
}
|
|
1748
1795
|
function createComponentView(options) {
|
|
@@ -1872,6 +1919,49 @@ function setInactiveRecursively(model) {
|
|
|
1872
1919
|
});
|
|
1873
1920
|
}
|
|
1874
1921
|
}
|
|
1922
|
+
function createComponentModel() {
|
|
1923
|
+
const legacyWindow = window;
|
|
1924
|
+
const WidgetType = legacyWindow.elementor.modules.elements.types.Widget;
|
|
1925
|
+
const widgetTypeInstance = new WidgetType();
|
|
1926
|
+
const BaseWidgetModel = widgetTypeInstance.getModel();
|
|
1927
|
+
return BaseWidgetModel.extend({
|
|
1928
|
+
initialize(attributes, options) {
|
|
1929
|
+
BaseWidgetModel.prototype.initialize.call(this, attributes, options);
|
|
1930
|
+
const componentInstance = this.get("settings")?.get("component_instance");
|
|
1931
|
+
if (componentInstance?.value) {
|
|
1932
|
+
const componentId = componentInstance.value.component_id?.value;
|
|
1933
|
+
if (componentId && typeof componentId === "number") {
|
|
1934
|
+
this.set("componentId", componentId);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
},
|
|
1938
|
+
getTitle() {
|
|
1939
|
+
const editorSettings = this.get("editor_settings");
|
|
1940
|
+
const instanceTitle = editorSettings?.title;
|
|
1941
|
+
if (instanceTitle) {
|
|
1942
|
+
return instanceTitle;
|
|
1943
|
+
}
|
|
1944
|
+
const componentUid = editorSettings?.component_uid;
|
|
1945
|
+
if (componentUid) {
|
|
1946
|
+
const component = selectComponentByUid((0, import_store35.__getState)(), componentUid);
|
|
1947
|
+
if (component?.name) {
|
|
1948
|
+
return component.name;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
return window.elementor.getElementData(this).title;
|
|
1952
|
+
},
|
|
1953
|
+
getComponentId() {
|
|
1954
|
+
return this.get("componentId") || null;
|
|
1955
|
+
},
|
|
1956
|
+
getComponentName() {
|
|
1957
|
+
return this.getTitle();
|
|
1958
|
+
},
|
|
1959
|
+
getComponentUid() {
|
|
1960
|
+
const editorSettings = this.get("editor_settings");
|
|
1961
|
+
return editorSettings?.component_uid || null;
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1875
1965
|
|
|
1876
1966
|
// src/utils/is-component-instance.ts
|
|
1877
1967
|
function isComponentInstance(elementModel) {
|
|
@@ -1905,7 +1995,7 @@ var getComponentIds = async (elements) => {
|
|
|
1905
1995
|
};
|
|
1906
1996
|
|
|
1907
1997
|
// src/store/actions/load-components-overridable-props.ts
|
|
1908
|
-
var
|
|
1998
|
+
var import_store37 = require("@elementor/store");
|
|
1909
1999
|
function loadComponentsOverridableProps(componentIds) {
|
|
1910
2000
|
if (!componentIds.length) {
|
|
1911
2001
|
return;
|
|
@@ -1913,7 +2003,7 @@ function loadComponentsOverridableProps(componentIds) {
|
|
|
1913
2003
|
componentIds.forEach(loadComponentOverrides);
|
|
1914
2004
|
}
|
|
1915
2005
|
async function loadComponentOverrides(componentId) {
|
|
1916
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0,
|
|
2006
|
+
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store37.__getState)(), componentId);
|
|
1917
2007
|
if (isOverridablePropsLoaded) {
|
|
1918
2008
|
return;
|
|
1919
2009
|
}
|
|
@@ -1921,7 +2011,7 @@ async function loadComponentOverrides(componentId) {
|
|
|
1921
2011
|
if (!overridableProps) {
|
|
1922
2012
|
return;
|
|
1923
2013
|
}
|
|
1924
|
-
(0,
|
|
2014
|
+
(0, import_store37.__dispatch)(
|
|
1925
2015
|
slice.actions.setOverridableProps({
|
|
1926
2016
|
componentId,
|
|
1927
2017
|
overridableProps
|
|
@@ -1930,12 +2020,12 @@ async function loadComponentOverrides(componentId) {
|
|
|
1930
2020
|
}
|
|
1931
2021
|
|
|
1932
2022
|
// src/store/actions/load-components-styles.ts
|
|
1933
|
-
var
|
|
2023
|
+
var import_store39 = require("@elementor/store");
|
|
1934
2024
|
async function loadComponentsStyles(componentIds) {
|
|
1935
2025
|
if (!componentIds.length) {
|
|
1936
2026
|
return;
|
|
1937
2027
|
}
|
|
1938
|
-
const knownComponents = selectStyles((0,
|
|
2028
|
+
const knownComponents = selectStyles((0, import_store39.__getState)());
|
|
1939
2029
|
const unknownComponentIds = componentIds.filter((id2) => !knownComponents[id2]);
|
|
1940
2030
|
if (!unknownComponentIds.length) {
|
|
1941
2031
|
return;
|
|
@@ -1953,7 +2043,7 @@ function addStyles(data) {
|
|
|
1953
2043
|
const styles = Object.fromEntries(
|
|
1954
2044
|
data.map(([componentId, componentData]) => [componentId, extractStyles(componentData)])
|
|
1955
2045
|
);
|
|
1956
|
-
(0,
|
|
2046
|
+
(0, import_store39.__dispatch)(slice.actions.addStyles(styles));
|
|
1957
2047
|
}
|
|
1958
2048
|
function extractStyles(element) {
|
|
1959
2049
|
return [...Object.values(element.styles ?? {}), ...(element.elements ?? []).flatMap(extractStyles)];
|
|
@@ -1978,6 +2068,52 @@ async function updateDocumentState(componentIds) {
|
|
|
1978
2068
|
}
|
|
1979
2069
|
}
|
|
1980
2070
|
|
|
2071
|
+
// src/utils/component-name-validation.ts
|
|
2072
|
+
var import_store41 = require("@elementor/store");
|
|
2073
|
+
|
|
2074
|
+
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2075
|
+
var import_schema = require("@elementor/schema");
|
|
2076
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2077
|
+
var MIN_NAME_LENGTH = 2;
|
|
2078
|
+
var MAX_NAME_LENGTH = 50;
|
|
2079
|
+
var baseComponentSchema = import_schema.z.string().trim().max(MAX_NAME_LENGTH, (0, import_i18n14.__)("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
2080
|
+
var createBaseComponentSchema = (existingNames) => {
|
|
2081
|
+
return import_schema.z.object({
|
|
2082
|
+
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
2083
|
+
message: (0, import_i18n14.__)("Component name already exists", "elementor")
|
|
2084
|
+
})
|
|
2085
|
+
});
|
|
2086
|
+
};
|
|
2087
|
+
var createSubmitComponentSchema = (existingNames) => {
|
|
2088
|
+
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2089
|
+
return baseSchema.extend({
|
|
2090
|
+
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2091
|
+
message: (0, import_i18n14.__)("Component name is required.", "elementor")
|
|
2092
|
+
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2093
|
+
message: (0, import_i18n14.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2094
|
+
})
|
|
2095
|
+
});
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
// src/utils/component-name-validation.ts
|
|
2099
|
+
function validateComponentName(label) {
|
|
2100
|
+
const existingComponentTitles = selectComponents((0, import_store41.__getState)())?.map(({ name }) => name) ?? [];
|
|
2101
|
+
const schema = createSubmitComponentSchema(existingComponentTitles);
|
|
2102
|
+
const result = schema.safeParse({ componentName: label.toLowerCase() });
|
|
2103
|
+
if (result.success) {
|
|
2104
|
+
return {
|
|
2105
|
+
isValid: true,
|
|
2106
|
+
errorMessage: null
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
const formattedErrors = result.error.format();
|
|
2110
|
+
const errorMessage = formattedErrors.componentName?._errors[0] ?? formattedErrors._errors[0];
|
|
2111
|
+
return {
|
|
2112
|
+
isValid: false,
|
|
2113
|
+
errorMessage
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
|
|
1981
2117
|
// src/utils/get-container-for-new-element.ts
|
|
1982
2118
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1983
2119
|
var getContainerForNewElement = () => {
|
|
@@ -2019,11 +2155,11 @@ var import_editor_elements5 = require("@elementor/editor-elements");
|
|
|
2019
2155
|
var replaceElementWithComponent = (element, component) => {
|
|
2020
2156
|
(0, import_editor_elements5.replaceElement)({
|
|
2021
2157
|
currentElement: element,
|
|
2022
|
-
newElement:
|
|
2158
|
+
newElement: createComponentModel2(component),
|
|
2023
2159
|
withHistory: false
|
|
2024
2160
|
});
|
|
2025
2161
|
};
|
|
2026
|
-
var
|
|
2162
|
+
var createComponentModel2 = (component) => {
|
|
2027
2163
|
return {
|
|
2028
2164
|
elType: "widget",
|
|
2029
2165
|
widgetType: "e-component",
|
|
@@ -2040,15 +2176,26 @@ var createComponentModel = (component) => {
|
|
|
2040
2176
|
overridable_props: component.overridableProps
|
|
2041
2177
|
},
|
|
2042
2178
|
editor_settings: {
|
|
2043
|
-
title: component.name,
|
|
2044
2179
|
component_uid: component.uid
|
|
2045
2180
|
}
|
|
2046
2181
|
};
|
|
2047
2182
|
};
|
|
2048
2183
|
|
|
2049
2184
|
// src/components/components-tab/components-item.tsx
|
|
2050
|
-
var ComponentItem = ({ component }) => {
|
|
2051
|
-
const
|
|
2185
|
+
var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
2186
|
+
const itemRef = (0, import_react8.useRef)(null);
|
|
2187
|
+
const {
|
|
2188
|
+
ref: editableRef,
|
|
2189
|
+
isEditing,
|
|
2190
|
+
openEditMode,
|
|
2191
|
+
error,
|
|
2192
|
+
getProps: getEditableProps
|
|
2193
|
+
} = (0, import_editor_ui6.useEditable)({
|
|
2194
|
+
value: component.name,
|
|
2195
|
+
onSubmit: renameComponent2,
|
|
2196
|
+
validation: validateComponentTitle
|
|
2197
|
+
});
|
|
2198
|
+
const componentModel = createComponentModel2(component);
|
|
2052
2199
|
const popupState = (0, import_ui12.usePopupState)({
|
|
2053
2200
|
variant: "popover",
|
|
2054
2201
|
disableAutoFocus: true
|
|
@@ -2068,47 +2215,64 @@ var ComponentItem = ({ component }) => {
|
|
|
2068
2215
|
archiveComponent(component.id);
|
|
2069
2216
|
};
|
|
2070
2217
|
return /* @__PURE__ */ React13.createElement(import_ui12.Stack, null, /* @__PURE__ */ React13.createElement(
|
|
2071
|
-
|
|
2218
|
+
import_editor_ui6.WarningInfotip,
|
|
2072
2219
|
{
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
border: "solid 1px",
|
|
2079
|
-
borderColor: "divider",
|
|
2080
|
-
py: 0.5,
|
|
2081
|
-
px: 1,
|
|
2082
|
-
display: "flex",
|
|
2083
|
-
width: "100%",
|
|
2084
|
-
alignItems: "center",
|
|
2085
|
-
gap: 1
|
|
2086
|
-
}
|
|
2220
|
+
open: Boolean(error),
|
|
2221
|
+
text: error ?? "",
|
|
2222
|
+
placement: "bottom",
|
|
2223
|
+
width: itemRef.current?.getBoundingClientRect().width,
|
|
2224
|
+
offset: [0, -15]
|
|
2087
2225
|
},
|
|
2088
2226
|
/* @__PURE__ */ React13.createElement(
|
|
2089
|
-
import_ui12.
|
|
2227
|
+
import_ui12.ListItemButton,
|
|
2090
2228
|
{
|
|
2091
|
-
|
|
2229
|
+
draggable: true,
|
|
2230
|
+
onDragStart: (event) => (0, import_editor_canvas5.startDragElementFromPanel)(componentModel, event),
|
|
2231
|
+
onDragEnd: handleDragEnd,
|
|
2232
|
+
shape: "rounded",
|
|
2233
|
+
ref: itemRef,
|
|
2092
2234
|
sx: {
|
|
2235
|
+
border: "solid 1px",
|
|
2236
|
+
borderColor: "divider",
|
|
2237
|
+
py: 0.5,
|
|
2238
|
+
px: 1,
|
|
2093
2239
|
display: "flex",
|
|
2240
|
+
width: "100%",
|
|
2094
2241
|
alignItems: "center",
|
|
2095
|
-
gap: 1
|
|
2096
|
-
minWidth: 0,
|
|
2097
|
-
flexGrow: 1
|
|
2242
|
+
gap: 1
|
|
2098
2243
|
}
|
|
2099
2244
|
},
|
|
2100
|
-
/* @__PURE__ */ React13.createElement(
|
|
2101
|
-
|
|
2102
|
-
import_editor_ui6.EllipsisWithTooltip,
|
|
2245
|
+
/* @__PURE__ */ React13.createElement(
|
|
2246
|
+
import_ui12.Box,
|
|
2103
2247
|
{
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2248
|
+
display: "flex",
|
|
2249
|
+
alignItems: "center",
|
|
2250
|
+
gap: 1,
|
|
2251
|
+
minWidth: 0,
|
|
2252
|
+
flexGrow: 1,
|
|
2253
|
+
onClick: handleClick
|
|
2254
|
+
},
|
|
2255
|
+
/* @__PURE__ */ React13.createElement(import_ui12.ListItemIcon, { size: "tiny" }, /* @__PURE__ */ React13.createElement(import_icons9.ComponentsIcon, { fontSize: "tiny" })),
|
|
2256
|
+
/* @__PURE__ */ React13.createElement(Indicator, { isActive: isEditing, isError: !!error }, /* @__PURE__ */ React13.createElement(import_ui12.Box, { display: "flex", flex: 1, minWidth: 0, flexGrow: 1 }, isEditing ? /* @__PURE__ */ React13.createElement(
|
|
2257
|
+
import_editor_ui6.EditableField,
|
|
2258
|
+
{
|
|
2259
|
+
ref: editableRef,
|
|
2260
|
+
as: import_ui12.Typography,
|
|
2261
|
+
variant: "caption",
|
|
2262
|
+
...getEditableProps()
|
|
2263
|
+
}
|
|
2264
|
+
) : /* @__PURE__ */ React13.createElement(
|
|
2265
|
+
import_editor_ui6.EllipsisWithTooltip,
|
|
2266
|
+
{
|
|
2267
|
+
title: component.name,
|
|
2268
|
+
as: import_ui12.Typography,
|
|
2269
|
+
variant: "caption",
|
|
2270
|
+
color: "text.primary"
|
|
2271
|
+
}
|
|
2272
|
+
)))
|
|
2273
|
+
),
|
|
2274
|
+
/* @__PURE__ */ React13.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React13.createElement(import_icons9.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
2275
|
+
)
|
|
2112
2276
|
), /* @__PURE__ */ React13.createElement(
|
|
2113
2277
|
import_ui12.Menu,
|
|
2114
2278
|
{
|
|
@@ -2122,7 +2286,18 @@ var ComponentItem = ({ component }) => {
|
|
|
2122
2286
|
horizontal: "right"
|
|
2123
2287
|
}
|
|
2124
2288
|
},
|
|
2125
|
-
/* @__PURE__ */ React13.createElement(
|
|
2289
|
+
/* @__PURE__ */ React13.createElement(
|
|
2290
|
+
import_editor_ui6.MenuListItem,
|
|
2291
|
+
{
|
|
2292
|
+
sx: { minWidth: "160px" },
|
|
2293
|
+
onClick: () => {
|
|
2294
|
+
popupState.close();
|
|
2295
|
+
openEditMode();
|
|
2296
|
+
}
|
|
2297
|
+
},
|
|
2298
|
+
(0, import_i18n15.__)("Rename", "elementor")
|
|
2299
|
+
),
|
|
2300
|
+
/* @__PURE__ */ React13.createElement(import_editor_ui6.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleArchiveClick }, /* @__PURE__ */ React13.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n15.__)("Archive", "elementor")))
|
|
2126
2301
|
));
|
|
2127
2302
|
};
|
|
2128
2303
|
var addComponentToPage = (model) => {
|
|
@@ -2137,6 +2312,34 @@ var addComponentToPage = (model) => {
|
|
|
2137
2312
|
options: { ...options, useHistory: false, scrollIntoView: true }
|
|
2138
2313
|
});
|
|
2139
2314
|
};
|
|
2315
|
+
var validateComponentTitle = (newTitle) => {
|
|
2316
|
+
const result = validateComponentName(newTitle);
|
|
2317
|
+
if (!result.errorMessage) {
|
|
2318
|
+
return null;
|
|
2319
|
+
}
|
|
2320
|
+
return result.errorMessage;
|
|
2321
|
+
};
|
|
2322
|
+
var Indicator = (0, import_ui12.styled)(import_ui12.Box, {
|
|
2323
|
+
shouldForwardProp: (prop) => prop !== "isActive" && prop !== "isError"
|
|
2324
|
+
})(({ theme, isActive, isError }) => ({
|
|
2325
|
+
display: "flex",
|
|
2326
|
+
width: "100%",
|
|
2327
|
+
flexGrow: 1,
|
|
2328
|
+
borderRadius: theme.spacing(0.5),
|
|
2329
|
+
border: getIndicatorBorder({ isActive, isError, theme }),
|
|
2330
|
+
padding: `0 ${theme.spacing(1)}`,
|
|
2331
|
+
marginLeft: isActive ? theme.spacing(1) : 0,
|
|
2332
|
+
minWidth: 0
|
|
2333
|
+
}));
|
|
2334
|
+
var getIndicatorBorder = ({ isActive, isError, theme }) => {
|
|
2335
|
+
if (isError) {
|
|
2336
|
+
return `2px solid ${theme.palette.error.main}`;
|
|
2337
|
+
}
|
|
2338
|
+
if (isActive) {
|
|
2339
|
+
return `2px solid ${theme.palette.secondary.main}`;
|
|
2340
|
+
}
|
|
2341
|
+
return "none";
|
|
2342
|
+
};
|
|
2140
2343
|
|
|
2141
2344
|
// src/components/components-tab/loading-components.tsx
|
|
2142
2345
|
var React14 = __toESM(require("react"));
|
|
@@ -2191,7 +2394,16 @@ function ComponentsList() {
|
|
|
2191
2394
|
}
|
|
2192
2395
|
return /* @__PURE__ */ React15.createElement(EmptyState, null);
|
|
2193
2396
|
}
|
|
2194
|
-
return /* @__PURE__ */ React15.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React15.createElement(
|
|
2397
|
+
return /* @__PURE__ */ React15.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React15.createElement(
|
|
2398
|
+
ComponentItem,
|
|
2399
|
+
{
|
|
2400
|
+
key: component.uid,
|
|
2401
|
+
component,
|
|
2402
|
+
renameComponent: (newName) => {
|
|
2403
|
+
renameComponent(component.uid, newName);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
)));
|
|
2195
2407
|
}
|
|
2196
2408
|
var EmptyState = () => {
|
|
2197
2409
|
return /* @__PURE__ */ React15.createElement(
|
|
@@ -2205,13 +2417,13 @@ var EmptyState = () => {
|
|
|
2205
2417
|
overflow: "hidden"
|
|
2206
2418
|
},
|
|
2207
2419
|
/* @__PURE__ */ React15.createElement(import_ui14.Icon, { fontSize: "large" }, /* @__PURE__ */ React15.createElement(import_icons10.EyeIcon, { fontSize: "large" })),
|
|
2208
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", fontWeight: "bold" }, (0,
|
|
2209
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { variant: "caption", align: "center", color: "text.secondary" }, (0,
|
|
2420
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", fontWeight: "bold" }, (0, import_i18n16.__)("Text that explains that there are no Components yet.", "elementor")),
|
|
2421
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { variant: "caption", align: "center", color: "text.secondary" }, (0, import_i18n16.__)(
|
|
2210
2422
|
"Once you have Components, this is where you can manage them\u2014rearrange, duplicate, rename and delete irrelevant classes.",
|
|
2211
2423
|
"elementor"
|
|
2212
2424
|
)),
|
|
2213
2425
|
/* @__PURE__ */ React15.createElement(import_ui14.Divider, { sx: { width: "100%" }, color: "text.secondary" }),
|
|
2214
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "left", variant: "caption", color: "text.secondary" }, (0,
|
|
2426
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "left", variant: "caption", color: "text.secondary" }, (0, import_i18n16.__)("To create a component, first design it, then choose one of three options:", "elementor")),
|
|
2215
2427
|
/* @__PURE__ */ React15.createElement(
|
|
2216
2428
|
import_ui14.Typography,
|
|
2217
2429
|
{
|
|
@@ -2220,9 +2432,9 @@ var EmptyState = () => {
|
|
|
2220
2432
|
color: "text.secondary",
|
|
2221
2433
|
sx: { display: "flex", flexDirection: "column" }
|
|
2222
2434
|
},
|
|
2223
|
-
/* @__PURE__ */ React15.createElement("span", null, (0,
|
|
2224
|
-
/* @__PURE__ */ React15.createElement("span", null, (0,
|
|
2225
|
-
/* @__PURE__ */ React15.createElement("span", null, (0,
|
|
2435
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n16.__)("1. Right-click and select Create Component", "elementor")),
|
|
2436
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n16.__)("2. Use the component icon in the Structure panel", "elementor")),
|
|
2437
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n16.__)("3. Use the component icon in the Edit panel header", "elementor"))
|
|
2226
2438
|
)
|
|
2227
2439
|
);
|
|
2228
2440
|
};
|
|
@@ -2246,7 +2458,7 @@ var EmptySearchResult = () => {
|
|
|
2246
2458
|
width: "100%"
|
|
2247
2459
|
}
|
|
2248
2460
|
},
|
|
2249
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, (0,
|
|
2461
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, (0, import_i18n16.__)("Sorry, nothing matched", "elementor")),
|
|
2250
2462
|
searchValue && /* @__PURE__ */ React15.createElement(
|
|
2251
2463
|
import_ui14.Typography,
|
|
2252
2464
|
{
|
|
@@ -2273,8 +2485,8 @@ var EmptySearchResult = () => {
|
|
|
2273
2485
|
/* @__PURE__ */ React15.createElement("span", null, "\u201D.")
|
|
2274
2486
|
)
|
|
2275
2487
|
),
|
|
2276
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, (0,
|
|
2277
|
-
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React15.createElement(import_ui14.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0,
|
|
2488
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, (0, import_i18n16.__)("Try something else.", "elementor")),
|
|
2489
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React15.createElement(import_ui14.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0, import_i18n16.__)("Clear & try again", "elementor")))
|
|
2278
2490
|
);
|
|
2279
2491
|
};
|
|
2280
2492
|
var useFilteredComponents = () => {
|
|
@@ -2299,7 +2511,7 @@ var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
|
2299
2511
|
|
|
2300
2512
|
// src/components/create-component-form/create-component-form.tsx
|
|
2301
2513
|
var React17 = __toESM(require("react"));
|
|
2302
|
-
var
|
|
2514
|
+
var import_react10 = require("react");
|
|
2303
2515
|
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2304
2516
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2305
2517
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
@@ -2312,11 +2524,11 @@ var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
|
2312
2524
|
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2313
2525
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
2314
2526
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2315
|
-
var
|
|
2316
|
-
var
|
|
2527
|
+
var import_store43 = require("@elementor/store");
|
|
2528
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2317
2529
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2318
2530
|
type: "default",
|
|
2319
|
-
message: (0,
|
|
2531
|
+
message: (0, import_i18n17.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2320
2532
|
id: "non-atomic-element-blocked"
|
|
2321
2533
|
};
|
|
2322
2534
|
function initNonAtomicNestingPrevention() {
|
|
@@ -2334,7 +2546,7 @@ function initNonAtomicNestingPrevention() {
|
|
|
2334
2546
|
});
|
|
2335
2547
|
}
|
|
2336
2548
|
function isEditingComponent() {
|
|
2337
|
-
const state = (0,
|
|
2549
|
+
const state = (0, import_store43.__getStore)()?.getState();
|
|
2338
2550
|
if (!state) {
|
|
2339
2551
|
return false;
|
|
2340
2552
|
}
|
|
@@ -2423,18 +2635,18 @@ function findNonAtomicElementsInElement(element) {
|
|
|
2423
2635
|
|
|
2424
2636
|
// src/store/actions/create-unpublished-component.ts
|
|
2425
2637
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2426
|
-
var
|
|
2638
|
+
var import_store45 = require("@elementor/store");
|
|
2427
2639
|
var import_utils4 = require("@elementor/utils");
|
|
2428
2640
|
function createUnpublishedComponent(name, element, eventData, overridableProps, uid) {
|
|
2429
2641
|
const generatedUid = uid ?? (0, import_utils4.generateUniqueId)("component");
|
|
2430
2642
|
const componentBase = { uid: generatedUid, name, overridableProps };
|
|
2431
|
-
(0,
|
|
2643
|
+
(0, import_store45.__dispatch)(
|
|
2432
2644
|
slice.actions.addUnpublished({
|
|
2433
2645
|
...componentBase,
|
|
2434
2646
|
elements: [element]
|
|
2435
2647
|
})
|
|
2436
2648
|
);
|
|
2437
|
-
(0,
|
|
2649
|
+
(0, import_store45.__dispatch)(slice.actions.addCreatedThisSession(generatedUid));
|
|
2438
2650
|
replaceElementWithComponent(element, componentBase);
|
|
2439
2651
|
trackComponentEvent({
|
|
2440
2652
|
action: "created",
|
|
@@ -2447,11 +2659,11 @@ function createUnpublishedComponent(name, element, eventData, overridableProps,
|
|
|
2447
2659
|
}
|
|
2448
2660
|
|
|
2449
2661
|
// src/components/create-component-form/hooks/use-form.ts
|
|
2450
|
-
var
|
|
2662
|
+
var import_react9 = require("react");
|
|
2451
2663
|
var useForm = (initialValues) => {
|
|
2452
|
-
const [values, setValues] = (0,
|
|
2453
|
-
const [errors, setErrors] = (0,
|
|
2454
|
-
const isValid = (0,
|
|
2664
|
+
const [values, setValues] = (0, import_react9.useState)(initialValues);
|
|
2665
|
+
const [errors, setErrors] = (0, import_react9.useState)({});
|
|
2666
|
+
const isValid = (0, import_react9.useMemo)(() => {
|
|
2455
2667
|
return !Object.values(errors).some((error) => error);
|
|
2456
2668
|
}, [errors]);
|
|
2457
2669
|
const handleChange = (e, field, validationSchema) => {
|
|
@@ -2495,32 +2707,6 @@ var validateForm = (values, schema) => {
|
|
|
2495
2707
|
return { success: false, errors };
|
|
2496
2708
|
};
|
|
2497
2709
|
|
|
2498
|
-
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2499
|
-
var import_schema = require("@elementor/schema");
|
|
2500
|
-
var import_i18n17 = require("@wordpress/i18n");
|
|
2501
|
-
var MIN_NAME_LENGTH = 2;
|
|
2502
|
-
var MAX_NAME_LENGTH = 50;
|
|
2503
|
-
var createBaseComponentSchema = (existingNames) => {
|
|
2504
|
-
return import_schema.z.object({
|
|
2505
|
-
componentName: import_schema.z.string().trim().max(
|
|
2506
|
-
MAX_NAME_LENGTH,
|
|
2507
|
-
(0, import_i18n17.__)("Component name is too long. Please keep it under 50 characters.", "elementor")
|
|
2508
|
-
).refine((value) => !existingNames.includes(value), {
|
|
2509
|
-
message: (0, import_i18n17.__)("Component name already exists", "elementor")
|
|
2510
|
-
})
|
|
2511
|
-
});
|
|
2512
|
-
};
|
|
2513
|
-
var createSubmitComponentSchema = (existingNames) => {
|
|
2514
|
-
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2515
|
-
return baseSchema.extend({
|
|
2516
|
-
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2517
|
-
message: (0, import_i18n17.__)("Component name is required.", "elementor")
|
|
2518
|
-
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2519
|
-
message: (0, import_i18n17.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2520
|
-
})
|
|
2521
|
-
});
|
|
2522
|
-
};
|
|
2523
|
-
|
|
2524
2710
|
// src/components/create-component-form/utils/get-component-event-data.ts
|
|
2525
2711
|
var getComponentEventData = (containerElement, options) => {
|
|
2526
2712
|
const { elementsCount, componentsCount } = countNestedElements(containerElement);
|
|
@@ -2552,11 +2738,11 @@ function countNestedElements(container) {
|
|
|
2552
2738
|
|
|
2553
2739
|
// src/components/create-component-form/create-component-form.tsx
|
|
2554
2740
|
function CreateComponentForm() {
|
|
2555
|
-
const [element, setElement] = (0,
|
|
2556
|
-
const [anchorPosition, setAnchorPosition] = (0,
|
|
2557
|
-
const [resultNotification, setResultNotification] = (0,
|
|
2558
|
-
const eventData = (0,
|
|
2559
|
-
(0,
|
|
2741
|
+
const [element, setElement] = (0, import_react10.useState)(null);
|
|
2742
|
+
const [anchorPosition, setAnchorPosition] = (0, import_react10.useState)();
|
|
2743
|
+
const [resultNotification, setResultNotification] = (0, import_react10.useState)(null);
|
|
2744
|
+
const eventData = (0, import_react10.useRef)(null);
|
|
2745
|
+
(0, import_react10.useEffect)(() => {
|
|
2560
2746
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
2561
2747
|
const openPopup = (event) => {
|
|
2562
2748
|
const nonAtomicElements = findNonAtomicElementsInElement(event.detail.element);
|
|
@@ -2651,14 +2837,14 @@ var Form2 = ({
|
|
|
2651
2837
|
}) => {
|
|
2652
2838
|
const { values, errors, isValid, handleChange, validateForm: validateForm2 } = useForm(initialValues);
|
|
2653
2839
|
const { components } = useComponents();
|
|
2654
|
-
const existingComponentNames = (0,
|
|
2840
|
+
const existingComponentNames = (0, import_react10.useMemo)(() => {
|
|
2655
2841
|
return components?.map((component) => component.name) ?? [];
|
|
2656
2842
|
}, [components]);
|
|
2657
|
-
const changeValidationSchema = (0,
|
|
2843
|
+
const changeValidationSchema = (0, import_react10.useMemo)(
|
|
2658
2844
|
() => createBaseComponentSchema(existingComponentNames),
|
|
2659
2845
|
[existingComponentNames]
|
|
2660
2846
|
);
|
|
2661
|
-
const submitValidationSchema = (0,
|
|
2847
|
+
const submitValidationSchema = (0, import_react10.useMemo)(
|
|
2662
2848
|
() => createSubmitComponentSchema(existingComponentNames),
|
|
2663
2849
|
[existingComponentNames]
|
|
2664
2850
|
);
|
|
@@ -2703,30 +2889,30 @@ var Form2 = ({
|
|
|
2703
2889
|
|
|
2704
2890
|
// src/components/edit-component/edit-component.tsx
|
|
2705
2891
|
var React19 = __toESM(require("react"));
|
|
2706
|
-
var
|
|
2892
|
+
var import_react13 = require("react");
|
|
2707
2893
|
var import_editor_documents10 = require("@elementor/editor-documents");
|
|
2708
2894
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
2709
|
-
var
|
|
2895
|
+
var import_store49 = require("@elementor/store");
|
|
2710
2896
|
var import_utils6 = require("@elementor/utils");
|
|
2711
2897
|
|
|
2712
2898
|
// src/store/actions/update-current-component.ts
|
|
2713
2899
|
var import_editor_documents9 = require("@elementor/editor-documents");
|
|
2714
|
-
var
|
|
2900
|
+
var import_store47 = require("@elementor/store");
|
|
2715
2901
|
function updateCurrentComponent({
|
|
2716
2902
|
path,
|
|
2717
2903
|
currentComponentId
|
|
2718
2904
|
}) {
|
|
2719
|
-
const
|
|
2720
|
-
if (!
|
|
2905
|
+
const dispatch18 = (0, import_store47.__getStore)()?.dispatch;
|
|
2906
|
+
if (!dispatch18) {
|
|
2721
2907
|
return;
|
|
2722
2908
|
}
|
|
2723
|
-
|
|
2724
|
-
|
|
2909
|
+
dispatch18(slice.actions.setPath(path));
|
|
2910
|
+
dispatch18(slice.actions.setCurrentComponentId(currentComponentId));
|
|
2725
2911
|
}
|
|
2726
2912
|
|
|
2727
2913
|
// src/components/edit-component/component-modal.tsx
|
|
2728
2914
|
var React18 = __toESM(require("react"));
|
|
2729
|
-
var
|
|
2915
|
+
var import_react12 = require("react");
|
|
2730
2916
|
var import_react_dom = require("react-dom");
|
|
2731
2917
|
var import_i18n19 = require("@wordpress/i18n");
|
|
2732
2918
|
|
|
@@ -2738,10 +2924,10 @@ function useCanvasDocument() {
|
|
|
2738
2924
|
}
|
|
2739
2925
|
|
|
2740
2926
|
// src/hooks/use-element-rect.ts
|
|
2741
|
-
var
|
|
2927
|
+
var import_react11 = require("react");
|
|
2742
2928
|
var import_utils5 = require("@elementor/utils");
|
|
2743
2929
|
function useElementRect(element) {
|
|
2744
|
-
const [rect, setRect] = (0,
|
|
2930
|
+
const [rect, setRect] = (0, import_react11.useState)(new DOMRect(0, 0, 0, 0));
|
|
2745
2931
|
const onChange = (0, import_utils5.throttle)(
|
|
2746
2932
|
() => {
|
|
2747
2933
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -2752,7 +2938,7 @@ function useElementRect(element) {
|
|
|
2752
2938
|
useScrollListener({ element, onChange });
|
|
2753
2939
|
useResizeListener({ element, onChange });
|
|
2754
2940
|
useMutationsListener({ element, onChange });
|
|
2755
|
-
(0,
|
|
2941
|
+
(0, import_react11.useEffect)(
|
|
2756
2942
|
() => () => {
|
|
2757
2943
|
onChange.cancel();
|
|
2758
2944
|
},
|
|
@@ -2761,7 +2947,7 @@ function useElementRect(element) {
|
|
|
2761
2947
|
return rect;
|
|
2762
2948
|
}
|
|
2763
2949
|
function useScrollListener({ element, onChange }) {
|
|
2764
|
-
(0,
|
|
2950
|
+
(0, import_react11.useEffect)(() => {
|
|
2765
2951
|
if (!element) {
|
|
2766
2952
|
return;
|
|
2767
2953
|
}
|
|
@@ -2773,7 +2959,7 @@ function useScrollListener({ element, onChange }) {
|
|
|
2773
2959
|
}, [element, onChange]);
|
|
2774
2960
|
}
|
|
2775
2961
|
function useResizeListener({ element, onChange }) {
|
|
2776
|
-
(0,
|
|
2962
|
+
(0, import_react11.useEffect)(() => {
|
|
2777
2963
|
if (!element) {
|
|
2778
2964
|
return;
|
|
2779
2965
|
}
|
|
@@ -2788,7 +2974,7 @@ function useResizeListener({ element, onChange }) {
|
|
|
2788
2974
|
}, [element, onChange]);
|
|
2789
2975
|
}
|
|
2790
2976
|
function useMutationsListener({ element, onChange }) {
|
|
2791
|
-
(0,
|
|
2977
|
+
(0, import_react11.useEffect)(() => {
|
|
2792
2978
|
if (!element) {
|
|
2793
2979
|
return;
|
|
2794
2980
|
}
|
|
@@ -2803,7 +2989,7 @@ function useMutationsListener({ element, onChange }) {
|
|
|
2803
2989
|
// src/components/edit-component/component-modal.tsx
|
|
2804
2990
|
function ComponentModal({ element, onClose }) {
|
|
2805
2991
|
const canvasDocument = useCanvasDocument();
|
|
2806
|
-
(0,
|
|
2992
|
+
(0, import_react12.useEffect)(() => {
|
|
2807
2993
|
const handleEsc = (event) => {
|
|
2808
2994
|
if (event.key === "Escape") {
|
|
2809
2995
|
onClose();
|
|
@@ -2918,8 +3104,8 @@ function EditComponent() {
|
|
|
2918
3104
|
function useHandleDocumentSwitches() {
|
|
2919
3105
|
const documentsManager = (0, import_editor_documents10.getV1DocumentsManager)();
|
|
2920
3106
|
const currentComponentId = useCurrentComponentId();
|
|
2921
|
-
const path = (0,
|
|
2922
|
-
(0,
|
|
3107
|
+
const path = (0, import_store49.__useSelector)(selectPath);
|
|
3108
|
+
(0, import_react13.useEffect)(() => {
|
|
2923
3109
|
return (0, import_editor_v1_adapters6.__privateListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/open"), () => {
|
|
2924
3110
|
const nextDocument = documentsManager.getCurrent();
|
|
2925
3111
|
if (nextDocument.id === currentComponentId) {
|
|
@@ -2945,14 +3131,31 @@ function getUpdatedComponentPath(path, nextDocument) {
|
|
|
2945
3131
|
if (componentIndex >= 0) {
|
|
2946
3132
|
return path.slice(0, componentIndex + 1);
|
|
2947
3133
|
}
|
|
3134
|
+
const instanceId = nextDocument?.container.view?.el?.dataset.id;
|
|
3135
|
+
const instanceTitle = getInstanceTitle(instanceId, path);
|
|
2948
3136
|
return [
|
|
2949
3137
|
...path,
|
|
2950
3138
|
{
|
|
2951
|
-
instanceId
|
|
3139
|
+
instanceId,
|
|
3140
|
+
instanceTitle,
|
|
2952
3141
|
componentId: nextDocument.id
|
|
2953
3142
|
}
|
|
2954
3143
|
];
|
|
2955
3144
|
}
|
|
3145
|
+
function getInstanceTitle(instanceId, path) {
|
|
3146
|
+
if (!instanceId) {
|
|
3147
|
+
return void 0;
|
|
3148
|
+
}
|
|
3149
|
+
const documentsManager = (0, import_editor_documents10.getV1DocumentsManager)();
|
|
3150
|
+
const parentDocId = path.at(-1)?.componentId ?? documentsManager.getInitialId();
|
|
3151
|
+
const parentDoc = documentsManager.get(parentDocId);
|
|
3152
|
+
const parentContainer = parentDoc?.container;
|
|
3153
|
+
const widget = parentContainer?.children?.findRecursive?.(
|
|
3154
|
+
(container) => container.id === instanceId
|
|
3155
|
+
);
|
|
3156
|
+
const editorSettings = widget?.model?.get?.("editor_settings");
|
|
3157
|
+
return editorSettings?.title;
|
|
3158
|
+
}
|
|
2956
3159
|
function getComponentDOMElement(id2) {
|
|
2957
3160
|
if (!id2) {
|
|
2958
3161
|
return null;
|
|
@@ -3085,7 +3288,7 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
3085
3288
|
|
|
3086
3289
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
3087
3290
|
var React24 = __toESM(require("react"));
|
|
3088
|
-
var
|
|
3291
|
+
var import_react14 = require("react");
|
|
3089
3292
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
3090
3293
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
3091
3294
|
var import_ui20 = require("@elementor/ui");
|
|
@@ -3128,9 +3331,9 @@ function getControlsByBind(controls) {
|
|
|
3128
3331
|
}
|
|
3129
3332
|
|
|
3130
3333
|
// src/store/actions/update-overridable-prop.ts
|
|
3131
|
-
var
|
|
3334
|
+
var import_store51 = require("@elementor/store");
|
|
3132
3335
|
function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
3133
|
-
const overridableProps = selectOverridableProps((0,
|
|
3336
|
+
const overridableProps = selectOverridableProps((0, import_store51.__getState)(), componentId);
|
|
3134
3337
|
if (!overridableProps) {
|
|
3135
3338
|
return;
|
|
3136
3339
|
}
|
|
@@ -3154,7 +3357,7 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
|
3154
3357
|
}
|
|
3155
3358
|
}
|
|
3156
3359
|
};
|
|
3157
|
-
(0,
|
|
3360
|
+
(0, import_store51.__dispatch)(
|
|
3158
3361
|
slice.actions.setOverridableProps({
|
|
3159
3362
|
componentId,
|
|
3160
3363
|
overridableProps: newOverridableProps
|
|
@@ -3309,7 +3512,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
3309
3512
|
const handleClick = () => {
|
|
3310
3513
|
setIsOpen(!isOpen);
|
|
3311
3514
|
};
|
|
3312
|
-
const id2 = (0,
|
|
3515
|
+
const id2 = (0, import_react14.useId)();
|
|
3313
3516
|
const labelId = `label-${id2}`;
|
|
3314
3517
|
const contentId = `content-${id2}`;
|
|
3315
3518
|
const title = group.label;
|
|
@@ -3376,12 +3579,12 @@ var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
|
3376
3579
|
|
|
3377
3580
|
// src/provider/overridable-prop-context.tsx
|
|
3378
3581
|
var React26 = __toESM(require("react"));
|
|
3379
|
-
var
|
|
3380
|
-
var OverridablePropContext = (0,
|
|
3582
|
+
var import_react15 = require("react");
|
|
3583
|
+
var OverridablePropContext = (0, import_react15.createContext)(null);
|
|
3381
3584
|
function OverridablePropProvider({ children, ...props }) {
|
|
3382
3585
|
return /* @__PURE__ */ React26.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3383
3586
|
}
|
|
3384
|
-
var useOverridablePropValue = () => (0,
|
|
3587
|
+
var useOverridablePropValue = () => (0, import_react15.useContext)(OverridablePropContext)?.value;
|
|
3385
3588
|
|
|
3386
3589
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
3387
3590
|
function OverridablePropControl({
|
|
@@ -3439,7 +3642,7 @@ var import_ui23 = require("@elementor/ui");
|
|
|
3439
3642
|
var import_i18n24 = require("@wordpress/i18n");
|
|
3440
3643
|
|
|
3441
3644
|
// src/store/actions/set-overridable-prop.ts
|
|
3442
|
-
var
|
|
3645
|
+
var import_store56 = require("@elementor/store");
|
|
3443
3646
|
var import_utils7 = require("@elementor/utils");
|
|
3444
3647
|
function setOverridableProp({
|
|
3445
3648
|
componentId,
|
|
@@ -3453,7 +3656,7 @@ function setOverridableProp({
|
|
|
3453
3656
|
originValue,
|
|
3454
3657
|
originPropFields
|
|
3455
3658
|
}) {
|
|
3456
|
-
const overridableProps = selectOverridableProps((0,
|
|
3659
|
+
const overridableProps = selectOverridableProps((0, import_store56.__getState)(), componentId);
|
|
3457
3660
|
if (!overridableProps) {
|
|
3458
3661
|
return;
|
|
3459
3662
|
}
|
|
@@ -3490,7 +3693,7 @@ function setOverridableProp({
|
|
|
3490
3693
|
if (isChangingGroups) {
|
|
3491
3694
|
groups = removePropFromGroup(groups, existingOverridableProp.groupId, overridableProp.overrideKey);
|
|
3492
3695
|
}
|
|
3493
|
-
(0,
|
|
3696
|
+
(0, import_store56.__dispatch)(
|
|
3494
3697
|
slice.actions.setOverridableProps({
|
|
3495
3698
|
componentId,
|
|
3496
3699
|
overridableProps: {
|
|
@@ -3504,7 +3707,7 @@ function setOverridableProp({
|
|
|
3504
3707
|
|
|
3505
3708
|
// src/components/overridable-props/indicator.tsx
|
|
3506
3709
|
var React28 = __toESM(require("react"));
|
|
3507
|
-
var
|
|
3710
|
+
var import_react16 = require("react");
|
|
3508
3711
|
var import_icons15 = require("@elementor/icons");
|
|
3509
3712
|
var import_ui22 = require("@elementor/ui");
|
|
3510
3713
|
var import_i18n23 = require("@wordpress/i18n");
|
|
@@ -3563,7 +3766,7 @@ var Content = (0, import_ui22.styled)(import_ui22.Box)`
|
|
|
3563
3766
|
}
|
|
3564
3767
|
}
|
|
3565
3768
|
`;
|
|
3566
|
-
var
|
|
3769
|
+
var Indicator2 = (0, import_react16.forwardRef)(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React28.createElement(Content, { ref, ...props, className: isOpen || isOverridable ? "enlarged" : "" }, /* @__PURE__ */ React28.createElement(
|
|
3567
3770
|
IconContainer,
|
|
3568
3771
|
{
|
|
3569
3772
|
className: "icon",
|
|
@@ -3573,12 +3776,12 @@ var Indicator = (0, import_react15.forwardRef)(({ isOpen, isOverridable, ...prop
|
|
|
3573
3776
|
)));
|
|
3574
3777
|
|
|
3575
3778
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
3576
|
-
var
|
|
3779
|
+
var import_store58 = require("@elementor/store");
|
|
3577
3780
|
function getOverridableProp({
|
|
3578
3781
|
componentId,
|
|
3579
3782
|
overrideKey
|
|
3580
3783
|
}) {
|
|
3581
|
-
const overridableProps = selectOverridableProps((0,
|
|
3784
|
+
const overridableProps = selectOverridableProps((0, import_store58.__getState)(), componentId);
|
|
3582
3785
|
if (!overridableProps) {
|
|
3583
3786
|
return void 0;
|
|
3584
3787
|
}
|
|
@@ -3638,7 +3841,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3638
3841
|
popupState.close();
|
|
3639
3842
|
};
|
|
3640
3843
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
3641
|
-
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(import_ui23.Tooltip, { placement: "top", title: (0, import_i18n24.__)("Override Property", "elementor") }, /* @__PURE__ */ React29.createElement(
|
|
3844
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(import_ui23.Tooltip, { placement: "top", title: (0, import_i18n24.__)("Override Property", "elementor") }, /* @__PURE__ */ React29.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React29.createElement(
|
|
3642
3845
|
import_ui23.Popover,
|
|
3643
3846
|
{
|
|
3644
3847
|
disableScrollLock: true,
|
|
@@ -4087,11 +4290,11 @@ function initMcp() {
|
|
|
4087
4290
|
}
|
|
4088
4291
|
|
|
4089
4292
|
// src/populate-store.ts
|
|
4090
|
-
var
|
|
4091
|
-
var
|
|
4293
|
+
var import_react17 = require("react");
|
|
4294
|
+
var import_store61 = require("@elementor/store");
|
|
4092
4295
|
function PopulateStore() {
|
|
4093
|
-
(0,
|
|
4094
|
-
(0,
|
|
4296
|
+
(0, import_react17.useEffect)(() => {
|
|
4297
|
+
(0, import_store61.__dispatch)(loadComponents());
|
|
4095
4298
|
}, []);
|
|
4096
4299
|
return null;
|
|
4097
4300
|
}
|
|
@@ -4100,7 +4303,7 @@ function PopulateStore() {
|
|
|
4100
4303
|
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
4101
4304
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
4102
4305
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
4103
|
-
var
|
|
4306
|
+
var import_store62 = require("@elementor/store");
|
|
4104
4307
|
var import_i18n25 = require("@wordpress/i18n");
|
|
4105
4308
|
var COMPONENT_TYPE = "e-component";
|
|
4106
4309
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
@@ -4126,7 +4329,7 @@ function wouldCreateCircularNesting(componentIdToAdd) {
|
|
|
4126
4329
|
if (componentIdToAdd === void 0) {
|
|
4127
4330
|
return false;
|
|
4128
4331
|
}
|
|
4129
|
-
const state = (0,
|
|
4332
|
+
const state = (0, import_store62.__getState)();
|
|
4130
4333
|
const currentComponentId = selectCurrentComponentId(state);
|
|
4131
4334
|
const path = selectPath(state);
|
|
4132
4335
|
if (currentComponentId === null) {
|
|
@@ -4224,19 +4427,19 @@ function blockCircularPaste(args) {
|
|
|
4224
4427
|
}
|
|
4225
4428
|
|
|
4226
4429
|
// src/store/actions/remove-component-styles.ts
|
|
4227
|
-
var
|
|
4430
|
+
var import_store64 = require("@elementor/store");
|
|
4228
4431
|
function removeComponentStyles(id2) {
|
|
4229
4432
|
apiClient.invalidateComponentConfigCache(id2);
|
|
4230
|
-
(0,
|
|
4433
|
+
(0, import_store64.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
4231
4434
|
}
|
|
4232
4435
|
|
|
4233
4436
|
// src/store/components-styles-provider.ts
|
|
4234
4437
|
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
4235
|
-
var
|
|
4438
|
+
var import_store66 = require("@elementor/store");
|
|
4236
4439
|
var componentsStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
4237
4440
|
key: "components-styles",
|
|
4238
4441
|
priority: 100,
|
|
4239
|
-
subscribe: (cb) => (0,
|
|
4442
|
+
subscribe: (cb) => (0, import_store66.__subscribeWithSelector)(
|
|
4240
4443
|
(state) => state[SLICE_NAME],
|
|
4241
4444
|
() => {
|
|
4242
4445
|
cb();
|
|
@@ -4244,29 +4447,29 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
4244
4447
|
),
|
|
4245
4448
|
actions: {
|
|
4246
4449
|
all: () => {
|
|
4247
|
-
return selectFlatStyles((0,
|
|
4450
|
+
return selectFlatStyles((0, import_store66.__getState)());
|
|
4248
4451
|
},
|
|
4249
4452
|
get: (id2) => {
|
|
4250
|
-
return selectFlatStyles((0,
|
|
4453
|
+
return selectFlatStyles((0, import_store66.__getState)()).find((style) => style.id === id2) ?? null;
|
|
4251
4454
|
}
|
|
4252
4455
|
}
|
|
4253
4456
|
});
|
|
4254
4457
|
|
|
4255
4458
|
// src/sync/create-components-before-save.ts
|
|
4256
4459
|
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
4257
|
-
var
|
|
4460
|
+
var import_store68 = require("@elementor/store");
|
|
4258
4461
|
async function createComponentsBeforeSave({
|
|
4259
4462
|
elements,
|
|
4260
4463
|
status
|
|
4261
4464
|
}) {
|
|
4262
|
-
const unpublishedComponents = selectUnpublishedComponents((0,
|
|
4465
|
+
const unpublishedComponents = selectUnpublishedComponents((0, import_store68.__getState)());
|
|
4263
4466
|
if (!unpublishedComponents.length) {
|
|
4264
4467
|
return;
|
|
4265
4468
|
}
|
|
4266
4469
|
try {
|
|
4267
4470
|
const uidToComponentId = await createComponents(unpublishedComponents, status);
|
|
4268
4471
|
updateComponentInstances(elements, uidToComponentId);
|
|
4269
|
-
(0,
|
|
4472
|
+
(0, import_store68.__dispatch)(
|
|
4270
4473
|
slice.actions.add(
|
|
4271
4474
|
unpublishedComponents.map((component) => ({
|
|
4272
4475
|
id: uidToComponentId.get(component.uid),
|
|
@@ -4276,7 +4479,7 @@ async function createComponentsBeforeSave({
|
|
|
4276
4479
|
}))
|
|
4277
4480
|
)
|
|
4278
4481
|
);
|
|
4279
|
-
(0,
|
|
4482
|
+
(0, import_store68.__dispatch)(slice.actions.resetUnpublished());
|
|
4280
4483
|
} catch (error) {
|
|
4281
4484
|
throw new Error(`Failed to publish components and update component instances: ${error}`);
|
|
4282
4485
|
}
|
|
@@ -4336,7 +4539,7 @@ function updateElementComponentId(elementId, componentId) {
|
|
|
4336
4539
|
}
|
|
4337
4540
|
|
|
4338
4541
|
// src/sync/set-component-overridable-props-settings-before-save.ts
|
|
4339
|
-
var
|
|
4542
|
+
var import_store70 = require("@elementor/store");
|
|
4340
4543
|
var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
4341
4544
|
container
|
|
4342
4545
|
}) => {
|
|
@@ -4344,7 +4547,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
4344
4547
|
if (!currentDocument || currentDocument.config.type !== COMPONENT_DOCUMENT_TYPE) {
|
|
4345
4548
|
return;
|
|
4346
4549
|
}
|
|
4347
|
-
const overridableProps = selectOverridableProps((0,
|
|
4550
|
+
const overridableProps = selectOverridableProps((0, import_store70.__getState)(), currentDocument.id);
|
|
4348
4551
|
if (overridableProps) {
|
|
4349
4552
|
container.settings.set("overridable_props", overridableProps);
|
|
4350
4553
|
}
|
|
@@ -4352,7 +4555,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
4352
4555
|
|
|
4353
4556
|
// src/sync/update-archived-component-before-save.ts
|
|
4354
4557
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
4355
|
-
var
|
|
4558
|
+
var import_store72 = require("@elementor/store");
|
|
4356
4559
|
var failedNotification = (message) => ({
|
|
4357
4560
|
type: "error",
|
|
4358
4561
|
message: `Failed to archive components: ${message}`,
|
|
@@ -4365,7 +4568,7 @@ var successNotification = (message) => ({
|
|
|
4365
4568
|
});
|
|
4366
4569
|
var updateArchivedComponentBeforeSave = async () => {
|
|
4367
4570
|
try {
|
|
4368
|
-
const archivedComponents = selectArchivedComponents((0,
|
|
4571
|
+
const archivedComponents = selectArchivedComponents((0, import_store72.__getState)());
|
|
4369
4572
|
if (!archivedComponents.length) {
|
|
4370
4573
|
return;
|
|
4371
4574
|
}
|
|
@@ -4385,6 +4588,19 @@ var updateArchivedComponentBeforeSave = async () => {
|
|
|
4385
4588
|
}
|
|
4386
4589
|
};
|
|
4387
4590
|
|
|
4591
|
+
// src/sync/update-component-title-before-save.ts
|
|
4592
|
+
var import_store74 = require("@elementor/store");
|
|
4593
|
+
var updateComponentTitleBeforeSave = async () => {
|
|
4594
|
+
const updatedComponentNames = selectUpdatedComponentNames((0, import_store74.__getState)());
|
|
4595
|
+
if (!updatedComponentNames.length) {
|
|
4596
|
+
return;
|
|
4597
|
+
}
|
|
4598
|
+
const result = await apiClient.updateComponentTitle(updatedComponentNames);
|
|
4599
|
+
if (result.failedIds.length === 0) {
|
|
4600
|
+
(0, import_store74.__dispatch)(slice.actions.cleanUpdatedComponentNames());
|
|
4601
|
+
}
|
|
4602
|
+
};
|
|
4603
|
+
|
|
4388
4604
|
// src/sync/update-components-before-save.ts
|
|
4389
4605
|
var import_editor_documents11 = require("@elementor/editor-documents");
|
|
4390
4606
|
async function updateComponentsBeforeSave({ status, elements }) {
|
|
@@ -4408,14 +4624,15 @@ var beforeSave = ({ container, status }) => {
|
|
|
4408
4624
|
updateArchivedComponentBeforeSave(),
|
|
4409
4625
|
createComponentsBeforeSave({ elements, status }),
|
|
4410
4626
|
updateComponentsBeforeSave({ elements, status }),
|
|
4411
|
-
setComponentOverridablePropsSettingsBeforeSave({ container })
|
|
4627
|
+
setComponentOverridablePropsSettingsBeforeSave({ container }),
|
|
4628
|
+
updateComponentTitleBeforeSave()
|
|
4412
4629
|
]);
|
|
4413
4630
|
};
|
|
4414
4631
|
|
|
4415
4632
|
// src/init.ts
|
|
4416
4633
|
function init() {
|
|
4417
4634
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
4418
|
-
(0,
|
|
4635
|
+
(0, import_store76.__registerSlice)(slice);
|
|
4419
4636
|
(0, import_editor_panels4.__registerPanel)(panel);
|
|
4420
4637
|
(0, import_editor_canvas9.registerElementType)(
|
|
4421
4638
|
COMPONENT_WIDGET_TYPE,
|