@elementor/editor-global-classes 4.2.0-880 → 4.2.0-881
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 +156 -291
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -309
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-manager-button.tsx +5 -12
- package/src/components/class-manager/class-manager-panel.tsx +78 -208
- package/src/init.ts +0 -21
- package/src/sync-with-document.tsx +4 -11
- package/src/components/open-panel-from-event.tsx +0 -19
- package/src/components/open-panel-from-url.tsx +0 -40
package/dist/index.js
CHANGED
|
@@ -46,8 +46,6 @@ var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
|
46
46
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
47
47
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
48
48
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
49
|
-
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
50
|
-
var import_icons11 = require("@elementor/icons");
|
|
51
49
|
var import_query2 = require("@elementor/query");
|
|
52
50
|
var import_store18 = require("@elementor/store");
|
|
53
51
|
var import_ui16 = require("@elementor/ui");
|
|
@@ -170,9 +168,9 @@ var slice = (0, import_store.__createSlice)({
|
|
|
170
168
|
delete(state, { payload }) {
|
|
171
169
|
localHistory.next(state.data);
|
|
172
170
|
state.data.items = Object.fromEntries(
|
|
173
|
-
Object.entries(state.data.items).filter(([
|
|
171
|
+
Object.entries(state.data.items).filter(([id]) => id !== payload)
|
|
174
172
|
);
|
|
175
|
-
state.data.order = state.data.order.filter((
|
|
173
|
+
state.data.order = state.data.order.filter((id) => id !== payload);
|
|
176
174
|
delete state.classLabels[payload];
|
|
177
175
|
state.isDirty = true;
|
|
178
176
|
},
|
|
@@ -193,9 +191,9 @@ var slice = (0, import_store.__createSlice)({
|
|
|
193
191
|
},
|
|
194
192
|
updateMultiple(state, { payload }) {
|
|
195
193
|
localHistory.next(state.data);
|
|
196
|
-
Object.entries(payload).forEach(([
|
|
197
|
-
state.data.items[
|
|
198
|
-
state.classLabels[
|
|
194
|
+
Object.entries(payload).forEach(([id, { modified }]) => {
|
|
195
|
+
state.data.items[id].label = modified;
|
|
196
|
+
state.classLabels[id] = modified;
|
|
199
197
|
});
|
|
200
198
|
state.isDirty = false;
|
|
201
199
|
},
|
|
@@ -264,22 +262,22 @@ var slice = (0, import_store.__createSlice)({
|
|
|
264
262
|
mergeExistingClasses(state, {
|
|
265
263
|
payload: { preview, frontend }
|
|
266
264
|
}) {
|
|
267
|
-
Object.entries(preview).forEach(([
|
|
268
|
-
const frontendClassData = frontend[
|
|
265
|
+
Object.entries(preview).forEach(([id, previewClassData]) => {
|
|
266
|
+
const frontendClassData = frontend[id];
|
|
269
267
|
if (previewClassData === null || previewClassData === void 0) {
|
|
270
268
|
return;
|
|
271
269
|
}
|
|
272
|
-
if (!(
|
|
273
|
-
state.data.items[
|
|
270
|
+
if (!(id in state.data.items)) {
|
|
271
|
+
state.data.items[id] = previewClassData;
|
|
274
272
|
}
|
|
275
|
-
if (!(
|
|
276
|
-
state.initialData.frontend.items[
|
|
273
|
+
if (!(id in state.initialData.frontend.items)) {
|
|
274
|
+
state.initialData.frontend.items[id] = frontendClassData;
|
|
277
275
|
}
|
|
278
|
-
if (!(
|
|
279
|
-
state.initialData.preview.items[
|
|
276
|
+
if (!(id in state.initialData.preview.items)) {
|
|
277
|
+
state.initialData.preview.items[id] = previewClassData;
|
|
280
278
|
}
|
|
281
|
-
if (!(
|
|
282
|
-
state.classLabels[
|
|
279
|
+
if (!(id in state.classLabels)) {
|
|
280
|
+
state.classLabels[id] = previewClassData.label;
|
|
283
281
|
}
|
|
284
282
|
});
|
|
285
283
|
},
|
|
@@ -315,8 +313,8 @@ var getNonEmptyVariants = (style) => {
|
|
|
315
313
|
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
316
314
|
);
|
|
317
315
|
};
|
|
318
|
-
var placeholderDefinition = (
|
|
319
|
-
id
|
|
316
|
+
var placeholderDefinition = (id, label) => ({
|
|
317
|
+
id,
|
|
320
318
|
type: "class",
|
|
321
319
|
label,
|
|
322
320
|
variants: []
|
|
@@ -331,21 +329,21 @@ var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
|
331
329
|
var selectOrderedClasses = (0, import_store.__createSelector)(
|
|
332
330
|
selectData,
|
|
333
331
|
selectClassLabels,
|
|
334
|
-
({ items, order }, classLabels) => order.map((
|
|
335
|
-
const loaded = items[
|
|
332
|
+
({ items, order }, classLabels) => order.map((id) => {
|
|
333
|
+
const loaded = items[id];
|
|
336
334
|
if (loaded) {
|
|
337
335
|
return loaded;
|
|
338
336
|
}
|
|
339
|
-
const label = classLabels[
|
|
340
|
-
return label !== void 0 ? placeholderDefinition(
|
|
337
|
+
const label = classLabels[id];
|
|
338
|
+
return label !== void 0 ? placeholderDefinition(id, label) : null;
|
|
341
339
|
}).filter((s) => s !== null)
|
|
342
340
|
);
|
|
343
|
-
var selectClass = (state,
|
|
341
|
+
var selectClass = (state, id) => state[SLICE_NAME].data.items[id] ?? null;
|
|
344
342
|
var selectEmptyCssClass = (0, import_store.__createSelector)(
|
|
345
343
|
selectData,
|
|
346
344
|
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
347
345
|
);
|
|
348
|
-
var selectIsClassFetched = (state,
|
|
346
|
+
var selectIsClassFetched = (state, id) => !!state[SLICE_NAME].initialData.preview.items[id] || !!state[SLICE_NAME].initialData.frontend.items[id] || false;
|
|
349
347
|
|
|
350
348
|
// src/hooks/use-classes-order.ts
|
|
351
349
|
var useClassesOrder = () => {
|
|
@@ -520,7 +518,7 @@ var useFilteredCssClassUsage = () => {
|
|
|
520
518
|
const emptyCssClasses = useEmptyCssClass();
|
|
521
519
|
const { data, isLoading } = useCssClassUsage();
|
|
522
520
|
const listOfCssClasses = useAllCssClassesIDs();
|
|
523
|
-
const emptyCssClassesIDs = (0, import_react2.useMemo)(() => emptyCssClasses.map(({ id
|
|
521
|
+
const emptyCssClassesIDs = (0, import_react2.useMemo)(() => emptyCssClasses.map(({ id }) => id), [emptyCssClasses]);
|
|
524
522
|
const onThisPage = (0, import_react2.useMemo)(() => {
|
|
525
523
|
if (!data || !document) {
|
|
526
524
|
return [];
|
|
@@ -827,7 +825,7 @@ async function saveGlobalClasses2({ context: context2, onApprove }) {
|
|
|
827
825
|
const changes = calculateChanges(state, currentContext((0, import_store10.__getState)()));
|
|
828
826
|
const touchedIds = [...changes.added, ...changes.modified];
|
|
829
827
|
const touchedItems = Object.fromEntries(
|
|
830
|
-
touchedIds.map((
|
|
828
|
+
touchedIds.map((id) => [id, state.items[id]]).filter(([, v]) => v)
|
|
831
829
|
);
|
|
832
830
|
const response = await apiAction({
|
|
833
831
|
items: touchedItems,
|
|
@@ -859,13 +857,13 @@ function calculateChanges(state, initialData) {
|
|
|
859
857
|
const { order: stateOrder } = state;
|
|
860
858
|
const { order: initialDataOrder } = initialData;
|
|
861
859
|
const stateOrderIdSet = new Set(stateOrder);
|
|
862
|
-
const deleted = initialDataOrder.filter((
|
|
860
|
+
const deleted = initialDataOrder.filter((id) => !stateOrderIdSet.has(id));
|
|
863
861
|
const order = stateOrder.join(";") !== initialDataOrder.join(";");
|
|
864
862
|
return {
|
|
865
|
-
added: stateIds.filter((
|
|
863
|
+
added: stateIds.filter((id) => !initialDataIds.includes(id)),
|
|
866
864
|
deleted,
|
|
867
|
-
modified: stateIds.filter((
|
|
868
|
-
return
|
|
865
|
+
modified: stateIds.filter((id) => {
|
|
866
|
+
return id in initialData.items && (0, import_utils4.hash)(state.items[id]) !== (0, import_utils4.hash)(initialData.items[id]);
|
|
869
867
|
}),
|
|
870
868
|
order
|
|
871
869
|
};
|
|
@@ -1162,12 +1160,12 @@ var IntroductionContent = () => {
|
|
|
1162
1160
|
// src/components/class-manager/delete-class.ts
|
|
1163
1161
|
var import_store12 = require("@elementor/store");
|
|
1164
1162
|
var isDeleted = false;
|
|
1165
|
-
var deleteClass = (
|
|
1163
|
+
var deleteClass = (id) => {
|
|
1166
1164
|
trackGlobalClasses({
|
|
1167
1165
|
event: "classDeleted",
|
|
1168
|
-
classId:
|
|
1166
|
+
classId: id,
|
|
1169
1167
|
runAction: () => {
|
|
1170
|
-
(0, import_store12.__dispatch)(slice.actions.delete(
|
|
1168
|
+
(0, import_store12.__dispatch)(slice.actions.delete(id));
|
|
1171
1169
|
isDeleted = true;
|
|
1172
1170
|
}
|
|
1173
1171
|
});
|
|
@@ -1218,9 +1216,9 @@ var EMPTY_CLASS_USAGE = {
|
|
|
1218
1216
|
total: 0,
|
|
1219
1217
|
content: []
|
|
1220
1218
|
};
|
|
1221
|
-
var useCssClassUsageByID = (
|
|
1219
|
+
var useCssClassUsageByID = (id) => {
|
|
1222
1220
|
const { data, ...rest } = useCssClassUsage();
|
|
1223
|
-
const classData = data?.[
|
|
1221
|
+
const classData = data?.[id] ?? EMPTY_CLASS_USAGE;
|
|
1224
1222
|
return { ...rest, data: classData };
|
|
1225
1223
|
};
|
|
1226
1224
|
|
|
@@ -1355,11 +1353,11 @@ var import_editor_ui6 = require("@elementor/editor-ui");
|
|
|
1355
1353
|
var import_icons7 = require("@elementor/icons");
|
|
1356
1354
|
var import_ui9 = require("@elementor/ui");
|
|
1357
1355
|
var import_i18n8 = require("@wordpress/i18n");
|
|
1358
|
-
var CssClassUsageTrigger = ({ id
|
|
1356
|
+
var CssClassUsageTrigger = ({ id, onClick }) => {
|
|
1359
1357
|
const {
|
|
1360
1358
|
data: { total },
|
|
1361
1359
|
isLoading
|
|
1362
|
-
} = useCssClassUsageByID(
|
|
1360
|
+
} = useCssClassUsageByID(id);
|
|
1363
1361
|
const cssClassUsagePopover = (0, import_ui9.usePopupState)({ variant: "popover", popupId: "css-class-usage-popover" });
|
|
1364
1362
|
if (isLoading) {
|
|
1365
1363
|
return null;
|
|
@@ -1368,17 +1366,17 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1368
1366
|
const handleMouseEnter = () => {
|
|
1369
1367
|
trackGlobalClasses({
|
|
1370
1368
|
event: "classUsageHovered",
|
|
1371
|
-
classId:
|
|
1369
|
+
classId: id,
|
|
1372
1370
|
usage: total
|
|
1373
1371
|
});
|
|
1374
1372
|
};
|
|
1375
1373
|
const handleClick = (e) => {
|
|
1376
1374
|
if (total !== 0) {
|
|
1377
1375
|
(0, import_ui9.bindTrigger)(cssClassUsagePopover).onClick(e);
|
|
1378
|
-
onClick(
|
|
1376
|
+
onClick(id);
|
|
1379
1377
|
trackGlobalClasses({
|
|
1380
1378
|
event: "classUsageClicked",
|
|
1381
|
-
classId:
|
|
1379
|
+
classId: id
|
|
1382
1380
|
});
|
|
1383
1381
|
}
|
|
1384
1382
|
};
|
|
@@ -1413,7 +1411,7 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1413
1411
|
{
|
|
1414
1412
|
onClose: cssClassUsagePopover.close,
|
|
1415
1413
|
"aria-label": "css-class-usage-popover",
|
|
1416
|
-
cssClassID:
|
|
1414
|
+
cssClassID: id
|
|
1417
1415
|
}
|
|
1418
1416
|
)
|
|
1419
1417
|
)));
|
|
@@ -1470,14 +1468,14 @@ var DeleteConfirmationProvider = ({ children }) => {
|
|
|
1470
1468
|
};
|
|
1471
1469
|
return /* @__PURE__ */ React13.createElement(context.Provider, { value: { openDialog: openDialog2, closeDialog: closeDialog2, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React13.createElement(DeleteClassDialog, { ...dialogProps }));
|
|
1472
1470
|
};
|
|
1473
|
-
var DeleteClassDialog = ({ label, id
|
|
1471
|
+
var DeleteClassDialog = ({ label, id }) => {
|
|
1474
1472
|
const { closeDialog: closeDialog2 } = useDeleteConfirmation();
|
|
1475
1473
|
const {
|
|
1476
1474
|
data: { total, content }
|
|
1477
|
-
} = useCssClassUsageByID(
|
|
1475
|
+
} = useCssClassUsageByID(id);
|
|
1478
1476
|
const handleConfirm = () => {
|
|
1479
1477
|
closeDialog2();
|
|
1480
|
-
deleteClass(
|
|
1478
|
+
deleteClass(id);
|
|
1481
1479
|
};
|
|
1482
1480
|
const text = total && content.length ? (0, import_i18n9.__)(
|
|
1483
1481
|
"Will permanently remove it from your project and may affect the design across all elements using it. Used %1 times across %2 pages. This action cannot be undone.",
|
|
@@ -1510,12 +1508,12 @@ var SortableProvider = (props) => /* @__PURE__ */ React14.createElement(
|
|
|
1510
1508
|
}
|
|
1511
1509
|
);
|
|
1512
1510
|
var SortableTrigger = (props) => /* @__PURE__ */ React14.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger", "aria-label": "sort" }, /* @__PURE__ */ React14.createElement(import_icons8.GripVerticalIcon, { fontSize: "tiny" }));
|
|
1513
|
-
var SortableItem = ({ children, id
|
|
1511
|
+
var SortableItem = ({ children, id, style, ...props }) => {
|
|
1514
1512
|
return /* @__PURE__ */ React14.createElement(
|
|
1515
1513
|
import_ui11.UnstableSortableItem,
|
|
1516
1514
|
{
|
|
1517
1515
|
...props,
|
|
1518
|
-
id
|
|
1516
|
+
id,
|
|
1519
1517
|
render: ({
|
|
1520
1518
|
itemProps,
|
|
1521
1519
|
isDragged,
|
|
@@ -1567,7 +1565,7 @@ var SortableItemIndicator = (0, import_ui11.styled)(import_ui11.Box)`
|
|
|
1567
1565
|
|
|
1568
1566
|
// src/components/class-manager/class-item.tsx
|
|
1569
1567
|
var ClassItem = ({
|
|
1570
|
-
id
|
|
1568
|
+
id,
|
|
1571
1569
|
label,
|
|
1572
1570
|
renameClass,
|
|
1573
1571
|
selected,
|
|
@@ -1595,7 +1593,7 @@ var ClassItem = ({
|
|
|
1595
1593
|
variant: "popover",
|
|
1596
1594
|
disableAutoFocus: true
|
|
1597
1595
|
});
|
|
1598
|
-
const isSelected = (selectedCssUsage ===
|
|
1596
|
+
const isSelected = (selectedCssUsage === id || selected || popupState.isOpen) && !disabled;
|
|
1599
1597
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_ui12.Stack, { p: 0 }, /* @__PURE__ */ React15.createElement(
|
|
1600
1598
|
import_editor_ui8.WarningInfotip,
|
|
1601
1599
|
{
|
|
@@ -1629,7 +1627,7 @@ var ClassItem = ({
|
|
|
1629
1627
|
...getEditableProps()
|
|
1630
1628
|
}
|
|
1631
1629
|
) : /* @__PURE__ */ React15.createElement(import_editor_ui8.EllipsisWithTooltip, { title: label, as: import_ui12.Typography, variant: "caption" })),
|
|
1632
|
-
/* @__PURE__ */ React15.createElement(import_ui12.Box, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id
|
|
1630
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Box, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id, onClick: setSelectedCssUsage })),
|
|
1633
1631
|
/* @__PURE__ */ React15.createElement(
|
|
1634
1632
|
import_ui12.Tooltip,
|
|
1635
1633
|
{
|
|
@@ -1669,7 +1667,7 @@ var ClassItem = ({
|
|
|
1669
1667
|
{
|
|
1670
1668
|
onClick: () => {
|
|
1671
1669
|
popupState.close();
|
|
1672
|
-
onToggleSync(
|
|
1670
|
+
onToggleSync(id, !syncToV3);
|
|
1673
1671
|
}
|
|
1674
1672
|
},
|
|
1675
1673
|
/* @__PURE__ */ React15.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(import_icons9.RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(import_icons9.RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? (0, import_i18n10.__)("Stop syncing to Global Fonts", "elementor") : (0, import_i18n10.__)("Sync to Global Fonts", "elementor")))
|
|
@@ -1679,7 +1677,7 @@ var ClassItem = ({
|
|
|
1679
1677
|
{
|
|
1680
1678
|
onClick: () => {
|
|
1681
1679
|
popupState.close();
|
|
1682
|
-
openDialog2({ id
|
|
1680
|
+
openDialog2({ id, label });
|
|
1683
1681
|
}
|
|
1684
1682
|
},
|
|
1685
1683
|
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n10.__)("Delete", "elementor"))
|
|
@@ -1982,16 +1980,16 @@ var GlobalClassesList = ({
|
|
|
1982
1980
|
},
|
|
1983
1981
|
showSortIndicator: allowSorting,
|
|
1984
1982
|
syncToV3: cssClass.sync_to_v3,
|
|
1985
|
-
onToggleSync: (
|
|
1983
|
+
onToggleSync: (id, newValue) => {
|
|
1986
1984
|
if (!newValue && onStopSyncRequest) {
|
|
1987
|
-
onStopSyncRequest(
|
|
1985
|
+
onStopSyncRequest(id);
|
|
1988
1986
|
} else if (newValue && onStartSyncRequest) {
|
|
1989
|
-
onStartSyncRequest(
|
|
1987
|
+
onStartSyncRequest(id);
|
|
1990
1988
|
} else {
|
|
1991
1989
|
dispatch7(
|
|
1992
1990
|
slice.actions.update({
|
|
1993
1991
|
style: {
|
|
1994
|
-
id
|
|
1992
|
+
id,
|
|
1995
1993
|
sync_to_v3: newValue
|
|
1996
1994
|
}
|
|
1997
1995
|
})
|
|
@@ -2124,47 +2122,11 @@ var StartSyncToV3Modal = ({
|
|
|
2124
2122
|
|
|
2125
2123
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2126
2124
|
var STOP_SYNC_MESSAGE_KEY = "stop-sync-class";
|
|
2127
|
-
var id = "global-classes-manager";
|
|
2128
2125
|
function ClassManagerPanelEmbedded({ onRequestClose, onExposeCloseAttempt }) {
|
|
2129
|
-
return /* @__PURE__ */ React19.createElement(
|
|
2130
|
-
ClassManagerPanelRoot,
|
|
2131
|
-
{
|
|
2132
|
-
embedded: true,
|
|
2133
|
-
onRequestClose,
|
|
2134
|
-
onExposeCloseAttempt
|
|
2135
|
-
}
|
|
2136
|
-
);
|
|
2137
|
-
}
|
|
2138
|
-
function ClassManagerPanel() {
|
|
2139
|
-
return /* @__PURE__ */ React19.createElement(ClassManagerPanelRoot, null);
|
|
2126
|
+
return /* @__PURE__ */ React19.createElement(ClassManagerPanelContent, { onRequestClose, onExposeCloseAttempt });
|
|
2140
2127
|
}
|
|
2141
|
-
|
|
2142
|
-
id,
|
|
2143
|
-
component: ClassManagerPanel,
|
|
2144
|
-
allowedEditModes: ["edit", id],
|
|
2145
|
-
onOpen: () => {
|
|
2146
|
-
(0, import_editor_v1_adapters.changeEditMode)(id);
|
|
2147
|
-
blockPanelInteractions();
|
|
2148
|
-
},
|
|
2149
|
-
onClose: async () => {
|
|
2150
|
-
(0, import_editor_v1_adapters.changeEditMode)("edit");
|
|
2151
|
-
await (0, import_editor_documents3.reloadCurrentDocument)();
|
|
2152
|
-
unblockPanelInteractions();
|
|
2153
|
-
},
|
|
2154
|
-
isOpenPreviousElement: true
|
|
2155
|
-
});
|
|
2156
|
-
function ClassManagerPanelRoot({
|
|
2157
|
-
embedded = false,
|
|
2158
|
-
onRequestClose,
|
|
2159
|
-
onExposeCloseAttempt
|
|
2160
|
-
} = {}) {
|
|
2128
|
+
function ClassManagerPanelContent({ onRequestClose, onExposeCloseAttempt }) {
|
|
2161
2129
|
const isDirty2 = useDirtyState();
|
|
2162
|
-
const { close: closeStandalonePanel } = usePanelActions();
|
|
2163
|
-
const closePanel = (0, import_react10.useMemo)(
|
|
2164
|
-
() => embedded ? onRequestClose ?? (async () => {
|
|
2165
|
-
}) : closeStandalonePanel,
|
|
2166
|
-
[embedded, onRequestClose, closeStandalonePanel]
|
|
2167
|
-
);
|
|
2168
2130
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
|
|
2169
2131
|
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react10.useState)(null);
|
|
2170
2132
|
const [startSyncConfirmation, setStartSyncConfirmation] = (0, import_react10.useState)(null);
|
|
@@ -2180,24 +2142,21 @@ function ClassManagerPanelRoot({
|
|
|
2180
2142
|
openSaveChangesDialog();
|
|
2181
2143
|
return;
|
|
2182
2144
|
}
|
|
2183
|
-
void
|
|
2184
|
-
}, [isDirty2, openSaveChangesDialog,
|
|
2145
|
+
void onRequestClose();
|
|
2146
|
+
}, [isDirty2, openSaveChangesDialog, onRequestClose]);
|
|
2185
2147
|
(0, import_react10.useEffect)(() => {
|
|
2186
|
-
if (!
|
|
2148
|
+
if (!onExposeCloseAttempt) {
|
|
2187
2149
|
return;
|
|
2188
2150
|
}
|
|
2189
2151
|
onExposeCloseAttempt(() => handleClosePanel());
|
|
2190
2152
|
return () => onExposeCloseAttempt(null);
|
|
2191
|
-
}, [
|
|
2153
|
+
}, [onExposeCloseAttempt, handleClosePanel]);
|
|
2192
2154
|
(0, import_react10.useEffect)(() => {
|
|
2193
|
-
if (!embedded) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
2155
|
blockPanelInteractions();
|
|
2197
2156
|
return () => {
|
|
2198
2157
|
unblockPanelInteractions();
|
|
2199
2158
|
};
|
|
2200
|
-
}, [
|
|
2159
|
+
}, []);
|
|
2201
2160
|
const handleStopSync = (0, import_react10.useCallback)((classId) => {
|
|
2202
2161
|
(0, import_store18.__dispatch)(
|
|
2203
2162
|
slice.actions.update({
|
|
@@ -2233,42 +2192,67 @@ function ClassManagerPanelRoot({
|
|
|
2233
2192
|
[isStopSyncSuppressed, handleStopSync]
|
|
2234
2193
|
);
|
|
2235
2194
|
usePreventUnload();
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
import_ui16.Box,
|
|
2195
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui16.ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React19.createElement(
|
|
2196
|
+
import_ui16.Stack,
|
|
2239
2197
|
{
|
|
2240
|
-
|
|
2241
|
-
px: 2,
|
|
2198
|
+
direction: "column",
|
|
2242
2199
|
sx: {
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2200
|
+
height: "100%",
|
|
2201
|
+
width: "100%",
|
|
2202
|
+
flex: 1,
|
|
2203
|
+
minHeight: 0,
|
|
2204
|
+
overflow: "hidden"
|
|
2246
2205
|
}
|
|
2247
2206
|
},
|
|
2207
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(
|
|
2208
|
+
import_ui16.Stack,
|
|
2209
|
+
{
|
|
2210
|
+
direction: "row",
|
|
2211
|
+
alignItems: "center",
|
|
2212
|
+
justifyContent: "space-between",
|
|
2213
|
+
gap: 0.5,
|
|
2214
|
+
sx: { pb: 0.5 }
|
|
2215
|
+
},
|
|
2216
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)),
|
|
2217
|
+
/* @__PURE__ */ React19.createElement(CssClassFilter, null),
|
|
2218
|
+
/* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)
|
|
2219
|
+
), /* @__PURE__ */ React19.createElement(ActiveFilters, null)),
|
|
2220
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2248
2221
|
/* @__PURE__ */ React19.createElement(
|
|
2249
|
-
|
|
2222
|
+
import_ui16.Box,
|
|
2250
2223
|
{
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2224
|
+
ref: setScrollElement,
|
|
2225
|
+
px: 2,
|
|
2226
|
+
sx: {
|
|
2227
|
+
flexGrow: 1,
|
|
2228
|
+
overflowY: "auto",
|
|
2229
|
+
minHeight: 0
|
|
2230
|
+
}
|
|
2231
|
+
},
|
|
2232
|
+
/* @__PURE__ */ React19.createElement(
|
|
2233
|
+
GlobalClassesList,
|
|
2234
|
+
{
|
|
2235
|
+
disabled: isPublishing,
|
|
2236
|
+
scrollElement,
|
|
2237
|
+
onStopSyncRequest: handleStopSyncRequest,
|
|
2238
|
+
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2239
|
+
}
|
|
2240
|
+
)
|
|
2241
|
+
),
|
|
2242
|
+
/* @__PURE__ */ React19.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React19.createElement(
|
|
2243
|
+
import_ui16.Button,
|
|
2244
|
+
{
|
|
2245
|
+
fullWidth: true,
|
|
2246
|
+
size: "small",
|
|
2247
|
+
color: "global",
|
|
2248
|
+
variant: "contained",
|
|
2249
|
+
onClick: publish,
|
|
2250
|
+
disabled: !isDirty2,
|
|
2251
|
+
loading: isPublishing
|
|
2252
|
+
},
|
|
2253
|
+
(0, import_i18n14.__)("Save changes", "elementor")
|
|
2254
|
+
))
|
|
2255
|
+
))), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), startSyncConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2272
2256
|
StartSyncToV3Modal,
|
|
2273
2257
|
{
|
|
2274
2258
|
externalOpen: true,
|
|
@@ -2298,68 +2282,13 @@ function ClassManagerPanelRoot({
|
|
|
2298
2282
|
action: async () => {
|
|
2299
2283
|
await publish();
|
|
2300
2284
|
closeSaveChangesDialog();
|
|
2301
|
-
void
|
|
2285
|
+
void onRequestClose();
|
|
2302
2286
|
}
|
|
2303
2287
|
}
|
|
2304
2288
|
}
|
|
2305
2289
|
}
|
|
2306
2290
|
)));
|
|
2307
|
-
const classManagerLayout = embedded ? /* @__PURE__ */ React19.createElement(
|
|
2308
|
-
import_ui16.Stack,
|
|
2309
|
-
{
|
|
2310
|
-
direction: "column",
|
|
2311
|
-
sx: {
|
|
2312
|
-
height: "100%",
|
|
2313
|
-
width: "100%",
|
|
2314
|
-
flex: 1,
|
|
2315
|
-
minHeight: 0,
|
|
2316
|
-
overflow: "hidden"
|
|
2317
|
-
}
|
|
2318
|
-
},
|
|
2319
|
-
searchFiltersBlock,
|
|
2320
|
-
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2321
|
-
listArea,
|
|
2322
|
-
saveFooter
|
|
2323
|
-
) : /* @__PURE__ */ React19.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n14.__)("Class Manager", "elementor")), /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(
|
|
2324
|
-
ClassPanelCloseButton,
|
|
2325
|
-
{
|
|
2326
|
-
disabled: isPublishing,
|
|
2327
|
-
onClose: () => {
|
|
2328
|
-
if (isDirty2) {
|
|
2329
|
-
openSaveChangesDialog();
|
|
2330
|
-
return;
|
|
2331
|
-
}
|
|
2332
|
-
void closeStandalonePanel();
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
))), /* @__PURE__ */ React19.createElement(
|
|
2336
|
-
import_editor_panels.PanelBody,
|
|
2337
|
-
{
|
|
2338
|
-
sx: {
|
|
2339
|
-
display: "flex",
|
|
2340
|
-
flexDirection: "column",
|
|
2341
|
-
height: "100%"
|
|
2342
|
-
}
|
|
2343
|
-
},
|
|
2344
|
-
searchFiltersBlock,
|
|
2345
|
-
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2346
|
-
listArea
|
|
2347
|
-
), saveFooter);
|
|
2348
|
-
const core = /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui16.ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, classManagerLayout)), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), dialogs);
|
|
2349
|
-
return embedded ? core : /* @__PURE__ */ React19.createElement(import_editor_ui9.ThemeProvider, null, core);
|
|
2350
2291
|
}
|
|
2351
|
-
var ClassPanelCloseButton = ({ onClose, sx, ...props }) => /* @__PURE__ */ React19.createElement(
|
|
2352
|
-
import_ui16.IconButton,
|
|
2353
|
-
{
|
|
2354
|
-
size: "small",
|
|
2355
|
-
color: "secondary",
|
|
2356
|
-
onClick: onClose,
|
|
2357
|
-
"aria-label": "Close",
|
|
2358
|
-
sx: { marginLeft: "auto", ...sx },
|
|
2359
|
-
...props
|
|
2360
|
-
},
|
|
2361
|
-
/* @__PURE__ */ React19.createElement(import_icons11.XIcon, { fontSize: "small" })
|
|
2362
|
-
);
|
|
2363
2292
|
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(import_ui16.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(import_ui16.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, (0, import_i18n14.__)("Something went wrong", "elementor"))));
|
|
2364
2293
|
var usePreventUnload = () => {
|
|
2365
2294
|
const isDirty2 = useDirtyState();
|
|
@@ -2426,11 +2355,11 @@ var import_store24 = require("@elementor/store");
|
|
|
2426
2355
|
var import_i18n15 = require("@wordpress/i18n");
|
|
2427
2356
|
|
|
2428
2357
|
// src/capabilities.ts
|
|
2429
|
-
var
|
|
2358
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
2430
2359
|
var EXPERIMENT_KEY = "global_classes_should_enforce_capabilities";
|
|
2431
2360
|
var UPDATE_CLASS_CAPABILITY_KEY = "elementor_global_classes_update_class";
|
|
2432
2361
|
var getCapabilities = () => {
|
|
2433
|
-
const shouldEnforceCapabilities = (0,
|
|
2362
|
+
const shouldEnforceCapabilities = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENT_KEY);
|
|
2434
2363
|
if (shouldEnforceCapabilities) {
|
|
2435
2364
|
return {
|
|
2436
2365
|
update: UPDATE_CLASS_CAPABILITY_KEY,
|
|
@@ -2514,11 +2443,11 @@ var pendingLoad = null;
|
|
|
2514
2443
|
var pendingIds = /* @__PURE__ */ new Set();
|
|
2515
2444
|
async function loadExistingClasses(classIds) {
|
|
2516
2445
|
const existingClasses = selectGlobalClasses((0, import_store22.__getState)());
|
|
2517
|
-
const missingIds = classIds.filter((
|
|
2446
|
+
const missingIds = classIds.filter((id) => !(id in existingClasses));
|
|
2518
2447
|
if (missingIds.length === 0) {
|
|
2519
2448
|
return;
|
|
2520
2449
|
}
|
|
2521
|
-
missingIds.forEach((
|
|
2450
|
+
missingIds.forEach((id) => pendingIds.add(id));
|
|
2522
2451
|
if (pendingLoad) {
|
|
2523
2452
|
await pendingLoad;
|
|
2524
2453
|
return loadExistingClasses(classIds);
|
|
@@ -2551,7 +2480,7 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository2.createSty
|
|
|
2551
2480
|
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
2552
2481
|
priority: 30,
|
|
2553
2482
|
limit: MAX_CLASSES,
|
|
2554
|
-
isPregeneratedLink: ({ id
|
|
2483
|
+
isPregeneratedLink: ({ id }) => PREGENERATED_LINK_PATTERN.test(id),
|
|
2555
2484
|
labels: {
|
|
2556
2485
|
singular: (0, import_i18n15.__)("class", "elementor"),
|
|
2557
2486
|
plural: (0, import_i18n15.__)("classes", "elementor")
|
|
@@ -2560,45 +2489,45 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository2.createSty
|
|
|
2560
2489
|
capabilities: getCapabilities(),
|
|
2561
2490
|
actions: {
|
|
2562
2491
|
all: () => selectOrderedClasses((0, import_store24.__getState)()),
|
|
2563
|
-
get: (
|
|
2492
|
+
get: (id) => {
|
|
2564
2493
|
const state = (0, import_store24.__getState)();
|
|
2565
|
-
const isFetched = selectIsClassFetched(state,
|
|
2566
|
-
const style = selectClass(state,
|
|
2494
|
+
const isFetched = selectIsClassFetched(state, id);
|
|
2495
|
+
const style = selectClass(state, id);
|
|
2567
2496
|
if (isFetched || style) {
|
|
2568
2497
|
return style;
|
|
2569
2498
|
}
|
|
2570
|
-
loadExistingClasses([
|
|
2571
|
-
const label = selectClassLabels(state)[
|
|
2572
|
-
return placeholderDefinition(
|
|
2499
|
+
loadExistingClasses([id]);
|
|
2500
|
+
const label = selectClassLabels(state)[id] ?? id;
|
|
2501
|
+
return placeholderDefinition(id, label);
|
|
2573
2502
|
},
|
|
2574
|
-
resolveCssName: (
|
|
2503
|
+
resolveCssName: (id) => {
|
|
2575
2504
|
const state = (0, import_store24.__getState)();
|
|
2576
|
-
const loaded = selectClass(state,
|
|
2505
|
+
const loaded = selectClass(state, id);
|
|
2577
2506
|
if (loaded) {
|
|
2578
2507
|
return loaded.label;
|
|
2579
2508
|
}
|
|
2580
|
-
const fromIndex = selectClassLabels(state)[
|
|
2581
|
-
return fromIndex ??
|
|
2509
|
+
const fromIndex = selectClassLabels(state)[id];
|
|
2510
|
+
return fromIndex ?? id;
|
|
2582
2511
|
},
|
|
2583
|
-
create: (label, variants = [],
|
|
2512
|
+
create: (label, variants = [], id) => {
|
|
2584
2513
|
const existingClasses = Object.entries(selectClassLabels((0, import_store24.__getState)()));
|
|
2585
2514
|
const existingLabels = existingClasses.map(([, classLabel]) => classLabel);
|
|
2586
2515
|
if (existingLabels.includes(label)) {
|
|
2587
2516
|
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
2588
2517
|
}
|
|
2589
2518
|
const existingIds = existingClasses.map(([existingId]) => existingId);
|
|
2590
|
-
if (!
|
|
2591
|
-
|
|
2519
|
+
if (!id) {
|
|
2520
|
+
id = (0, import_editor_styles2.generateId)("g-", existingIds);
|
|
2592
2521
|
}
|
|
2593
2522
|
(0, import_store24.__dispatch)(
|
|
2594
2523
|
slice.actions.add({
|
|
2595
|
-
id
|
|
2524
|
+
id,
|
|
2596
2525
|
type: "class",
|
|
2597
2526
|
label,
|
|
2598
2527
|
variants
|
|
2599
2528
|
})
|
|
2600
2529
|
);
|
|
2601
|
-
return
|
|
2530
|
+
return id;
|
|
2602
2531
|
},
|
|
2603
2532
|
update: (payload) => {
|
|
2604
2533
|
(0, import_store24.__dispatch)(
|
|
@@ -2607,8 +2536,8 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository2.createSty
|
|
|
2607
2536
|
})
|
|
2608
2537
|
);
|
|
2609
2538
|
},
|
|
2610
|
-
delete: (
|
|
2611
|
-
(0, import_store24.__dispatch)(slice.actions.delete(
|
|
2539
|
+
delete: (id) => {
|
|
2540
|
+
(0, import_store24.__dispatch)(slice.actions.delete(id));
|
|
2612
2541
|
},
|
|
2613
2542
|
updateProps: (args) => {
|
|
2614
2543
|
(0, import_store24.__dispatch)(
|
|
@@ -2684,9 +2613,7 @@ var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
|
2684
2613
|
var import_editor = require("@elementor/editor");
|
|
2685
2614
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
2686
2615
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
2687
|
-
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
2688
2616
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
2689
|
-
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
2690
2617
|
var import_store32 = require("@elementor/store");
|
|
2691
2618
|
|
|
2692
2619
|
// src/components/class-manager/class-manager-button.tsx
|
|
@@ -2694,7 +2621,6 @@ var React20 = __toESM(require("react"));
|
|
|
2694
2621
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2695
2622
|
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
2696
2623
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2697
|
-
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2698
2624
|
var import_ui17 = require("@elementor/ui");
|
|
2699
2625
|
var import_i18n16 = require("@wordpress/i18n");
|
|
2700
2626
|
|
|
@@ -2723,7 +2649,6 @@ var trackGlobalClassesButton = () => {
|
|
|
2723
2649
|
};
|
|
2724
2650
|
var ClassManagerButton = () => {
|
|
2725
2651
|
const document = (0, import_editor_documents5.__useActiveDocument)();
|
|
2726
|
-
const { open: openPanel } = usePanelActions();
|
|
2727
2652
|
const { save: saveDocument } = (0, import_editor_documents5.__useActiveDocumentActions)();
|
|
2728
2653
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui10.useDialog)();
|
|
2729
2654
|
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
@@ -2733,15 +2658,11 @@ var ClassManagerButton = () => {
|
|
|
2733
2658
|
return null;
|
|
2734
2659
|
}
|
|
2735
2660
|
const toggleClassesManagerPanel = () => {
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
);
|
|
2742
|
-
} else {
|
|
2743
|
-
openPanel();
|
|
2744
|
-
}
|
|
2661
|
+
window.dispatchEvent(
|
|
2662
|
+
new CustomEvent("elementor/toggle-design-system", {
|
|
2663
|
+
detail: { tab: "classes" }
|
|
2664
|
+
})
|
|
2665
|
+
);
|
|
2745
2666
|
};
|
|
2746
2667
|
const handleOpenPanel = () => {
|
|
2747
2668
|
if (document?.isDirty) {
|
|
@@ -2858,55 +2779,13 @@ function GlobalStylesImportListener() {
|
|
|
2858
2779
|
return null;
|
|
2859
2780
|
}
|
|
2860
2781
|
|
|
2861
|
-
// src/components/open-panel-from-event.tsx
|
|
2862
|
-
var import_react12 = require("react");
|
|
2863
|
-
var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
|
|
2864
|
-
function OpenPanelFromEvent() {
|
|
2865
|
-
const { open } = usePanelActions();
|
|
2866
|
-
(0, import_react12.useEffect)(() => {
|
|
2867
|
-
const handler2 = () => open();
|
|
2868
|
-
window.addEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2869
|
-
return () => window.removeEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2870
|
-
}, [open]);
|
|
2871
|
-
return null;
|
|
2872
|
-
}
|
|
2873
|
-
|
|
2874
|
-
// src/components/open-panel-from-url.tsx
|
|
2875
|
-
var import_react13 = require("react");
|
|
2876
|
-
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2877
|
-
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2878
|
-
var PANEL_ID = "global-classes-manager";
|
|
2879
|
-
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2880
|
-
function OpenPanelFromUrl() {
|
|
2881
|
-
const { open } = usePanelActions();
|
|
2882
|
-
const hasOpened = (0, import_react13.useRef)(false);
|
|
2883
|
-
(0, import_react13.useEffect)(() => {
|
|
2884
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
2885
|
-
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2886
|
-
if (activePanel !== PANEL_ID) {
|
|
2887
|
-
return;
|
|
2888
|
-
}
|
|
2889
|
-
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2890
|
-
if (hasOpened.current) {
|
|
2891
|
-
return;
|
|
2892
|
-
}
|
|
2893
|
-
hasOpened.current = true;
|
|
2894
|
-
requestAnimationFrame(() => {
|
|
2895
|
-
open();
|
|
2896
|
-
});
|
|
2897
|
-
});
|
|
2898
|
-
return cleanup;
|
|
2899
|
-
}, [open]);
|
|
2900
|
-
return null;
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
2782
|
// src/components/populate-store.tsx
|
|
2904
|
-
var
|
|
2905
|
-
var
|
|
2783
|
+
var import_react12 = require("react");
|
|
2784
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
2906
2785
|
function PopulateStore() {
|
|
2907
|
-
(0,
|
|
2786
|
+
(0, import_react12.useEffect)(() => {
|
|
2908
2787
|
loadCurrentDocumentClasses();
|
|
2909
|
-
(0,
|
|
2788
|
+
(0, import_editor_v1_adapters2.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
2910
2789
|
await loadCurrentDocumentClasses();
|
|
2911
2790
|
});
|
|
2912
2791
|
}, []);
|
|
@@ -3340,13 +3219,13 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3340
3219
|
};
|
|
3341
3220
|
|
|
3342
3221
|
// src/sync-with-document.tsx
|
|
3343
|
-
var
|
|
3344
|
-
var
|
|
3222
|
+
var import_react13 = require("react");
|
|
3223
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
3345
3224
|
|
|
3346
3225
|
// src/sync-with-document-save.ts
|
|
3347
3226
|
var import_editor_current_user3 = require("@elementor/editor-current-user");
|
|
3348
3227
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
3349
|
-
var
|
|
3228
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
3350
3229
|
var import_store30 = require("@elementor/store");
|
|
3351
3230
|
var pendingSave = null;
|
|
3352
3231
|
function syncWithDocumentSave(panelActions) {
|
|
@@ -3383,7 +3262,7 @@ function triggerSave(panelActions, context2 = "preview") {
|
|
|
3383
3262
|
return promise;
|
|
3384
3263
|
}
|
|
3385
3264
|
function bindSaveAction(panelActions) {
|
|
3386
|
-
(0,
|
|
3265
|
+
(0, import_editor_v1_adapters3.registerDataHook)("dependency", "document/save/save", (args) => {
|
|
3387
3266
|
triggerSave(panelActions, args.status === "publish" ? "frontend" : "preview");
|
|
3388
3267
|
return true;
|
|
3389
3268
|
});
|
|
@@ -3404,12 +3283,11 @@ function isDirty() {
|
|
|
3404
3283
|
|
|
3405
3284
|
// src/sync-with-document.tsx
|
|
3406
3285
|
function SyncWithDocumentSave() {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
const open = (0, import_editor_v1_adapters7.isExperimentActive)("e_editor_design_system_panel") ? () => {
|
|
3286
|
+
(0, import_react13.useEffect)(() => {
|
|
3287
|
+
const unsubscribe = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.v1ReadyEvent)(), () => {
|
|
3288
|
+
const open = () => {
|
|
3411
3289
|
window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
|
|
3412
|
-
}
|
|
3290
|
+
};
|
|
3413
3291
|
syncWithDocumentSave({ open });
|
|
3414
3292
|
});
|
|
3415
3293
|
return unsubscribe;
|
|
@@ -3420,9 +3298,6 @@ function SyncWithDocumentSave() {
|
|
|
3420
3298
|
// src/init.ts
|
|
3421
3299
|
function init() {
|
|
3422
3300
|
(0, import_store32.__registerSlice)(slice);
|
|
3423
|
-
if (!(0, import_editor_v1_adapters8.isExperimentActive)("e_editor_design_system_panel")) {
|
|
3424
|
-
(0, import_editor_panels2.__registerPanel)(panel);
|
|
3425
|
-
}
|
|
3426
3301
|
import_editor_styles_repository5.stylesRepository.register(globalClassesStylesProvider);
|
|
3427
3302
|
(0, import_editor.injectIntoLogic)({
|
|
3428
3303
|
id: "global-classes-populate-store",
|
|
@@ -3440,16 +3315,6 @@ function init() {
|
|
|
3440
3315
|
id: "global-classes-prefetch-css-class-usage",
|
|
3441
3316
|
component: PrefetchCssClassUsage
|
|
3442
3317
|
});
|
|
3443
|
-
if (!(0, import_editor_v1_adapters8.isExperimentActive)("e_editor_design_system_panel")) {
|
|
3444
|
-
(0, import_editor.injectIntoLogic)({
|
|
3445
|
-
id: "global-classes-open-panel-from-url",
|
|
3446
|
-
component: OpenPanelFromUrl
|
|
3447
|
-
});
|
|
3448
|
-
(0, import_editor.injectIntoLogic)({
|
|
3449
|
-
id: "global-classes-open-panel-from-event",
|
|
3450
|
-
component: OpenPanelFromEvent
|
|
3451
|
-
});
|
|
3452
|
-
}
|
|
3453
3318
|
(0, import_editor_editing_panel2.injectIntoCssClassConvert)({
|
|
3454
3319
|
id: "global-classes-convert-from-local-class",
|
|
3455
3320
|
component: ConvertLocalClassToGlobalClass
|