@elementor/editor-global-classes 4.0.0-552 → 4.0.0-573
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 +88 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-item.tsx +19 -0
- package/src/components/class-manager/class-manager-panel.tsx +58 -3
- package/src/components/class-manager/global-classes-list.tsx +25 -9
package/dist/index.js
CHANGED
|
@@ -598,7 +598,7 @@ var import_react8 = require("react");
|
|
|
598
598
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
599
599
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
600
600
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
601
|
-
var
|
|
601
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
602
602
|
var import_icons11 = require("@elementor/icons");
|
|
603
603
|
var import_query3 = require("@elementor/query");
|
|
604
604
|
var import_store20 = require("@elementor/store");
|
|
@@ -1247,6 +1247,7 @@ var React15 = __toESM(require("react"));
|
|
|
1247
1247
|
var import_react6 = require("react");
|
|
1248
1248
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
1249
1249
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
1250
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1250
1251
|
var import_icons9 = require("@elementor/icons");
|
|
1251
1252
|
var import_ui12 = require("@elementor/ui");
|
|
1252
1253
|
var import_i18n11 = require("@wordpress/i18n");
|
|
@@ -1611,7 +1612,9 @@ var ClassItem = ({
|
|
|
1611
1612
|
selected,
|
|
1612
1613
|
disabled,
|
|
1613
1614
|
sortableTriggerProps,
|
|
1614
|
-
showSortIndicator
|
|
1615
|
+
showSortIndicator,
|
|
1616
|
+
syncToV3,
|
|
1617
|
+
onToggleSync
|
|
1615
1618
|
}) => {
|
|
1616
1619
|
const itemRef = (0, import_react6.useRef)(null);
|
|
1617
1620
|
const {
|
|
@@ -1700,6 +1703,16 @@ var ClassItem = ({
|
|
|
1700
1703
|
},
|
|
1701
1704
|
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n11.__)("Rename", "elementor"))
|
|
1702
1705
|
),
|
|
1706
|
+
(0, import_editor_v1_adapters2.isExperimentActive)("e_design_system_sync") && onToggleSync && /* @__PURE__ */ React15.createElement(
|
|
1707
|
+
import_editor_ui8.MenuListItem,
|
|
1708
|
+
{
|
|
1709
|
+
onClick: () => {
|
|
1710
|
+
popupState.close();
|
|
1711
|
+
onToggleSync(id2, !syncToV3);
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? (0, import_i18n11.__)("Stop syncing to Version 3", "elementor") : (0, import_i18n11.__)("Sync to Version 3", "elementor"))
|
|
1715
|
+
),
|
|
1703
1716
|
/* @__PURE__ */ React15.createElement(
|
|
1704
1717
|
import_editor_ui8.MenuListItem,
|
|
1705
1718
|
{
|
|
@@ -1880,7 +1893,7 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1880
1893
|
);
|
|
1881
1894
|
|
|
1882
1895
|
// src/components/class-manager/global-classes-list.tsx
|
|
1883
|
-
var GlobalClassesList = ({ disabled }) => {
|
|
1896
|
+
var GlobalClassesList = ({ disabled, onStopSyncRequest }) => {
|
|
1884
1897
|
const {
|
|
1885
1898
|
search: { debouncedValue: searchValue }
|
|
1886
1899
|
} = useSearchAndFilters();
|
|
@@ -1924,27 +1937,27 @@ var GlobalClassesList = ({ disabled }) => {
|
|
|
1924
1937
|
onChange: reorderClasses,
|
|
1925
1938
|
disableDragOverlay: !allowSorting
|
|
1926
1939
|
},
|
|
1927
|
-
filteredCssClasses?.map((
|
|
1940
|
+
filteredCssClasses?.map((cssClass) => /* @__PURE__ */ React17.createElement(SortableItem, { key: cssClass.id, id: cssClass.id }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => {
|
|
1928
1941
|
if (isDragged && !draggedItemId) {
|
|
1929
|
-
setDraggedItemId(
|
|
1942
|
+
setDraggedItemId(cssClass.id);
|
|
1930
1943
|
}
|
|
1931
1944
|
return /* @__PURE__ */ React17.createElement(
|
|
1932
1945
|
ClassItem,
|
|
1933
1946
|
{
|
|
1934
|
-
id:
|
|
1935
|
-
label,
|
|
1947
|
+
id: cssClass.id,
|
|
1948
|
+
label: cssClass.label,
|
|
1936
1949
|
renameClass: (newLabel) => {
|
|
1937
1950
|
trackGlobalClasses({
|
|
1938
1951
|
event: "classRenamed",
|
|
1939
|
-
classId:
|
|
1940
|
-
oldValue: label,
|
|
1952
|
+
classId: cssClass.id,
|
|
1953
|
+
oldValue: cssClass.label,
|
|
1941
1954
|
newValue: newLabel,
|
|
1942
1955
|
source: "class-manager"
|
|
1943
1956
|
});
|
|
1944
1957
|
dispatch5(
|
|
1945
1958
|
slice.actions.update({
|
|
1946
1959
|
style: {
|
|
1947
|
-
id:
|
|
1960
|
+
id: cssClass.id,
|
|
1948
1961
|
label: newLabel
|
|
1949
1962
|
}
|
|
1950
1963
|
})
|
|
@@ -1956,7 +1969,22 @@ var GlobalClassesList = ({ disabled }) => {
|
|
|
1956
1969
|
...triggerProps,
|
|
1957
1970
|
style: triggerStyle
|
|
1958
1971
|
},
|
|
1959
|
-
showSortIndicator: allowSorting
|
|
1972
|
+
showSortIndicator: allowSorting,
|
|
1973
|
+
syncToV3: cssClass.sync_to_v3,
|
|
1974
|
+
onToggleSync: (id2, newValue) => {
|
|
1975
|
+
if (!newValue && onStopSyncRequest) {
|
|
1976
|
+
onStopSyncRequest(id2);
|
|
1977
|
+
} else {
|
|
1978
|
+
dispatch5(
|
|
1979
|
+
slice.actions.update({
|
|
1980
|
+
style: {
|
|
1981
|
+
id: id2,
|
|
1982
|
+
sync_to_v3: newValue
|
|
1983
|
+
}
|
|
1984
|
+
})
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1960
1988
|
}
|
|
1961
1989
|
);
|
|
1962
1990
|
}))
|
|
@@ -2030,7 +2058,7 @@ var reloadDocument = () => {
|
|
|
2030
2058
|
const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
|
|
2031
2059
|
const documentsManager = (0, import_editor_documents3.getV1DocumentsManager)();
|
|
2032
2060
|
documentsManager.invalidateCache();
|
|
2033
|
-
return (0,
|
|
2061
|
+
return (0, import_editor_v1_adapters3.__privateRunCommand)("editor/documents/switch", {
|
|
2034
2062
|
id: currentDocument?.id,
|
|
2035
2063
|
shouldScroll: false,
|
|
2036
2064
|
shouldNavigateToDefaultRoute: false
|
|
@@ -2041,11 +2069,11 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
2041
2069
|
component: ClassManagerPanel,
|
|
2042
2070
|
allowedEditModes: ["edit", id],
|
|
2043
2071
|
onOpen: () => {
|
|
2044
|
-
(0,
|
|
2072
|
+
(0, import_editor_v1_adapters3.changeEditMode)(id);
|
|
2045
2073
|
blockPanelInteractions();
|
|
2046
2074
|
},
|
|
2047
2075
|
onClose: async () => {
|
|
2048
|
-
(0,
|
|
2076
|
+
(0, import_editor_v1_adapters3.changeEditMode)("edit");
|
|
2049
2077
|
await reloadDocument();
|
|
2050
2078
|
unblockPanelInteractions();
|
|
2051
2079
|
},
|
|
@@ -2055,11 +2083,23 @@ function ClassManagerPanel() {
|
|
|
2055
2083
|
const isDirty2 = useDirtyState();
|
|
2056
2084
|
const { close: closePanel } = usePanelActions();
|
|
2057
2085
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
|
|
2086
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react8.useState)(null);
|
|
2058
2087
|
const { mutateAsync: publish, isPending: isPublishing } = usePublish();
|
|
2059
2088
|
const resetAndClosePanel = () => {
|
|
2060
2089
|
(0, import_store20.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
|
|
2061
2090
|
closeSaveChangesDialog();
|
|
2062
2091
|
};
|
|
2092
|
+
const handleStopSync = (0, import_react8.useCallback)((classId) => {
|
|
2093
|
+
(0, import_store20.__dispatch)(
|
|
2094
|
+
slice.actions.update({
|
|
2095
|
+
style: {
|
|
2096
|
+
id: classId,
|
|
2097
|
+
sync_to_v3: false
|
|
2098
|
+
}
|
|
2099
|
+
})
|
|
2100
|
+
);
|
|
2101
|
+
setStopSyncConfirmation(null);
|
|
2102
|
+
}, []);
|
|
2063
2103
|
usePreventUnload();
|
|
2064
2104
|
return /* @__PURE__ */ React18.createElement(import_editor_ui9.ThemeProvider, null, /* @__PURE__ */ React18.createElement(import_ui15.ErrorBoundary, { fallback: /* @__PURE__ */ React18.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React18.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React18.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React18.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n14.__)("Class Manager", "elementor")), /* @__PURE__ */ React18.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React18.createElement(
|
|
2065
2105
|
CloseButton,
|
|
@@ -2094,7 +2134,13 @@ function ClassManagerPanel() {
|
|
|
2094
2134
|
overflowY: "auto"
|
|
2095
2135
|
}
|
|
2096
2136
|
},
|
|
2097
|
-
/* @__PURE__ */ React18.createElement(
|
|
2137
|
+
/* @__PURE__ */ React18.createElement(
|
|
2138
|
+
GlobalClassesList,
|
|
2139
|
+
{
|
|
2140
|
+
disabled: isPublishing,
|
|
2141
|
+
onStopSyncRequest: (classId) => setStopSyncConfirmation(classId)
|
|
2142
|
+
}
|
|
2143
|
+
)
|
|
2098
2144
|
)
|
|
2099
2145
|
), /* @__PURE__ */ React18.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React18.createElement(
|
|
2100
2146
|
import_ui15.Button,
|
|
@@ -2108,7 +2154,14 @@ function ClassManagerPanel() {
|
|
|
2108
2154
|
loading: isPublishing
|
|
2109
2155
|
},
|
|
2110
2156
|
(0, import_i18n14.__)("Save changes", "elementor")
|
|
2111
|
-
))))), /* @__PURE__ */ React18.createElement(ClassManagerIntroduction, null),
|
|
2157
|
+
))))), /* @__PURE__ */ React18.createElement(ClassManagerIntroduction, null), stopSyncConfirmation && /* @__PURE__ */ React18.createElement(
|
|
2158
|
+
StopSyncConfirmationDialog,
|
|
2159
|
+
{
|
|
2160
|
+
open: true,
|
|
2161
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2162
|
+
onConfirm: () => handleStopSync(stopSyncConfirmation)
|
|
2163
|
+
}
|
|
2164
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React18.createElement(import_editor_ui9.SaveChangesDialog, null, /* @__PURE__ */ React18.createElement(import_ui15.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React18.createElement(import_editor_ui9.SaveChangesDialog.Title, null, (0, import_i18n14.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React18.createElement(import_editor_ui9.SaveChangesDialog.Content, null, /* @__PURE__ */ React18.createElement(import_editor_ui9.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React18.createElement(import_editor_ui9.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React18.createElement(
|
|
2112
2165
|
import_editor_ui9.SaveChangesDialog.Actions,
|
|
2113
2166
|
{
|
|
2114
2167
|
actions: {
|
|
@@ -2168,6 +2221,19 @@ var TotalCssClassCounter = () => {
|
|
|
2168
2221
|
}
|
|
2169
2222
|
);
|
|
2170
2223
|
};
|
|
2224
|
+
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => /* @__PURE__ */ React18.createElement(import_editor_ui9.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React18.createElement(import_editor_ui9.ConfirmationDialog.Title, { icon: FlippedColorSwatchIcon, iconColor: "secondary" }, (0, import_i18n14.__)("Un-sync typography class", "elementor")), /* @__PURE__ */ React18.createElement(import_editor_ui9.ConfirmationDialog.Content, null, /* @__PURE__ */ React18.createElement(import_editor_ui9.ConfirmationDialog.ContentText, null, (0, import_i18n14.__)("You're about to stop syncing a typography class to Version 3.", "elementor")), /* @__PURE__ */ React18.createElement(import_editor_ui9.ConfirmationDialog.ContentText, { sx: { mt: 1 } }, (0, import_i18n14.__)(
|
|
2225
|
+
"Note that if it's being used anywhere, the affected elements will inherit the default typography.",
|
|
2226
|
+
"elementor"
|
|
2227
|
+
))), /* @__PURE__ */ React18.createElement(
|
|
2228
|
+
import_editor_ui9.ConfirmationDialog.Actions,
|
|
2229
|
+
{
|
|
2230
|
+
onClose,
|
|
2231
|
+
onConfirm,
|
|
2232
|
+
cancelLabel: (0, import_i18n14.__)("Cancel", "elementor"),
|
|
2233
|
+
confirmLabel: (0, import_i18n14.__)("Got it", "elementor"),
|
|
2234
|
+
color: "secondary"
|
|
2235
|
+
}
|
|
2236
|
+
));
|
|
2171
2237
|
|
|
2172
2238
|
// src/components/class-manager/class-manager-button.tsx
|
|
2173
2239
|
var trackGlobalClassesButton = () => {
|
|
@@ -2278,7 +2344,7 @@ function createClassName(prefix) {
|
|
|
2278
2344
|
|
|
2279
2345
|
// src/components/open-panel-from-url.tsx
|
|
2280
2346
|
var import_react9 = require("react");
|
|
2281
|
-
var
|
|
2347
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2282
2348
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2283
2349
|
var PANEL_ID = "global-classes-manager";
|
|
2284
2350
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
@@ -2291,7 +2357,7 @@ function OpenPanelFromUrl() {
|
|
|
2291
2357
|
if (activePanel !== PANEL_ID) {
|
|
2292
2358
|
return;
|
|
2293
2359
|
}
|
|
2294
|
-
const cleanup = (0,
|
|
2360
|
+
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2295
2361
|
if (hasOpened.current) {
|
|
2296
2362
|
return;
|
|
2297
2363
|
}
|
|
@@ -2776,12 +2842,12 @@ var initMcpIntegration = () => {
|
|
|
2776
2842
|
|
|
2777
2843
|
// src/sync-with-document.tsx
|
|
2778
2844
|
var import_react11 = require("react");
|
|
2779
|
-
var
|
|
2845
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
2780
2846
|
|
|
2781
2847
|
// src/sync-with-document-save.ts
|
|
2782
2848
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2783
2849
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2784
|
-
var
|
|
2850
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2785
2851
|
var import_store24 = require("@elementor/store");
|
|
2786
2852
|
function syncWithDocumentSave(panelActions) {
|
|
2787
2853
|
const unsubscribe = syncDirtyState();
|
|
@@ -2797,7 +2863,7 @@ function syncDirtyState() {
|
|
|
2797
2863
|
});
|
|
2798
2864
|
}
|
|
2799
2865
|
function bindSaveAction(panelActions) {
|
|
2800
|
-
(0,
|
|
2866
|
+
(0, import_editor_v1_adapters5.registerDataHook)("dependency", "document/save/save", (args) => {
|
|
2801
2867
|
const user = (0, import_editor_current_user2.getCurrentUser)();
|
|
2802
2868
|
const canEdit = user?.capabilities.includes(UPDATE_CLASS_CAPABILITY_KEY);
|
|
2803
2869
|
if (!canEdit) {
|
|
@@ -2818,7 +2884,7 @@ function isDirty() {
|
|
|
2818
2884
|
function SyncWithDocumentSave() {
|
|
2819
2885
|
const panelActions = usePanelActions();
|
|
2820
2886
|
(0, import_react11.useEffect)(() => {
|
|
2821
|
-
(0,
|
|
2887
|
+
(0, import_editor_v1_adapters6.__privateListenTo)((0, import_editor_v1_adapters6.v1ReadyEvent)(), () => {
|
|
2822
2888
|
syncWithDocumentSave(panelActions);
|
|
2823
2889
|
});
|
|
2824
2890
|
}, []);
|