@elementor/editor-global-classes 4.2.0-880 → 4.2.0-882
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.mjs
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2
2
|
import * as React19 from "react";
|
|
3
|
-
import { useCallback, useEffect as useEffect4,
|
|
3
|
+
import { useCallback, useEffect as useEffect4, useState as useState7 } from "react";
|
|
4
4
|
import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
Panel,
|
|
9
|
-
PanelBody,
|
|
10
|
-
PanelFooter,
|
|
11
|
-
PanelHeader,
|
|
12
|
-
PanelHeaderTitle
|
|
13
|
-
} from "@elementor/editor-panels";
|
|
14
|
-
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
15
|
-
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
16
|
-
import { XIcon } from "@elementor/icons";
|
|
5
|
+
import { setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
6
|
+
import { PanelFooter } from "@elementor/editor-panels";
|
|
7
|
+
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, useDialog } from "@elementor/editor-ui";
|
|
17
8
|
import { useMutation } from "@elementor/query";
|
|
18
9
|
import { __dispatch as dispatch3 } from "@elementor/store";
|
|
19
|
-
import {
|
|
20
|
-
Alert as Alert2,
|
|
21
|
-
Box as Box11,
|
|
22
|
-
Button as Button3,
|
|
23
|
-
Chip as Chip4,
|
|
24
|
-
DialogHeader as DialogHeader2,
|
|
25
|
-
Divider as Divider4,
|
|
26
|
-
ErrorBoundary,
|
|
27
|
-
IconButton as IconButton4,
|
|
28
|
-
Stack as Stack9
|
|
29
|
-
} from "@elementor/ui";
|
|
10
|
+
import { Alert as Alert2, Box as Box11, Button as Button3, Chip as Chip4, DialogHeader as DialogHeader2, Divider as Divider4, ErrorBoundary, Stack as Stack9 } from "@elementor/ui";
|
|
30
11
|
import { __ as __14 } from "@wordpress/i18n";
|
|
31
12
|
|
|
32
13
|
// src/hooks/use-classes-order.ts
|
|
@@ -151,9 +132,9 @@ var slice = createSlice({
|
|
|
151
132
|
delete(state, { payload }) {
|
|
152
133
|
localHistory.next(state.data);
|
|
153
134
|
state.data.items = Object.fromEntries(
|
|
154
|
-
Object.entries(state.data.items).filter(([
|
|
135
|
+
Object.entries(state.data.items).filter(([id]) => id !== payload)
|
|
155
136
|
);
|
|
156
|
-
state.data.order = state.data.order.filter((
|
|
137
|
+
state.data.order = state.data.order.filter((id) => id !== payload);
|
|
157
138
|
delete state.classLabels[payload];
|
|
158
139
|
state.isDirty = true;
|
|
159
140
|
},
|
|
@@ -174,9 +155,9 @@ var slice = createSlice({
|
|
|
174
155
|
},
|
|
175
156
|
updateMultiple(state, { payload }) {
|
|
176
157
|
localHistory.next(state.data);
|
|
177
|
-
Object.entries(payload).forEach(([
|
|
178
|
-
state.data.items[
|
|
179
|
-
state.classLabels[
|
|
158
|
+
Object.entries(payload).forEach(([id, { modified }]) => {
|
|
159
|
+
state.data.items[id].label = modified;
|
|
160
|
+
state.classLabels[id] = modified;
|
|
180
161
|
});
|
|
181
162
|
state.isDirty = false;
|
|
182
163
|
},
|
|
@@ -245,22 +226,22 @@ var slice = createSlice({
|
|
|
245
226
|
mergeExistingClasses(state, {
|
|
246
227
|
payload: { preview, frontend }
|
|
247
228
|
}) {
|
|
248
|
-
Object.entries(preview).forEach(([
|
|
249
|
-
const frontendClassData = frontend[
|
|
229
|
+
Object.entries(preview).forEach(([id, previewClassData]) => {
|
|
230
|
+
const frontendClassData = frontend[id];
|
|
250
231
|
if (previewClassData === null || previewClassData === void 0) {
|
|
251
232
|
return;
|
|
252
233
|
}
|
|
253
|
-
if (!(
|
|
254
|
-
state.data.items[
|
|
234
|
+
if (!(id in state.data.items)) {
|
|
235
|
+
state.data.items[id] = previewClassData;
|
|
255
236
|
}
|
|
256
|
-
if (!(
|
|
257
|
-
state.initialData.frontend.items[
|
|
237
|
+
if (!(id in state.initialData.frontend.items)) {
|
|
238
|
+
state.initialData.frontend.items[id] = frontendClassData;
|
|
258
239
|
}
|
|
259
|
-
if (!(
|
|
260
|
-
state.initialData.preview.items[
|
|
240
|
+
if (!(id in state.initialData.preview.items)) {
|
|
241
|
+
state.initialData.preview.items[id] = previewClassData;
|
|
261
242
|
}
|
|
262
|
-
if (!(
|
|
263
|
-
state.classLabels[
|
|
243
|
+
if (!(id in state.classLabels)) {
|
|
244
|
+
state.classLabels[id] = previewClassData.label;
|
|
264
245
|
}
|
|
265
246
|
});
|
|
266
247
|
},
|
|
@@ -296,8 +277,8 @@ var getNonEmptyVariants = (style) => {
|
|
|
296
277
|
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
297
278
|
);
|
|
298
279
|
};
|
|
299
|
-
var placeholderDefinition = (
|
|
300
|
-
id
|
|
280
|
+
var placeholderDefinition = (id, label) => ({
|
|
281
|
+
id,
|
|
301
282
|
type: "class",
|
|
302
283
|
label,
|
|
303
284
|
variants: []
|
|
@@ -312,21 +293,21 @@ var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
|
312
293
|
var selectOrderedClasses = createSelector(
|
|
313
294
|
selectData,
|
|
314
295
|
selectClassLabels,
|
|
315
|
-
({ items, order }, classLabels) => order.map((
|
|
316
|
-
const loaded = items[
|
|
296
|
+
({ items, order }, classLabels) => order.map((id) => {
|
|
297
|
+
const loaded = items[id];
|
|
317
298
|
if (loaded) {
|
|
318
299
|
return loaded;
|
|
319
300
|
}
|
|
320
|
-
const label = classLabels[
|
|
321
|
-
return label !== void 0 ? placeholderDefinition(
|
|
301
|
+
const label = classLabels[id];
|
|
302
|
+
return label !== void 0 ? placeholderDefinition(id, label) : null;
|
|
322
303
|
}).filter((s) => s !== null)
|
|
323
304
|
);
|
|
324
|
-
var selectClass = (state,
|
|
305
|
+
var selectClass = (state, id) => state[SLICE_NAME].data.items[id] ?? null;
|
|
325
306
|
var selectEmptyCssClass = createSelector(
|
|
326
307
|
selectData,
|
|
327
308
|
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
328
309
|
);
|
|
329
|
-
var selectIsClassFetched = (state,
|
|
310
|
+
var selectIsClassFetched = (state, id) => !!state[SLICE_NAME].initialData.preview.items[id] || !!state[SLICE_NAME].initialData.frontend.items[id] || false;
|
|
330
311
|
|
|
331
312
|
// src/hooks/use-classes-order.ts
|
|
332
313
|
var useClassesOrder = () => {
|
|
@@ -501,7 +482,7 @@ var useFilteredCssClassUsage = () => {
|
|
|
501
482
|
const emptyCssClasses = useEmptyCssClass();
|
|
502
483
|
const { data, isLoading } = useCssClassUsage();
|
|
503
484
|
const listOfCssClasses = useAllCssClassesIDs();
|
|
504
|
-
const emptyCssClassesIDs = useMemo(() => emptyCssClasses.map(({ id
|
|
485
|
+
const emptyCssClassesIDs = useMemo(() => emptyCssClasses.map(({ id }) => id), [emptyCssClasses]);
|
|
505
486
|
const onThisPage = useMemo(() => {
|
|
506
487
|
if (!data || !document) {
|
|
507
488
|
return [];
|
|
@@ -819,7 +800,7 @@ async function saveGlobalClasses2({ context: context2, onApprove }) {
|
|
|
819
800
|
const changes = calculateChanges(state, currentContext(getState2()));
|
|
820
801
|
const touchedIds = [...changes.added, ...changes.modified];
|
|
821
802
|
const touchedItems = Object.fromEntries(
|
|
822
|
-
touchedIds.map((
|
|
803
|
+
touchedIds.map((id) => [id, state.items[id]]).filter(([, v]) => v)
|
|
823
804
|
);
|
|
824
805
|
const response = await apiAction({
|
|
825
806
|
items: touchedItems,
|
|
@@ -851,13 +832,13 @@ function calculateChanges(state, initialData) {
|
|
|
851
832
|
const { order: stateOrder } = state;
|
|
852
833
|
const { order: initialDataOrder } = initialData;
|
|
853
834
|
const stateOrderIdSet = new Set(stateOrder);
|
|
854
|
-
const deleted = initialDataOrder.filter((
|
|
835
|
+
const deleted = initialDataOrder.filter((id) => !stateOrderIdSet.has(id));
|
|
855
836
|
const order = stateOrder.join(";") !== initialDataOrder.join(";");
|
|
856
837
|
return {
|
|
857
|
-
added: stateIds.filter((
|
|
838
|
+
added: stateIds.filter((id) => !initialDataIds.includes(id)),
|
|
858
839
|
deleted,
|
|
859
|
-
modified: stateIds.filter((
|
|
860
|
-
return
|
|
840
|
+
modified: stateIds.filter((id) => {
|
|
841
|
+
return id in initialData.items && hash(state.items[id]) !== hash(initialData.items[id]);
|
|
861
842
|
}),
|
|
862
843
|
order
|
|
863
844
|
};
|
|
@@ -1154,12 +1135,12 @@ var IntroductionContent = () => {
|
|
|
1154
1135
|
// src/components/class-manager/delete-class.ts
|
|
1155
1136
|
import { __dispatch as dispatch2 } from "@elementor/store";
|
|
1156
1137
|
var isDeleted = false;
|
|
1157
|
-
var deleteClass = (
|
|
1138
|
+
var deleteClass = (id) => {
|
|
1158
1139
|
trackGlobalClasses({
|
|
1159
1140
|
event: "classDeleted",
|
|
1160
|
-
classId:
|
|
1141
|
+
classId: id,
|
|
1161
1142
|
runAction: () => {
|
|
1162
|
-
dispatch2(slice.actions.delete(
|
|
1143
|
+
dispatch2(slice.actions.delete(id));
|
|
1163
1144
|
isDeleted = true;
|
|
1164
1145
|
}
|
|
1165
1146
|
});
|
|
@@ -1235,9 +1216,9 @@ var EMPTY_CLASS_USAGE = {
|
|
|
1235
1216
|
total: 0,
|
|
1236
1217
|
content: []
|
|
1237
1218
|
};
|
|
1238
|
-
var useCssClassUsageByID = (
|
|
1219
|
+
var useCssClassUsageByID = (id) => {
|
|
1239
1220
|
const { data, ...rest } = useCssClassUsage();
|
|
1240
|
-
const classData = data?.[
|
|
1221
|
+
const classData = data?.[id] ?? EMPTY_CLASS_USAGE;
|
|
1241
1222
|
return { ...rest, data: classData };
|
|
1242
1223
|
};
|
|
1243
1224
|
|
|
@@ -1382,11 +1363,11 @@ import {
|
|
|
1382
1363
|
usePopupState as usePopupState2
|
|
1383
1364
|
} from "@elementor/ui";
|
|
1384
1365
|
import { __ as __8 } from "@wordpress/i18n";
|
|
1385
|
-
var CssClassUsageTrigger = ({ id
|
|
1366
|
+
var CssClassUsageTrigger = ({ id, onClick }) => {
|
|
1386
1367
|
const {
|
|
1387
1368
|
data: { total },
|
|
1388
1369
|
isLoading
|
|
1389
|
-
} = useCssClassUsageByID(
|
|
1370
|
+
} = useCssClassUsageByID(id);
|
|
1390
1371
|
const cssClassUsagePopover = usePopupState2({ variant: "popover", popupId: "css-class-usage-popover" });
|
|
1391
1372
|
if (isLoading) {
|
|
1392
1373
|
return null;
|
|
@@ -1395,17 +1376,17 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1395
1376
|
const handleMouseEnter = () => {
|
|
1396
1377
|
trackGlobalClasses({
|
|
1397
1378
|
event: "classUsageHovered",
|
|
1398
|
-
classId:
|
|
1379
|
+
classId: id,
|
|
1399
1380
|
usage: total
|
|
1400
1381
|
});
|
|
1401
1382
|
};
|
|
1402
1383
|
const handleClick = (e) => {
|
|
1403
1384
|
if (total !== 0) {
|
|
1404
1385
|
bindTrigger(cssClassUsagePopover).onClick(e);
|
|
1405
|
-
onClick(
|
|
1386
|
+
onClick(id);
|
|
1406
1387
|
trackGlobalClasses({
|
|
1407
1388
|
event: "classUsageClicked",
|
|
1408
|
-
classId:
|
|
1389
|
+
classId: id
|
|
1409
1390
|
});
|
|
1410
1391
|
}
|
|
1411
1392
|
};
|
|
@@ -1440,7 +1421,7 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1440
1421
|
{
|
|
1441
1422
|
onClose: cssClassUsagePopover.close,
|
|
1442
1423
|
"aria-label": "css-class-usage-popover",
|
|
1443
|
-
cssClassID:
|
|
1424
|
+
cssClassID: id
|
|
1444
1425
|
}
|
|
1445
1426
|
)
|
|
1446
1427
|
)));
|
|
@@ -1497,14 +1478,14 @@ var DeleteConfirmationProvider = ({ children }) => {
|
|
|
1497
1478
|
};
|
|
1498
1479
|
return /* @__PURE__ */ React13.createElement(context.Provider, { value: { openDialog: openDialog2, closeDialog: closeDialog2, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React13.createElement(DeleteClassDialog, { ...dialogProps }));
|
|
1499
1480
|
};
|
|
1500
|
-
var DeleteClassDialog = ({ label, id
|
|
1481
|
+
var DeleteClassDialog = ({ label, id }) => {
|
|
1501
1482
|
const { closeDialog: closeDialog2 } = useDeleteConfirmation();
|
|
1502
1483
|
const {
|
|
1503
1484
|
data: { total, content }
|
|
1504
|
-
} = useCssClassUsageByID(
|
|
1485
|
+
} = useCssClassUsageByID(id);
|
|
1505
1486
|
const handleConfirm = () => {
|
|
1506
1487
|
closeDialog2();
|
|
1507
|
-
deleteClass(
|
|
1488
|
+
deleteClass(id);
|
|
1508
1489
|
};
|
|
1509
1490
|
const text = total && content.length ? __9(
|
|
1510
1491
|
"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.",
|
|
@@ -1542,12 +1523,12 @@ var SortableProvider = (props) => /* @__PURE__ */ React14.createElement(
|
|
|
1542
1523
|
}
|
|
1543
1524
|
);
|
|
1544
1525
|
var SortableTrigger = (props) => /* @__PURE__ */ React14.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger", "aria-label": "sort" }, /* @__PURE__ */ React14.createElement(GripVerticalIcon, { fontSize: "tiny" }));
|
|
1545
|
-
var SortableItem = ({ children, id
|
|
1526
|
+
var SortableItem = ({ children, id, style, ...props }) => {
|
|
1546
1527
|
return /* @__PURE__ */ React14.createElement(
|
|
1547
1528
|
UnstableSortableItem,
|
|
1548
1529
|
{
|
|
1549
1530
|
...props,
|
|
1550
|
-
id
|
|
1531
|
+
id,
|
|
1551
1532
|
render: ({
|
|
1552
1533
|
itemProps,
|
|
1553
1534
|
isDragged,
|
|
@@ -1599,7 +1580,7 @@ var SortableItemIndicator = styled4(Box7)`
|
|
|
1599
1580
|
|
|
1600
1581
|
// src/components/class-manager/class-item.tsx
|
|
1601
1582
|
var ClassItem = ({
|
|
1602
|
-
id
|
|
1583
|
+
id,
|
|
1603
1584
|
label,
|
|
1604
1585
|
renameClass,
|
|
1605
1586
|
selected,
|
|
@@ -1627,7 +1608,7 @@ var ClassItem = ({
|
|
|
1627
1608
|
variant: "popover",
|
|
1628
1609
|
disableAutoFocus: true
|
|
1629
1610
|
});
|
|
1630
|
-
const isSelected = (selectedCssUsage ===
|
|
1611
|
+
const isSelected = (selectedCssUsage === id || selected || popupState.isOpen) && !disabled;
|
|
1631
1612
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(Stack6, { p: 0 }, /* @__PURE__ */ React15.createElement(
|
|
1632
1613
|
WarningInfotip,
|
|
1633
1614
|
{
|
|
@@ -1661,7 +1642,7 @@ var ClassItem = ({
|
|
|
1661
1642
|
...getEditableProps()
|
|
1662
1643
|
}
|
|
1663
1644
|
) : /* @__PURE__ */ React15.createElement(EllipsisWithTooltip3, { title: label, as: Typography6, variant: "caption" })),
|
|
1664
|
-
/* @__PURE__ */ React15.createElement(Box8, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id
|
|
1645
|
+
/* @__PURE__ */ React15.createElement(Box8, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id, onClick: setSelectedCssUsage })),
|
|
1665
1646
|
/* @__PURE__ */ React15.createElement(
|
|
1666
1647
|
Tooltip5,
|
|
1667
1648
|
{
|
|
@@ -1701,7 +1682,7 @@ var ClassItem = ({
|
|
|
1701
1682
|
{
|
|
1702
1683
|
onClick: () => {
|
|
1703
1684
|
popupState.close();
|
|
1704
|
-
onToggleSync(
|
|
1685
|
+
onToggleSync(id, !syncToV3);
|
|
1705
1686
|
}
|
|
1706
1687
|
},
|
|
1707
1688
|
/* @__PURE__ */ React15.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? __10("Stop syncing to Global Fonts", "elementor") : __10("Sync to Global Fonts", "elementor")))
|
|
@@ -1711,7 +1692,7 @@ var ClassItem = ({
|
|
|
1711
1692
|
{
|
|
1712
1693
|
onClick: () => {
|
|
1713
1694
|
popupState.close();
|
|
1714
|
-
openDialog2({ id
|
|
1695
|
+
openDialog2({ id, label });
|
|
1715
1696
|
}
|
|
1716
1697
|
},
|
|
1717
1698
|
/* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "error.light" } }, __10("Delete", "elementor"))
|
|
@@ -2014,16 +1995,16 @@ var GlobalClassesList = ({
|
|
|
2014
1995
|
},
|
|
2015
1996
|
showSortIndicator: allowSorting,
|
|
2016
1997
|
syncToV3: cssClass.sync_to_v3,
|
|
2017
|
-
onToggleSync: (
|
|
1998
|
+
onToggleSync: (id, newValue) => {
|
|
2018
1999
|
if (!newValue && onStopSyncRequest) {
|
|
2019
|
-
onStopSyncRequest(
|
|
2000
|
+
onStopSyncRequest(id);
|
|
2020
2001
|
} else if (newValue && onStartSyncRequest) {
|
|
2021
|
-
onStartSyncRequest(
|
|
2002
|
+
onStartSyncRequest(id);
|
|
2022
2003
|
} else {
|
|
2023
2004
|
dispatch7(
|
|
2024
2005
|
slice.actions.update({
|
|
2025
2006
|
style: {
|
|
2026
|
-
id
|
|
2007
|
+
id,
|
|
2027
2008
|
sync_to_v3: newValue
|
|
2028
2009
|
}
|
|
2029
2010
|
})
|
|
@@ -2165,47 +2146,11 @@ var StartSyncToV3Modal = ({
|
|
|
2165
2146
|
|
|
2166
2147
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2167
2148
|
var STOP_SYNC_MESSAGE_KEY = "stop-sync-class";
|
|
2168
|
-
var id = "global-classes-manager";
|
|
2169
2149
|
function ClassManagerPanelEmbedded({ onRequestClose, onExposeCloseAttempt }) {
|
|
2170
|
-
return /* @__PURE__ */ React19.createElement(
|
|
2171
|
-
ClassManagerPanelRoot,
|
|
2172
|
-
{
|
|
2173
|
-
embedded: true,
|
|
2174
|
-
onRequestClose,
|
|
2175
|
-
onExposeCloseAttempt
|
|
2176
|
-
}
|
|
2177
|
-
);
|
|
2150
|
+
return /* @__PURE__ */ React19.createElement(ClassManagerPanelContent, { onRequestClose, onExposeCloseAttempt });
|
|
2178
2151
|
}
|
|
2179
|
-
function
|
|
2180
|
-
return /* @__PURE__ */ React19.createElement(ClassManagerPanelRoot, null);
|
|
2181
|
-
}
|
|
2182
|
-
var { panel, usePanelActions } = createPanel({
|
|
2183
|
-
id,
|
|
2184
|
-
component: ClassManagerPanel,
|
|
2185
|
-
allowedEditModes: ["edit", id],
|
|
2186
|
-
onOpen: () => {
|
|
2187
|
-
changeEditMode(id);
|
|
2188
|
-
blockPanelInteractions();
|
|
2189
|
-
},
|
|
2190
|
-
onClose: async () => {
|
|
2191
|
-
changeEditMode("edit");
|
|
2192
|
-
await reloadCurrentDocument();
|
|
2193
|
-
unblockPanelInteractions();
|
|
2194
|
-
},
|
|
2195
|
-
isOpenPreviousElement: true
|
|
2196
|
-
});
|
|
2197
|
-
function ClassManagerPanelRoot({
|
|
2198
|
-
embedded = false,
|
|
2199
|
-
onRequestClose,
|
|
2200
|
-
onExposeCloseAttempt
|
|
2201
|
-
} = {}) {
|
|
2152
|
+
function ClassManagerPanelContent({ onRequestClose, onExposeCloseAttempt }) {
|
|
2202
2153
|
const isDirty2 = useDirtyState();
|
|
2203
|
-
const { close: closeStandalonePanel } = usePanelActions();
|
|
2204
|
-
const closePanel = useMemo4(
|
|
2205
|
-
() => embedded ? onRequestClose ?? (async () => {
|
|
2206
|
-
}) : closeStandalonePanel,
|
|
2207
|
-
[embedded, onRequestClose, closeStandalonePanel]
|
|
2208
|
-
);
|
|
2209
2154
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
2210
2155
|
const [stopSyncConfirmation, setStopSyncConfirmation] = useState7(null);
|
|
2211
2156
|
const [startSyncConfirmation, setStartSyncConfirmation] = useState7(null);
|
|
@@ -2221,24 +2166,21 @@ function ClassManagerPanelRoot({
|
|
|
2221
2166
|
openSaveChangesDialog();
|
|
2222
2167
|
return;
|
|
2223
2168
|
}
|
|
2224
|
-
void
|
|
2225
|
-
}, [isDirty2, openSaveChangesDialog,
|
|
2169
|
+
void onRequestClose();
|
|
2170
|
+
}, [isDirty2, openSaveChangesDialog, onRequestClose]);
|
|
2226
2171
|
useEffect4(() => {
|
|
2227
|
-
if (!
|
|
2172
|
+
if (!onExposeCloseAttempt) {
|
|
2228
2173
|
return;
|
|
2229
2174
|
}
|
|
2230
2175
|
onExposeCloseAttempt(() => handleClosePanel());
|
|
2231
2176
|
return () => onExposeCloseAttempt(null);
|
|
2232
|
-
}, [
|
|
2177
|
+
}, [onExposeCloseAttempt, handleClosePanel]);
|
|
2233
2178
|
useEffect4(() => {
|
|
2234
|
-
if (!embedded) {
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
2179
|
blockPanelInteractions();
|
|
2238
2180
|
return () => {
|
|
2239
2181
|
unblockPanelInteractions();
|
|
2240
2182
|
};
|
|
2241
|
-
}, [
|
|
2183
|
+
}, []);
|
|
2242
2184
|
const handleStopSync = useCallback((classId) => {
|
|
2243
2185
|
dispatch3(
|
|
2244
2186
|
slice.actions.update({
|
|
@@ -2274,42 +2216,67 @@ function ClassManagerPanelRoot({
|
|
|
2274
2216
|
[isStopSyncSuppressed, handleStopSync]
|
|
2275
2217
|
);
|
|
2276
2218
|
usePreventUnload();
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
Box11,
|
|
2219
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React19.createElement(
|
|
2220
|
+
Stack9,
|
|
2280
2221
|
{
|
|
2281
|
-
|
|
2282
|
-
px: 2,
|
|
2222
|
+
direction: "column",
|
|
2283
2223
|
sx: {
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2224
|
+
height: "100%",
|
|
2225
|
+
width: "100%",
|
|
2226
|
+
flex: 1,
|
|
2227
|
+
minHeight: 0,
|
|
2228
|
+
overflow: "hidden"
|
|
2287
2229
|
}
|
|
2288
2230
|
},
|
|
2231
|
+
/* @__PURE__ */ React19.createElement(Box11, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(
|
|
2232
|
+
Stack9,
|
|
2233
|
+
{
|
|
2234
|
+
direction: "row",
|
|
2235
|
+
alignItems: "center",
|
|
2236
|
+
justifyContent: "space-between",
|
|
2237
|
+
gap: 0.5,
|
|
2238
|
+
sx: { pb: 0.5 }
|
|
2239
|
+
},
|
|
2240
|
+
/* @__PURE__ */ React19.createElement(Box11, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)),
|
|
2241
|
+
/* @__PURE__ */ React19.createElement(CssClassFilter, null),
|
|
2242
|
+
/* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)
|
|
2243
|
+
), /* @__PURE__ */ React19.createElement(ActiveFilters, null)),
|
|
2244
|
+
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2289
2245
|
/* @__PURE__ */ React19.createElement(
|
|
2290
|
-
|
|
2246
|
+
Box11,
|
|
2291
2247
|
{
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2248
|
+
ref: setScrollElement,
|
|
2249
|
+
px: 2,
|
|
2250
|
+
sx: {
|
|
2251
|
+
flexGrow: 1,
|
|
2252
|
+
overflowY: "auto",
|
|
2253
|
+
minHeight: 0
|
|
2254
|
+
}
|
|
2255
|
+
},
|
|
2256
|
+
/* @__PURE__ */ React19.createElement(
|
|
2257
|
+
GlobalClassesList,
|
|
2258
|
+
{
|
|
2259
|
+
disabled: isPublishing,
|
|
2260
|
+
scrollElement,
|
|
2261
|
+
onStopSyncRequest: handleStopSyncRequest,
|
|
2262
|
+
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2263
|
+
}
|
|
2264
|
+
)
|
|
2265
|
+
),
|
|
2266
|
+
/* @__PURE__ */ React19.createElement(PanelFooter, null, /* @__PURE__ */ React19.createElement(
|
|
2267
|
+
Button3,
|
|
2268
|
+
{
|
|
2269
|
+
fullWidth: true,
|
|
2270
|
+
size: "small",
|
|
2271
|
+
color: "global",
|
|
2272
|
+
variant: "contained",
|
|
2273
|
+
onClick: publish,
|
|
2274
|
+
disabled: !isDirty2,
|
|
2275
|
+
loading: isPublishing
|
|
2276
|
+
},
|
|
2277
|
+
__14("Save changes", "elementor")
|
|
2278
|
+
))
|
|
2279
|
+
))), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), startSyncConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2313
2280
|
StartSyncToV3Modal,
|
|
2314
2281
|
{
|
|
2315
2282
|
externalOpen: true,
|
|
@@ -2339,68 +2306,13 @@ function ClassManagerPanelRoot({
|
|
|
2339
2306
|
action: async () => {
|
|
2340
2307
|
await publish();
|
|
2341
2308
|
closeSaveChangesDialog();
|
|
2342
|
-
void
|
|
2309
|
+
void onRequestClose();
|
|
2343
2310
|
}
|
|
2344
2311
|
}
|
|
2345
2312
|
}
|
|
2346
2313
|
}
|
|
2347
2314
|
)));
|
|
2348
|
-
const classManagerLayout = embedded ? /* @__PURE__ */ React19.createElement(
|
|
2349
|
-
Stack9,
|
|
2350
|
-
{
|
|
2351
|
-
direction: "column",
|
|
2352
|
-
sx: {
|
|
2353
|
-
height: "100%",
|
|
2354
|
-
width: "100%",
|
|
2355
|
-
flex: 1,
|
|
2356
|
-
minHeight: 0,
|
|
2357
|
-
overflow: "hidden"
|
|
2358
|
-
}
|
|
2359
|
-
},
|
|
2360
|
-
searchFiltersBlock,
|
|
2361
|
-
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2362
|
-
listArea,
|
|
2363
|
-
saveFooter
|
|
2364
|
-
) : /* @__PURE__ */ React19.createElement(Panel, null, /* @__PURE__ */ React19.createElement(PanelHeader, null, /* @__PURE__ */ React19.createElement(Stack9, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React19.createElement(Stack9, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React19.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), __14("Class Manager", "elementor")), /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(
|
|
2365
|
-
ClassPanelCloseButton,
|
|
2366
|
-
{
|
|
2367
|
-
disabled: isPublishing,
|
|
2368
|
-
onClose: () => {
|
|
2369
|
-
if (isDirty2) {
|
|
2370
|
-
openSaveChangesDialog();
|
|
2371
|
-
return;
|
|
2372
|
-
}
|
|
2373
|
-
void closeStandalonePanel();
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
))), /* @__PURE__ */ React19.createElement(
|
|
2377
|
-
PanelBody,
|
|
2378
|
-
{
|
|
2379
|
-
sx: {
|
|
2380
|
-
display: "flex",
|
|
2381
|
-
flexDirection: "column",
|
|
2382
|
-
height: "100%"
|
|
2383
|
-
}
|
|
2384
|
-
},
|
|
2385
|
-
searchFiltersBlock,
|
|
2386
|
-
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2387
|
-
listArea
|
|
2388
|
-
), saveFooter);
|
|
2389
|
-
const core = /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, classManagerLayout)), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), dialogs);
|
|
2390
|
-
return embedded ? core : /* @__PURE__ */ React19.createElement(ThemeProvider, null, core);
|
|
2391
2315
|
}
|
|
2392
|
-
var ClassPanelCloseButton = ({ onClose, sx, ...props }) => /* @__PURE__ */ React19.createElement(
|
|
2393
|
-
IconButton4,
|
|
2394
|
-
{
|
|
2395
|
-
size: "small",
|
|
2396
|
-
color: "secondary",
|
|
2397
|
-
onClick: onClose,
|
|
2398
|
-
"aria-label": "Close",
|
|
2399
|
-
sx: { marginLeft: "auto", ...sx },
|
|
2400
|
-
...props
|
|
2401
|
-
},
|
|
2402
|
-
/* @__PURE__ */ React19.createElement(XIcon, { fontSize: "small" })
|
|
2403
|
-
);
|
|
2404
2316
|
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(Box11, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(Alert2, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, __14("Something went wrong", "elementor"))));
|
|
2405
2317
|
var usePreventUnload = () => {
|
|
2406
2318
|
const isDirty2 = useDirtyState();
|
|
@@ -2561,11 +2473,11 @@ var pendingLoad = null;
|
|
|
2561
2473
|
var pendingIds = /* @__PURE__ */ new Set();
|
|
2562
2474
|
async function loadExistingClasses(classIds) {
|
|
2563
2475
|
const existingClasses = selectGlobalClasses(getState3());
|
|
2564
|
-
const missingIds = classIds.filter((
|
|
2476
|
+
const missingIds = classIds.filter((id) => !(id in existingClasses));
|
|
2565
2477
|
if (missingIds.length === 0) {
|
|
2566
2478
|
return;
|
|
2567
2479
|
}
|
|
2568
|
-
missingIds.forEach((
|
|
2480
|
+
missingIds.forEach((id) => pendingIds.add(id));
|
|
2569
2481
|
if (pendingLoad) {
|
|
2570
2482
|
await pendingLoad;
|
|
2571
2483
|
return loadExistingClasses(classIds);
|
|
@@ -2598,7 +2510,7 @@ var globalClassesStylesProvider = createStylesProvider({
|
|
|
2598
2510
|
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
2599
2511
|
priority: 30,
|
|
2600
2512
|
limit: MAX_CLASSES,
|
|
2601
|
-
isPregeneratedLink: ({ id
|
|
2513
|
+
isPregeneratedLink: ({ id }) => PREGENERATED_LINK_PATTERN.test(id),
|
|
2602
2514
|
labels: {
|
|
2603
2515
|
singular: __15("class", "elementor"),
|
|
2604
2516
|
plural: __15("classes", "elementor")
|
|
@@ -2607,45 +2519,45 @@ var globalClassesStylesProvider = createStylesProvider({
|
|
|
2607
2519
|
capabilities: getCapabilities(),
|
|
2608
2520
|
actions: {
|
|
2609
2521
|
all: () => selectOrderedClasses(getState4()),
|
|
2610
|
-
get: (
|
|
2522
|
+
get: (id) => {
|
|
2611
2523
|
const state = getState4();
|
|
2612
|
-
const isFetched = selectIsClassFetched(state,
|
|
2613
|
-
const style = selectClass(state,
|
|
2524
|
+
const isFetched = selectIsClassFetched(state, id);
|
|
2525
|
+
const style = selectClass(state, id);
|
|
2614
2526
|
if (isFetched || style) {
|
|
2615
2527
|
return style;
|
|
2616
2528
|
}
|
|
2617
|
-
loadExistingClasses([
|
|
2618
|
-
const label = selectClassLabels(state)[
|
|
2619
|
-
return placeholderDefinition(
|
|
2529
|
+
loadExistingClasses([id]);
|
|
2530
|
+
const label = selectClassLabels(state)[id] ?? id;
|
|
2531
|
+
return placeholderDefinition(id, label);
|
|
2620
2532
|
},
|
|
2621
|
-
resolveCssName: (
|
|
2533
|
+
resolveCssName: (id) => {
|
|
2622
2534
|
const state = getState4();
|
|
2623
|
-
const loaded = selectClass(state,
|
|
2535
|
+
const loaded = selectClass(state, id);
|
|
2624
2536
|
if (loaded) {
|
|
2625
2537
|
return loaded.label;
|
|
2626
2538
|
}
|
|
2627
|
-
const fromIndex = selectClassLabels(state)[
|
|
2628
|
-
return fromIndex ??
|
|
2539
|
+
const fromIndex = selectClassLabels(state)[id];
|
|
2540
|
+
return fromIndex ?? id;
|
|
2629
2541
|
},
|
|
2630
|
-
create: (label, variants = [],
|
|
2542
|
+
create: (label, variants = [], id) => {
|
|
2631
2543
|
const existingClasses = Object.entries(selectClassLabels(getState4()));
|
|
2632
2544
|
const existingLabels = existingClasses.map(([, classLabel]) => classLabel);
|
|
2633
2545
|
if (existingLabels.includes(label)) {
|
|
2634
2546
|
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
2635
2547
|
}
|
|
2636
2548
|
const existingIds = existingClasses.map(([existingId]) => existingId);
|
|
2637
|
-
if (!
|
|
2638
|
-
|
|
2549
|
+
if (!id) {
|
|
2550
|
+
id = generateId("g-", existingIds);
|
|
2639
2551
|
}
|
|
2640
2552
|
dispatch6(
|
|
2641
2553
|
slice.actions.add({
|
|
2642
|
-
id
|
|
2554
|
+
id,
|
|
2643
2555
|
type: "class",
|
|
2644
2556
|
label,
|
|
2645
2557
|
variants
|
|
2646
2558
|
})
|
|
2647
2559
|
);
|
|
2648
|
-
return
|
|
2560
|
+
return id;
|
|
2649
2561
|
},
|
|
2650
2562
|
update: (payload) => {
|
|
2651
2563
|
dispatch6(
|
|
@@ -2654,8 +2566,8 @@ var globalClassesStylesProvider = createStylesProvider({
|
|
|
2654
2566
|
})
|
|
2655
2567
|
);
|
|
2656
2568
|
},
|
|
2657
|
-
delete: (
|
|
2658
|
-
dispatch6(slice.actions.delete(
|
|
2569
|
+
delete: (id) => {
|
|
2570
|
+
dispatch6(slice.actions.delete(id));
|
|
2659
2571
|
},
|
|
2660
2572
|
updateProps: (args) => {
|
|
2661
2573
|
dispatch6(
|
|
@@ -2735,9 +2647,7 @@ import {
|
|
|
2735
2647
|
registerStyleProviderToColors
|
|
2736
2648
|
} from "@elementor/editor-editing-panel";
|
|
2737
2649
|
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
2738
|
-
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
2739
2650
|
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
2740
|
-
import { isExperimentActive as isExperimentActive4 } from "@elementor/editor-v1-adapters";
|
|
2741
2651
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
2742
2652
|
|
|
2743
2653
|
// src/components/class-manager/class-manager-button.tsx
|
|
@@ -2748,8 +2658,7 @@ import {
|
|
|
2748
2658
|
} from "@elementor/editor-documents";
|
|
2749
2659
|
import { useUserStylesCapability } from "@elementor/editor-styles-repository";
|
|
2750
2660
|
import { SaveChangesDialog as SaveChangesDialog2, useDialog as useDialog2 } from "@elementor/editor-ui";
|
|
2751
|
-
import {
|
|
2752
|
-
import { IconButton as IconButton5, Tooltip as Tooltip6 } from "@elementor/ui";
|
|
2661
|
+
import { IconButton as IconButton4, Tooltip as Tooltip6 } from "@elementor/ui";
|
|
2753
2662
|
import { __ as __16 } from "@wordpress/i18n";
|
|
2754
2663
|
|
|
2755
2664
|
// src/hooks/use-prefetch-css-class-usage.ts
|
|
@@ -2777,7 +2686,6 @@ var trackGlobalClassesButton = () => {
|
|
|
2777
2686
|
};
|
|
2778
2687
|
var ClassManagerButton = () => {
|
|
2779
2688
|
const document = useActiveDocument2();
|
|
2780
|
-
const { open: openPanel } = usePanelActions();
|
|
2781
2689
|
const { save: saveDocument } = useActiveDocumentActions();
|
|
2782
2690
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog2();
|
|
2783
2691
|
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
@@ -2787,15 +2695,11 @@ var ClassManagerButton = () => {
|
|
|
2787
2695
|
return null;
|
|
2788
2696
|
}
|
|
2789
2697
|
const toggleClassesManagerPanel = () => {
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
);
|
|
2796
|
-
} else {
|
|
2797
|
-
openPanel();
|
|
2798
|
-
}
|
|
2698
|
+
window.dispatchEvent(
|
|
2699
|
+
new CustomEvent("elementor/toggle-design-system", {
|
|
2700
|
+
detail: { tab: "classes" }
|
|
2701
|
+
})
|
|
2702
|
+
);
|
|
2799
2703
|
};
|
|
2800
2704
|
const handleOpenPanel = () => {
|
|
2801
2705
|
if (document?.isDirty) {
|
|
@@ -2806,7 +2710,7 @@ var ClassManagerButton = () => {
|
|
|
2806
2710
|
trackGlobalClassesButton();
|
|
2807
2711
|
prefetchClassesUsage();
|
|
2808
2712
|
};
|
|
2809
|
-
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Tooltip6, { title: __16("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React20.createElement(
|
|
2713
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Tooltip6, { title: __16("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React20.createElement(IconButton4, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React20.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React20.createElement(SaveChangesDialog2, null, /* @__PURE__ */ React20.createElement(SaveChangesDialog2.Title, null, __16("You have unsaved changes", "elementor")), /* @__PURE__ */ React20.createElement(SaveChangesDialog2.Content, null, /* @__PURE__ */ React20.createElement(SaveChangesDialog2.ContentText, { sx: { mb: 2 } }, __16(
|
|
2810
2714
|
"To open the Class Manager, save your page first. You can't continue without saving.",
|
|
2811
2715
|
"elementor"
|
|
2812
2716
|
))), /* @__PURE__ */ React20.createElement(
|
|
@@ -2912,53 +2816,11 @@ function GlobalStylesImportListener() {
|
|
|
2912
2816
|
return null;
|
|
2913
2817
|
}
|
|
2914
2818
|
|
|
2915
|
-
// src/components/open-panel-from-event.tsx
|
|
2916
|
-
import { useEffect as useEffect6 } from "react";
|
|
2917
|
-
var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
|
|
2918
|
-
function OpenPanelFromEvent() {
|
|
2919
|
-
const { open } = usePanelActions();
|
|
2920
|
-
useEffect6(() => {
|
|
2921
|
-
const handler2 = () => open();
|
|
2922
|
-
window.addEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2923
|
-
return () => window.removeEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2924
|
-
}, [open]);
|
|
2925
|
-
return null;
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
// src/components/open-panel-from-url.tsx
|
|
2929
|
-
import { useEffect as useEffect7, useRef as useRef3 } from "react";
|
|
2930
|
-
import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
2931
|
-
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2932
|
-
var PANEL_ID = "global-classes-manager";
|
|
2933
|
-
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2934
|
-
function OpenPanelFromUrl() {
|
|
2935
|
-
const { open } = usePanelActions();
|
|
2936
|
-
const hasOpened = useRef3(false);
|
|
2937
|
-
useEffect7(() => {
|
|
2938
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
2939
|
-
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2940
|
-
if (activePanel !== PANEL_ID) {
|
|
2941
|
-
return;
|
|
2942
|
-
}
|
|
2943
|
-
const cleanup = listenTo(routeOpenEvent(DEFAULT_PANEL_ROUTE), () => {
|
|
2944
|
-
if (hasOpened.current) {
|
|
2945
|
-
return;
|
|
2946
|
-
}
|
|
2947
|
-
hasOpened.current = true;
|
|
2948
|
-
requestAnimationFrame(() => {
|
|
2949
|
-
open();
|
|
2950
|
-
});
|
|
2951
|
-
});
|
|
2952
|
-
return cleanup;
|
|
2953
|
-
}, [open]);
|
|
2954
|
-
return null;
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
2819
|
// src/components/populate-store.tsx
|
|
2958
|
-
import { useEffect as
|
|
2820
|
+
import { useEffect as useEffect6 } from "react";
|
|
2959
2821
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
2960
2822
|
function PopulateStore() {
|
|
2961
|
-
|
|
2823
|
+
useEffect6(() => {
|
|
2962
2824
|
loadCurrentDocumentClasses();
|
|
2963
2825
|
registerDataHook("after", "editor/documents/attach-preview", async () => {
|
|
2964
2826
|
await loadCurrentDocumentClasses();
|
|
@@ -3394,8 +3256,8 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3394
3256
|
};
|
|
3395
3257
|
|
|
3396
3258
|
// src/sync-with-document.tsx
|
|
3397
|
-
import { useEffect as
|
|
3398
|
-
import { __privateListenTo as
|
|
3259
|
+
import { useEffect as useEffect7 } from "react";
|
|
3260
|
+
import { __privateListenTo as listenTo, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
3399
3261
|
|
|
3400
3262
|
// src/sync-with-document-save.ts
|
|
3401
3263
|
import { getCurrentUser } from "@elementor/editor-current-user";
|
|
@@ -3458,12 +3320,11 @@ function isDirty() {
|
|
|
3458
3320
|
|
|
3459
3321
|
// src/sync-with-document.tsx
|
|
3460
3322
|
function SyncWithDocumentSave() {
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
const open = isExperimentActive3("e_editor_design_system_panel") ? () => {
|
|
3323
|
+
useEffect7(() => {
|
|
3324
|
+
const unsubscribe = listenTo(v1ReadyEvent(), () => {
|
|
3325
|
+
const open = () => {
|
|
3465
3326
|
window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
|
|
3466
|
-
}
|
|
3327
|
+
};
|
|
3467
3328
|
syncWithDocumentSave({ open });
|
|
3468
3329
|
});
|
|
3469
3330
|
return unsubscribe;
|
|
@@ -3474,9 +3335,6 @@ function SyncWithDocumentSave() {
|
|
|
3474
3335
|
// src/init.ts
|
|
3475
3336
|
function init() {
|
|
3476
3337
|
registerSlice(slice);
|
|
3477
|
-
if (!isExperimentActive4("e_editor_design_system_panel")) {
|
|
3478
|
-
registerPanel(panel);
|
|
3479
|
-
}
|
|
3480
3338
|
stylesRepository.register(globalClassesStylesProvider);
|
|
3481
3339
|
injectIntoLogic({
|
|
3482
3340
|
id: "global-classes-populate-store",
|
|
@@ -3494,16 +3352,6 @@ function init() {
|
|
|
3494
3352
|
id: "global-classes-prefetch-css-class-usage",
|
|
3495
3353
|
component: PrefetchCssClassUsage
|
|
3496
3354
|
});
|
|
3497
|
-
if (!isExperimentActive4("e_editor_design_system_panel")) {
|
|
3498
|
-
injectIntoLogic({
|
|
3499
|
-
id: "global-classes-open-panel-from-url",
|
|
3500
|
-
component: OpenPanelFromUrl
|
|
3501
|
-
});
|
|
3502
|
-
injectIntoLogic({
|
|
3503
|
-
id: "global-classes-open-panel-from-event",
|
|
3504
|
-
component: OpenPanelFromEvent
|
|
3505
|
-
});
|
|
3506
|
-
}
|
|
3507
3355
|
injectIntoCssClassConvert({
|
|
3508
3356
|
id: "global-classes-convert-from-local-class",
|
|
3509
3357
|
component: ConvertLocalClassToGlobalClass
|