@elementor/editor-global-classes 0.21.0 → 0.22.0
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/CHANGELOG.md +56 -0
- package/dist/index.js +320 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +301 -147
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/class-manager/class-item.tsx +238 -0
- package/src/components/class-manager/class-manager-class-not-found.tsx +56 -0
- package/src/components/class-manager/class-manager-panel.tsx +45 -4
- package/src/components/class-manager/class-manager-search.tsx +33 -0
- package/src/components/class-manager/global-classes-list.tsx +70 -239
package/dist/index.js
CHANGED
|
@@ -36,18 +36,18 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/init.ts
|
|
38
38
|
var import_editor = require("@elementor/editor");
|
|
39
|
-
var
|
|
39
|
+
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
40
40
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
41
41
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
42
|
-
var
|
|
42
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
43
43
|
var import_store22 = require("@elementor/store");
|
|
44
44
|
|
|
45
45
|
// src/components/class-manager/class-manager-button.tsx
|
|
46
|
-
var
|
|
46
|
+
var React11 = __toESM(require("react"));
|
|
47
47
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
48
48
|
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
49
|
-
var
|
|
50
|
-
var
|
|
49
|
+
var import_ui10 = require("@elementor/ui");
|
|
50
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
51
51
|
|
|
52
52
|
// src/global-classes-styles-provider.ts
|
|
53
53
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
@@ -332,17 +332,19 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
|
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
// src/components/class-manager/class-manager-panel.tsx
|
|
335
|
-
var
|
|
336
|
-
var
|
|
335
|
+
var import_react6 = require("react");
|
|
336
|
+
var React10 = __toESM(require("react"));
|
|
337
337
|
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
338
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
338
339
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
339
340
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
340
|
-
var
|
|
341
|
-
var
|
|
341
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
342
|
+
var import_icons7 = require("@elementor/icons");
|
|
342
343
|
var import_query = require("@elementor/query");
|
|
343
344
|
var import_store16 = require("@elementor/store");
|
|
344
|
-
var
|
|
345
|
-
var
|
|
345
|
+
var import_ui9 = require("@elementor/ui");
|
|
346
|
+
var import_utils2 = require("@elementor/utils");
|
|
347
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
346
348
|
|
|
347
349
|
// src/hooks/use-dirty-state.ts
|
|
348
350
|
var import_store4 = require("@elementor/store");
|
|
@@ -458,6 +460,26 @@ var IntroductionContent = () => {
|
|
|
458
460
|
)));
|
|
459
461
|
};
|
|
460
462
|
|
|
463
|
+
// src/components/class-manager/class-manager-search.tsx
|
|
464
|
+
var React2 = __toESM(require("react"));
|
|
465
|
+
var import_icons = require("@elementor/icons");
|
|
466
|
+
var import_ui2 = require("@elementor/ui");
|
|
467
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
468
|
+
var ClassManagerSearch = ({ searchValue, onChange }) => /* @__PURE__ */ React2.createElement(import_ui2.Grid, { item: true, xs: 6, px: 2, pb: 1 }, /* @__PURE__ */ React2.createElement(import_ui2.Stack, { direction: "row", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React2.createElement(import_ui2.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React2.createElement(
|
|
469
|
+
import_ui2.TextField,
|
|
470
|
+
{
|
|
471
|
+
role: "search",
|
|
472
|
+
fullWidth: true,
|
|
473
|
+
size: "tiny",
|
|
474
|
+
value: searchValue,
|
|
475
|
+
placeholder: (0, import_i18n3.__)("Search", "elementor"),
|
|
476
|
+
onChange: (e) => onChange(e.target.value),
|
|
477
|
+
InputProps: {
|
|
478
|
+
startAdornment: /* @__PURE__ */ React2.createElement(import_ui2.InputAdornment, { position: "start" }, /* @__PURE__ */ React2.createElement(import_icons.SearchIcon, { fontSize: "tiny" }))
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
))));
|
|
482
|
+
|
|
461
483
|
// src/components/class-manager/delete-class.ts
|
|
462
484
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
463
485
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
@@ -484,19 +506,16 @@ var reloadDocument = () => {
|
|
|
484
506
|
};
|
|
485
507
|
|
|
486
508
|
// src/components/class-manager/flipped-color-swatch-icon.tsx
|
|
487
|
-
var
|
|
488
|
-
var
|
|
489
|
-
var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */
|
|
509
|
+
var React3 = __toESM(require("react"));
|
|
510
|
+
var import_icons2 = require("@elementor/icons");
|
|
511
|
+
var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React3.createElement(import_icons2.ColorSwatchIcon, { sx: { transform: "rotate(90deg)", ...sx }, ...props });
|
|
490
512
|
|
|
491
513
|
// src/components/class-manager/global-classes-list.tsx
|
|
492
|
-
var
|
|
493
|
-
var
|
|
494
|
-
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
495
|
-
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
496
|
-
var import_icons4 = require("@elementor/icons");
|
|
514
|
+
var React8 = __toESM(require("react"));
|
|
515
|
+
var import_react4 = require("react");
|
|
497
516
|
var import_store14 = require("@elementor/store");
|
|
498
|
-
var
|
|
499
|
-
var
|
|
517
|
+
var import_ui7 = require("@elementor/ui");
|
|
518
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
500
519
|
|
|
501
520
|
// src/hooks/use-classes-order.ts
|
|
502
521
|
var import_store10 = require("@elementor/store");
|
|
@@ -510,12 +529,23 @@ var useOrderedClasses = () => {
|
|
|
510
529
|
return (0, import_store12.__useSelector)(selectOrderedClasses);
|
|
511
530
|
};
|
|
512
531
|
|
|
532
|
+
// src/components/class-manager/class-item.tsx
|
|
533
|
+
var React6 = __toESM(require("react"));
|
|
534
|
+
var import_react3 = require("react");
|
|
535
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
536
|
+
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
537
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
538
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
539
|
+
var import_icons5 = require("@elementor/icons");
|
|
540
|
+
var import_ui5 = require("@elementor/ui");
|
|
541
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
542
|
+
|
|
513
543
|
// src/components/class-manager/delete-confirmation-dialog.tsx
|
|
514
|
-
var
|
|
544
|
+
var React4 = __toESM(require("react"));
|
|
515
545
|
var import_react2 = require("react");
|
|
516
|
-
var
|
|
517
|
-
var
|
|
518
|
-
var
|
|
546
|
+
var import_icons3 = require("@elementor/icons");
|
|
547
|
+
var import_ui3 = require("@elementor/ui");
|
|
548
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
519
549
|
var context = (0, import_react2.createContext)(null);
|
|
520
550
|
var DeleteConfirmationProvider = ({ children }) => {
|
|
521
551
|
const [dialogProps, setDialogProps] = (0, import_react2.useState)(null);
|
|
@@ -525,7 +555,7 @@ var DeleteConfirmationProvider = ({ children }) => {
|
|
|
525
555
|
const closeDialog = () => {
|
|
526
556
|
setDialogProps(null);
|
|
527
557
|
};
|
|
528
|
-
return /* @__PURE__ */
|
|
558
|
+
return /* @__PURE__ */ React4.createElement(context.Provider, { value: { openDialog, closeDialog, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React4.createElement(DeleteConfirmationDialog, { ...dialogProps }));
|
|
529
559
|
};
|
|
530
560
|
var TITLE_ID = "delete-class-dialog";
|
|
531
561
|
var DeleteConfirmationDialog = ({ label, id: id2 }) => {
|
|
@@ -534,10 +564,10 @@ var DeleteConfirmationDialog = ({ label, id: id2 }) => {
|
|
|
534
564
|
deleteClass(id2);
|
|
535
565
|
closeDialog();
|
|
536
566
|
};
|
|
537
|
-
return /* @__PURE__ */
|
|
567
|
+
return /* @__PURE__ */ React4.createElement(import_ui3.Dialog, { open: true, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React4.createElement(import_ui3.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React4.createElement(import_icons3.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n4.__)("Delete this class?", "elementor")), /* @__PURE__ */ React4.createElement(import_ui3.DialogContent, null, /* @__PURE__ */ React4.createElement(import_ui3.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n4.__)("Deleting", "elementor"), /* @__PURE__ */ React4.createElement(import_ui3.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), (0, import_i18n4.__)(
|
|
538
568
|
"will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.",
|
|
539
569
|
"elementor"
|
|
540
|
-
))), /* @__PURE__ */
|
|
570
|
+
))), /* @__PURE__ */ React4.createElement(import_ui3.DialogActions, null, /* @__PURE__ */ React4.createElement(import_ui3.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n4.__)("Not now", "elementor")), /* @__PURE__ */ React4.createElement(import_ui3.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n4.__)("Delete", "elementor"))));
|
|
541
571
|
};
|
|
542
572
|
var useDeleteConfirmation = () => {
|
|
543
573
|
const contextValue = (0, import_react2.useContext)(context);
|
|
@@ -548,14 +578,14 @@ var useDeleteConfirmation = () => {
|
|
|
548
578
|
};
|
|
549
579
|
|
|
550
580
|
// src/components/class-manager/sortable.tsx
|
|
551
|
-
var
|
|
552
|
-
var
|
|
553
|
-
var
|
|
554
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
555
|
-
var SortableTrigger = (props) => /* @__PURE__ */
|
|
581
|
+
var React5 = __toESM(require("react"));
|
|
582
|
+
var import_icons4 = require("@elementor/icons");
|
|
583
|
+
var import_ui4 = require("@elementor/ui");
|
|
584
|
+
var SortableProvider = (props) => /* @__PURE__ */ React5.createElement(import_ui4.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
|
|
585
|
+
var SortableTrigger = (props) => /* @__PURE__ */ React5.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger" }, /* @__PURE__ */ React5.createElement(import_icons4.GripVerticalIcon, { fontSize: "tiny" }));
|
|
556
586
|
var SortableItem = ({ children, id: id2, ...props }) => {
|
|
557
|
-
return /* @__PURE__ */
|
|
558
|
-
|
|
587
|
+
return /* @__PURE__ */ React5.createElement(
|
|
588
|
+
import_ui4.UnstableSortableItem,
|
|
559
589
|
{
|
|
560
590
|
...props,
|
|
561
591
|
id: id2,
|
|
@@ -570,8 +600,8 @@ var SortableItem = ({ children, id: id2, ...props }) => {
|
|
|
570
600
|
isDragOverlay,
|
|
571
601
|
isDragPlaceholder
|
|
572
602
|
}) => {
|
|
573
|
-
return /* @__PURE__ */
|
|
574
|
-
|
|
603
|
+
return /* @__PURE__ */ React5.createElement(
|
|
604
|
+
import_ui4.Box,
|
|
575
605
|
{
|
|
576
606
|
...itemProps,
|
|
577
607
|
style: itemStyle,
|
|
@@ -589,83 +619,36 @@ var SortableItem = ({ children, id: id2, ...props }) => {
|
|
|
589
619
|
triggerStyle,
|
|
590
620
|
isDragPlaceholder
|
|
591
621
|
}),
|
|
592
|
-
showDropIndication && /* @__PURE__ */
|
|
622
|
+
showDropIndication && /* @__PURE__ */ React5.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
593
623
|
);
|
|
594
624
|
}
|
|
595
625
|
}
|
|
596
626
|
);
|
|
597
627
|
};
|
|
598
|
-
var StyledSortableTrigger = (0,
|
|
628
|
+
var StyledSortableTrigger = (0, import_ui4.styled)("div")(({ theme }) => ({
|
|
599
629
|
position: "absolute",
|
|
600
630
|
left: 0,
|
|
601
631
|
top: "50%",
|
|
602
632
|
transform: `translate( -${theme.spacing(1.5)}, -50% )`,
|
|
603
633
|
color: theme.palette.action.active
|
|
604
634
|
}));
|
|
605
|
-
var SortableItemIndicator = (0,
|
|
635
|
+
var SortableItemIndicator = (0, import_ui4.styled)(import_ui4.Box)`
|
|
606
636
|
width: 100%;
|
|
607
637
|
height: 1px;
|
|
608
638
|
background-color: ${({ theme }) => theme.palette.text.primary};
|
|
609
639
|
`;
|
|
610
640
|
|
|
611
|
-
// src/components/class-manager/
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
dispatch5(slice.actions.redo());
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
dispatch5(slice.actions.undo());
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
window.addEventListener("keydown", handler, {
|
|
629
|
-
capture: true
|
|
630
|
-
});
|
|
631
|
-
return () => window.removeEventListener("keydown", handler);
|
|
632
|
-
}, [dispatch5]);
|
|
633
|
-
if (!cssClasses?.length) {
|
|
634
|
-
return /* @__PURE__ */ React5.createElement(EmptyState, null);
|
|
635
|
-
}
|
|
636
|
-
return /* @__PURE__ */ React5.createElement(DeleteConfirmationProvider, null, /* @__PURE__ */ React5.createElement(import_ui4.List, { sx: { display: "flex", flexDirection: "column", gap: 0.5 } }, /* @__PURE__ */ React5.createElement(SortableProvider, { value: classesOrder, onChange: reorderClasses }, cssClasses?.map(({ id: id2, label }) => {
|
|
637
|
-
const renameClass = (newLabel) => {
|
|
638
|
-
dispatch5(
|
|
639
|
-
slice.actions.update({
|
|
640
|
-
style: {
|
|
641
|
-
id: id2,
|
|
642
|
-
label: newLabel
|
|
643
|
-
}
|
|
644
|
-
})
|
|
645
|
-
);
|
|
646
|
-
};
|
|
647
|
-
return /* @__PURE__ */ React5.createElement(SortableItem, { key: id2, id: id2 }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => /* @__PURE__ */ React5.createElement(
|
|
648
|
-
ClassItem,
|
|
649
|
-
{
|
|
650
|
-
id: id2,
|
|
651
|
-
label,
|
|
652
|
-
renameClass,
|
|
653
|
-
selected: isDragged,
|
|
654
|
-
disabled: disabled || isDragPlaceholder,
|
|
655
|
-
sortableTriggerProps: { ...triggerProps, style: triggerStyle }
|
|
656
|
-
}
|
|
657
|
-
));
|
|
658
|
-
}))));
|
|
659
|
-
};
|
|
660
|
-
var useReorder = () => {
|
|
661
|
-
const dispatch5 = (0, import_store14.__useDispatch)();
|
|
662
|
-
const order = useClassesOrder();
|
|
663
|
-
const reorder = (newIds) => {
|
|
664
|
-
dispatch5(slice.actions.setOrder(newIds));
|
|
665
|
-
};
|
|
666
|
-
return [order, reorder];
|
|
667
|
-
};
|
|
668
|
-
var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTriggerProps }) => {
|
|
641
|
+
// src/components/class-manager/class-item.tsx
|
|
642
|
+
var isVersion311IsActive = (0, import_editor_v1_adapters4.isExperimentActive)(import_editor_editing_panel.EXPERIMENTAL_FEATURES.V_3_31);
|
|
643
|
+
var ClassItem = ({
|
|
644
|
+
id: id2,
|
|
645
|
+
label,
|
|
646
|
+
renameClass,
|
|
647
|
+
selected,
|
|
648
|
+
disabled,
|
|
649
|
+
sortableTriggerProps,
|
|
650
|
+
isSearchActive
|
|
651
|
+
}) => {
|
|
669
652
|
const itemRef = (0, import_react3.useRef)(null);
|
|
670
653
|
const {
|
|
671
654
|
ref: editableRef,
|
|
@@ -679,12 +662,12 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
679
662
|
validation: validateLabel
|
|
680
663
|
});
|
|
681
664
|
const { openDialog } = useDeleteConfirmation();
|
|
682
|
-
const popupState = (0,
|
|
665
|
+
const popupState = (0, import_ui5.usePopupState)({
|
|
683
666
|
variant: "popover",
|
|
684
667
|
disableAutoFocus: true
|
|
685
668
|
});
|
|
686
669
|
const isSelected = (selected || popupState.isOpen) && !disabled;
|
|
687
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui5.Stack, { p: 0 }, /* @__PURE__ */ React6.createElement(
|
|
688
671
|
import_editor_ui2.WarningInfotip,
|
|
689
672
|
{
|
|
690
673
|
open: Boolean(error),
|
|
@@ -693,12 +676,13 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
693
676
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
694
677
|
offset: [0, -15]
|
|
695
678
|
},
|
|
696
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ React6.createElement(
|
|
697
680
|
StyledListItemButton,
|
|
698
681
|
{
|
|
699
682
|
ref: itemRef,
|
|
700
683
|
dense: true,
|
|
701
684
|
disableGutters: true,
|
|
685
|
+
showSortIndicator: isSearchActive,
|
|
702
686
|
showActions: isSelected || isEditing,
|
|
703
687
|
shape: "rounded",
|
|
704
688
|
onDoubleClick: openEditMode,
|
|
@@ -706,30 +690,30 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
706
690
|
disabled,
|
|
707
691
|
focusVisibleClassName: "visible-class-item"
|
|
708
692
|
},
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ React6.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
694
|
+
/* @__PURE__ */ React6.createElement(Indicator, { isActive: isEditing, isError: !!error }, isEditing ? /* @__PURE__ */ React6.createElement(
|
|
711
695
|
import_editor_ui2.EditableField,
|
|
712
696
|
{
|
|
713
697
|
ref: editableRef,
|
|
714
|
-
as:
|
|
698
|
+
as: import_ui5.Typography,
|
|
715
699
|
variant: "caption",
|
|
716
700
|
...getEditableProps()
|
|
717
701
|
}
|
|
718
|
-
) : /* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
|
|
702
|
+
) : /* @__PURE__ */ React6.createElement(import_editor_ui2.EllipsisWithTooltip, { title: label, as: import_ui5.Typography, variant: "caption" })),
|
|
703
|
+
/* @__PURE__ */ React6.createElement(
|
|
704
|
+
import_ui5.Tooltip,
|
|
721
705
|
{
|
|
722
706
|
placement: "top",
|
|
723
707
|
className: "class-item-more-actions",
|
|
724
|
-
title: (0,
|
|
708
|
+
title: (0, import_i18n5.__)("More actions", "elementor")
|
|
725
709
|
},
|
|
726
|
-
/* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ React6.createElement(import_ui5.IconButton, { size: "tiny", ...(0, import_ui5.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React6.createElement(import_icons5.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
727
711
|
)
|
|
728
712
|
)
|
|
729
|
-
)), /* @__PURE__ */
|
|
730
|
-
|
|
713
|
+
)), /* @__PURE__ */ React6.createElement(
|
|
714
|
+
import_ui5.Menu,
|
|
731
715
|
{
|
|
732
|
-
...(0,
|
|
716
|
+
...(0, import_ui5.bindMenu)(popupState),
|
|
733
717
|
anchorOrigin: {
|
|
734
718
|
vertical: "bottom",
|
|
735
719
|
horizontal: "right"
|
|
@@ -739,7 +723,7 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
739
723
|
horizontal: "right"
|
|
740
724
|
}
|
|
741
725
|
},
|
|
742
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ React6.createElement(
|
|
743
727
|
import_editor_ui2.MenuListItem,
|
|
744
728
|
{
|
|
745
729
|
sx: { minWidth: "160px" },
|
|
@@ -748,9 +732,9 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
748
732
|
openEditMode();
|
|
749
733
|
}
|
|
750
734
|
},
|
|
751
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ React6.createElement(import_ui5.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n5.__)("Rename", "elementor"))
|
|
752
736
|
),
|
|
753
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ React6.createElement(
|
|
754
738
|
import_editor_ui2.MenuListItem,
|
|
755
739
|
{
|
|
756
740
|
onClick: () => {
|
|
@@ -758,28 +742,43 @@ var ClassItem = ({ id: id2, label, renameClass, selected, disabled, sortableTrig
|
|
|
758
742
|
openDialog({ id: id2, label });
|
|
759
743
|
}
|
|
760
744
|
},
|
|
761
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ React6.createElement(import_ui5.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n5.__)("Delete", "elementor"))
|
|
762
746
|
)
|
|
763
747
|
));
|
|
764
748
|
};
|
|
765
|
-
var
|
|
766
|
-
shouldForwardProp: (prop) => !["showActions"].includes(prop)
|
|
749
|
+
var StyledListItemButtonV2 = (0, import_ui5.styled)(import_ui5.ListItemButton, {
|
|
750
|
+
shouldForwardProp: (prop) => !["showActions", "showSortIndicator"].includes(prop)
|
|
767
751
|
})(
|
|
768
|
-
({ showActions }) => `
|
|
752
|
+
({ showActions, showSortIndicator }) => `
|
|
769
753
|
min-height: 36px;
|
|
770
754
|
|
|
771
755
|
&.visible-class-item {
|
|
772
756
|
box-shadow: none !important;
|
|
773
757
|
}
|
|
774
|
-
|
|
758
|
+
.class-item-sortable-trigger {
|
|
759
|
+
visibility: ${showSortIndicator && showActions ? "visible" : "hidden"};
|
|
760
|
+
}
|
|
761
|
+
&:hover&:not(:disabled) {
|
|
762
|
+
.class-item-sortable-trigger {
|
|
763
|
+
visibility: ${showSortIndicator ? "visible" : "hidden"};
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
`
|
|
767
|
+
);
|
|
768
|
+
var StyledListItemButtonV1 = (0, import_ui5.styled)(import_ui5.ListItemButton, {
|
|
769
|
+
shouldForwardProp: (prop) => !["showActions", "showSortIndicator"].includes(prop)
|
|
770
|
+
})(
|
|
771
|
+
({ showActions }) => `
|
|
772
|
+
min-height: 36px;
|
|
773
|
+
&.visible-class-item {
|
|
774
|
+
box-shadow: none !important;
|
|
775
|
+
}
|
|
775
776
|
.class-item-more-actions, .class-item-sortable-trigger {
|
|
776
777
|
visibility: ${showActions ? "visible" : "hidden"};
|
|
777
778
|
}
|
|
778
|
-
|
|
779
779
|
.class-item-sortable-trigger {
|
|
780
780
|
visibility: ${showActions ? "visible" : "hidden"};
|
|
781
781
|
}
|
|
782
|
-
|
|
783
782
|
&:hover&:not(:disabled) {
|
|
784
783
|
.class-item-more-actions, .class-item-sortable-trigger {
|
|
785
784
|
visibility: visible;
|
|
@@ -787,16 +786,8 @@ var StyledListItemButton = (0, import_ui4.styled)(import_ui4.ListItemButton, {
|
|
|
787
786
|
}
|
|
788
787
|
`
|
|
789
788
|
);
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
"elementor"
|
|
793
|
-
)));
|
|
794
|
-
var StyledHeader = (0, import_ui4.styled)(import_ui4.Typography)(({ theme, variant }) => ({
|
|
795
|
-
"&.MuiTypography-root": {
|
|
796
|
-
...theme.typography[variant]
|
|
797
|
-
}
|
|
798
|
-
}));
|
|
799
|
-
var Indicator = (0, import_ui4.styled)(import_ui4.Box, {
|
|
789
|
+
var StyledListItemButton = isVersion311IsActive ? StyledListItemButtonV2 : StyledListItemButtonV1;
|
|
790
|
+
var Indicator = (0, import_ui5.styled)(import_ui5.Box, {
|
|
800
791
|
shouldForwardProp: (prop) => !["isActive", "isError"].includes(prop)
|
|
801
792
|
})(({ theme, isActive, isError }) => ({
|
|
802
793
|
display: "flex",
|
|
@@ -825,6 +816,129 @@ var validateLabel = (newLabel) => {
|
|
|
825
816
|
return result.errorMessage;
|
|
826
817
|
};
|
|
827
818
|
|
|
819
|
+
// src/components/class-manager/class-manager-class-not-found.tsx
|
|
820
|
+
var React7 = __toESM(require("react"));
|
|
821
|
+
var import_ui6 = require("@elementor/ui");
|
|
822
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
823
|
+
var CssClassNotFound = ({ onClear, searchValue }) => /* @__PURE__ */ React7.createElement(
|
|
824
|
+
import_ui6.Stack,
|
|
825
|
+
{
|
|
826
|
+
color: "text.secondary",
|
|
827
|
+
pt: 5,
|
|
828
|
+
alignItems: "center",
|
|
829
|
+
gap: 1,
|
|
830
|
+
overflow: "hidden",
|
|
831
|
+
maxWidth: "170px",
|
|
832
|
+
justifySelf: "center"
|
|
833
|
+
},
|
|
834
|
+
/* @__PURE__ */ React7.createElement(FlippedColorSwatchIcon, { color: "inherit", fontSize: "large" }),
|
|
835
|
+
/* @__PURE__ */ React7.createElement(import_ui6.Box, null, /* @__PURE__ */ React7.createElement(import_ui6.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, (0, import_i18n6.__)("Sorry, nothing matched", "elementor")), /* @__PURE__ */ React7.createElement(
|
|
836
|
+
import_ui6.Typography,
|
|
837
|
+
{
|
|
838
|
+
variant: "subtitle2",
|
|
839
|
+
color: "inherit",
|
|
840
|
+
sx: {
|
|
841
|
+
display: "flex",
|
|
842
|
+
width: "100%",
|
|
843
|
+
justifyContent: "center"
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
/* @__PURE__ */ React7.createElement("span", null, "\u201C"),
|
|
847
|
+
/* @__PURE__ */ React7.createElement(
|
|
848
|
+
"span",
|
|
849
|
+
{
|
|
850
|
+
style: {
|
|
851
|
+
maxWidth: "80%",
|
|
852
|
+
overflow: "hidden",
|
|
853
|
+
textOverflow: "ellipsis"
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
searchValue
|
|
857
|
+
),
|
|
858
|
+
/* @__PURE__ */ React7.createElement("span", null, "\u201D.")
|
|
859
|
+
)),
|
|
860
|
+
/* @__PURE__ */ React7.createElement(import_ui6.Typography, { align: "center", variant: "caption", color: "inherit" }, (0, import_i18n6.__)("Try something else.", "elementor"), /* @__PURE__ */ React7.createElement(import_ui6.Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n6.__)("Clear & try again", "elementor")))
|
|
861
|
+
);
|
|
862
|
+
|
|
863
|
+
// src/components/class-manager/global-classes-list.tsx
|
|
864
|
+
var GlobalClassesList = ({ disabled, searchValue, onSearch }) => {
|
|
865
|
+
const cssClasses = useOrderedClasses();
|
|
866
|
+
const dispatch5 = (0, import_store14.__useDispatch)();
|
|
867
|
+
const [classesOrder, reorderClasses] = useReorder();
|
|
868
|
+
const lowercaseLabels = (0, import_react4.useMemo)(
|
|
869
|
+
() => cssClasses.map((cssClass) => ({
|
|
870
|
+
...cssClass,
|
|
871
|
+
lowerLabel: cssClass.label.toLowerCase()
|
|
872
|
+
})),
|
|
873
|
+
[cssClasses]
|
|
874
|
+
);
|
|
875
|
+
const filteredClasses = (0, import_react4.useMemo)(() => {
|
|
876
|
+
return searchValue.length > 1 ? lowercaseLabels.filter(
|
|
877
|
+
(cssClass) => cssClass.lowerLabel.toLowerCase().includes(searchValue.toLowerCase())
|
|
878
|
+
) : cssClasses;
|
|
879
|
+
}, [searchValue, cssClasses, lowercaseLabels]);
|
|
880
|
+
(0, import_react4.useEffect)(() => {
|
|
881
|
+
const handler = (event) => {
|
|
882
|
+
if (event.key === "z" && (event.ctrlKey || event.metaKey)) {
|
|
883
|
+
event.stopImmediatePropagation();
|
|
884
|
+
event.preventDefault();
|
|
885
|
+
if (event.shiftKey) {
|
|
886
|
+
dispatch5(slice.actions.redo());
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
dispatch5(slice.actions.undo());
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
window.addEventListener("keydown", handler, {
|
|
893
|
+
capture: true
|
|
894
|
+
});
|
|
895
|
+
return () => window.removeEventListener("keydown", handler);
|
|
896
|
+
}, [dispatch5]);
|
|
897
|
+
if (!cssClasses?.length) {
|
|
898
|
+
return /* @__PURE__ */ React8.createElement(EmptyState, null);
|
|
899
|
+
}
|
|
900
|
+
return /* @__PURE__ */ React8.createElement(DeleteConfirmationProvider, null, filteredClasses.length <= 0 && searchValue.length > 1 ? /* @__PURE__ */ React8.createElement(CssClassNotFound, { onClear: () => onSearch(""), searchValue }) : /* @__PURE__ */ React8.createElement(import_ui7.List, { sx: { display: "flex", flexDirection: "column", gap: 0.5 } }, /* @__PURE__ */ React8.createElement(SortableProvider, { value: classesOrder, onChange: reorderClasses }, filteredClasses?.map(({ id: id2, label }) => {
|
|
901
|
+
return /* @__PURE__ */ React8.createElement(SortableItem, { key: id2, id: id2 }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => /* @__PURE__ */ React8.createElement(
|
|
902
|
+
ClassItem,
|
|
903
|
+
{
|
|
904
|
+
isSearchActive: searchValue.length < 2,
|
|
905
|
+
id: id2,
|
|
906
|
+
label,
|
|
907
|
+
renameClass: (newLabel) => {
|
|
908
|
+
dispatch5(
|
|
909
|
+
slice.actions.update({
|
|
910
|
+
style: {
|
|
911
|
+
id: id2,
|
|
912
|
+
label: newLabel
|
|
913
|
+
}
|
|
914
|
+
})
|
|
915
|
+
);
|
|
916
|
+
},
|
|
917
|
+
selected: isDragged,
|
|
918
|
+
disabled: disabled || isDragPlaceholder,
|
|
919
|
+
sortableTriggerProps: { ...triggerProps, style: triggerStyle }
|
|
920
|
+
}
|
|
921
|
+
));
|
|
922
|
+
}))));
|
|
923
|
+
};
|
|
924
|
+
var EmptyState = () => /* @__PURE__ */ React8.createElement(import_ui7.Stack, { alignItems: "center", gap: 1.5, pt: 10, px: 0.5, maxWidth: "260px", margin: "auto" }, /* @__PURE__ */ React8.createElement(FlippedColorSwatchIcon, { fontSize: "large" }), /* @__PURE__ */ React8.createElement(StyledHeader, { variant: "subtitle2", component: "h2", color: "text.secondary" }, (0, import_i18n7.__)("There are no global classes yet.", "elementor")), /* @__PURE__ */ React8.createElement(import_ui7.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n7.__)(
|
|
925
|
+
"CSS classes created in the editor panel will appear here. Once they are available, you can arrange their hierarchy, rename them, or delete them as needed.",
|
|
926
|
+
"elementor"
|
|
927
|
+
)));
|
|
928
|
+
var StyledHeader = (0, import_ui7.styled)(import_ui7.Typography)(({ theme, variant }) => ({
|
|
929
|
+
"&.MuiTypography-root": {
|
|
930
|
+
...theme.typography[variant]
|
|
931
|
+
}
|
|
932
|
+
}));
|
|
933
|
+
var useReorder = () => {
|
|
934
|
+
const dispatch5 = (0, import_store14.__useDispatch)();
|
|
935
|
+
const order = useClassesOrder();
|
|
936
|
+
const reorder = (newIds) => {
|
|
937
|
+
dispatch5(slice.actions.setOrder(newIds));
|
|
938
|
+
};
|
|
939
|
+
return [order, reorder];
|
|
940
|
+
};
|
|
941
|
+
|
|
828
942
|
// src/components/class-manager/panel-interactions.ts
|
|
829
943
|
function blockPanelInteractions() {
|
|
830
944
|
const extendedWindow = window;
|
|
@@ -836,52 +950,57 @@ function unblockPanelInteractions() {
|
|
|
836
950
|
}
|
|
837
951
|
|
|
838
952
|
// src/components/class-manager/save-changes-dialog.tsx
|
|
839
|
-
var
|
|
840
|
-
var
|
|
841
|
-
var
|
|
842
|
-
var
|
|
953
|
+
var React9 = __toESM(require("react"));
|
|
954
|
+
var import_react5 = require("react");
|
|
955
|
+
var import_icons6 = require("@elementor/icons");
|
|
956
|
+
var import_ui8 = require("@elementor/ui");
|
|
843
957
|
var TITLE_ID2 = "save-changes-dialog";
|
|
844
|
-
var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */
|
|
845
|
-
var SaveChangesDialogTitle = ({ children }) => /* @__PURE__ */
|
|
846
|
-
var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */
|
|
847
|
-
var SaveChangesDialogContentText = (props) => /* @__PURE__ */
|
|
958
|
+
var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React9.createElement(import_ui8.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
|
|
959
|
+
var SaveChangesDialogTitle = ({ children }) => /* @__PURE__ */ React9.createElement(import_ui8.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React9.createElement(import_icons6.AlertTriangleFilledIcon, { color: "secondary" }), children);
|
|
960
|
+
var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React9.createElement(import_ui8.DialogContent, null, children);
|
|
961
|
+
var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React9.createElement(import_ui8.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
|
|
848
962
|
var SaveChangesDialogActions = ({ actions }) => {
|
|
849
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
963
|
+
const [isConfirming, setIsConfirming] = (0, import_react5.useState)(false);
|
|
850
964
|
const { cancel, confirm, discard } = actions;
|
|
851
965
|
const onConfirm = async () => {
|
|
852
966
|
setIsConfirming(true);
|
|
853
967
|
await confirm.action();
|
|
854
968
|
setIsConfirming(false);
|
|
855
969
|
};
|
|
856
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ React9.createElement(import_ui8.DialogActions, null, cancel && /* @__PURE__ */ React9.createElement(import_ui8.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React9.createElement(import_ui8.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React9.createElement(import_ui8.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
|
|
857
971
|
};
|
|
858
972
|
SaveChangesDialog.Title = SaveChangesDialogTitle;
|
|
859
973
|
SaveChangesDialog.Content = SaveChangesDialogContent;
|
|
860
974
|
SaveChangesDialog.ContentText = SaveChangesDialogContentText;
|
|
861
975
|
SaveChangesDialog.Actions = SaveChangesDialogActions;
|
|
862
976
|
var useDialog = () => {
|
|
863
|
-
const [isOpen, setIsOpen] = (0,
|
|
977
|
+
const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
|
|
864
978
|
const open = () => setIsOpen(true);
|
|
865
979
|
const close = () => setIsOpen(false);
|
|
866
980
|
return { isOpen, open, close };
|
|
867
981
|
};
|
|
868
982
|
|
|
869
983
|
// src/components/class-manager/class-manager-panel.tsx
|
|
984
|
+
var isVersion311IsActive2 = (0, import_editor_v1_adapters5.isExperimentActive)(import_editor_editing_panel2.EXPERIMENTAL_FEATURES.V_3_31);
|
|
870
985
|
var id = "global-classes-manager";
|
|
871
986
|
var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
872
987
|
id,
|
|
873
988
|
component: ClassManagerPanel,
|
|
874
989
|
allowedEditModes: ["edit", id],
|
|
875
990
|
onOpen: () => {
|
|
876
|
-
(0,
|
|
991
|
+
(0, import_editor_v1_adapters5.changeEditMode)(id);
|
|
877
992
|
blockPanelInteractions();
|
|
878
993
|
},
|
|
879
994
|
onClose: () => {
|
|
880
|
-
(0,
|
|
995
|
+
(0, import_editor_v1_adapters5.changeEditMode)("edit");
|
|
881
996
|
unblockPanelInteractions();
|
|
882
997
|
}
|
|
883
998
|
});
|
|
884
999
|
function ClassManagerPanel() {
|
|
1000
|
+
const { debouncedValue, inputValue, handleChange } = (0, import_utils2.useDebounceState)({
|
|
1001
|
+
delay: 300,
|
|
1002
|
+
initialValue: ""
|
|
1003
|
+
});
|
|
885
1004
|
const isDirty2 = useDirtyState();
|
|
886
1005
|
const { close: closePanel } = usePanelActions();
|
|
887
1006
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
@@ -891,7 +1010,7 @@ function ClassManagerPanel() {
|
|
|
891
1010
|
closeSaveChangesDialog();
|
|
892
1011
|
};
|
|
893
1012
|
usePreventUnload();
|
|
894
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ React10.createElement(import_editor_ui3.ThemeProvider, null, /* @__PURE__ */ React10.createElement(import_ui9.ErrorBoundary, { fallback: /* @__PURE__ */ React10.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React10.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React10.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React10.createElement(import_ui9.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React10.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n8.__)("Class Manager", "elementor")), /* @__PURE__ */ React10.createElement(
|
|
895
1014
|
CloseButton,
|
|
896
1015
|
{
|
|
897
1016
|
sx: { marginLeft: "auto" },
|
|
@@ -904,8 +1023,43 @@ function ClassManagerPanel() {
|
|
|
904
1023
|
closePanel();
|
|
905
1024
|
}
|
|
906
1025
|
}
|
|
907
|
-
))), /* @__PURE__ */
|
|
908
|
-
|
|
1026
|
+
))), /* @__PURE__ */ React10.createElement(
|
|
1027
|
+
import_editor_panels.PanelBody,
|
|
1028
|
+
{
|
|
1029
|
+
sx: {
|
|
1030
|
+
display: "flex",
|
|
1031
|
+
flexDirection: "column",
|
|
1032
|
+
height: "100%"
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
isVersion311IsActive2 && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(ClassManagerSearch, { searchValue: inputValue, onChange: handleChange }), /* @__PURE__ */ React10.createElement(
|
|
1036
|
+
import_ui9.Divider,
|
|
1037
|
+
{
|
|
1038
|
+
sx: {
|
|
1039
|
+
borderWidth: "1px 0 0 0"
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
)),
|
|
1043
|
+
/* @__PURE__ */ React10.createElement(
|
|
1044
|
+
import_ui9.Box,
|
|
1045
|
+
{
|
|
1046
|
+
px: 2,
|
|
1047
|
+
sx: {
|
|
1048
|
+
flexGrow: 1,
|
|
1049
|
+
overflowY: "auto"
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
/* @__PURE__ */ React10.createElement(
|
|
1053
|
+
GlobalClassesList,
|
|
1054
|
+
{
|
|
1055
|
+
disabled: isPublishing,
|
|
1056
|
+
searchValue: debouncedValue,
|
|
1057
|
+
onSearch: handleChange
|
|
1058
|
+
}
|
|
1059
|
+
)
|
|
1060
|
+
)
|
|
1061
|
+
), /* @__PURE__ */ React10.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React10.createElement(
|
|
1062
|
+
import_ui9.Button,
|
|
909
1063
|
{
|
|
910
1064
|
fullWidth: true,
|
|
911
1065
|
size: "small",
|
|
@@ -915,19 +1069,19 @@ function ClassManagerPanel() {
|
|
|
915
1069
|
disabled: !isDirty2,
|
|
916
1070
|
loading: isPublishing
|
|
917
1071
|
},
|
|
918
|
-
(0,
|
|
919
|
-
)))), /* @__PURE__ */
|
|
1072
|
+
(0, import_i18n8.__)("Save changes", "elementor")
|
|
1073
|
+
)))), /* @__PURE__ */ React10.createElement(ClassManagerIntroduction, null), isSaveChangesDialogOpen && /* @__PURE__ */ React10.createElement(SaveChangesDialog, null, /* @__PURE__ */ React10.createElement(import_ui9.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React10.createElement(SaveChangesDialog.Title, null, (0, import_i18n8.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React10.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React10.createElement(SaveChangesDialog.ContentText, null, (0, import_i18n8.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React10.createElement(SaveChangesDialog.ContentText, null, (0, import_i18n8.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React10.createElement(
|
|
920
1074
|
SaveChangesDialog.Actions,
|
|
921
1075
|
{
|
|
922
1076
|
actions: {
|
|
923
1077
|
discard: {
|
|
924
|
-
label: (0,
|
|
1078
|
+
label: (0, import_i18n8.__)("Discard", "elementor"),
|
|
925
1079
|
action: () => {
|
|
926
1080
|
resetAndClosePanel();
|
|
927
1081
|
}
|
|
928
1082
|
},
|
|
929
1083
|
confirm: {
|
|
930
|
-
label: (0,
|
|
1084
|
+
label: (0, import_i18n8.__)("Save & Continue", "elementor"),
|
|
931
1085
|
action: async () => {
|
|
932
1086
|
await publish();
|
|
933
1087
|
closeSaveChangesDialog();
|
|
@@ -938,11 +1092,11 @@ function ClassManagerPanel() {
|
|
|
938
1092
|
}
|
|
939
1093
|
)));
|
|
940
1094
|
}
|
|
941
|
-
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */
|
|
942
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
1095
|
+
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React10.createElement(import_ui9.IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React10.createElement(import_icons7.XIcon, { fontSize: "small" }));
|
|
1096
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React10.createElement(import_ui9.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React10.createElement(import_ui9.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React10.createElement("strong", null, (0, import_i18n8.__)("Something went wrong", "elementor"))));
|
|
943
1097
|
var usePreventUnload = () => {
|
|
944
1098
|
const isDirty2 = useDirtyState();
|
|
945
|
-
(0,
|
|
1099
|
+
(0, import_react6.useEffect)(() => {
|
|
946
1100
|
const handleBeforeUnload = (event) => {
|
|
947
1101
|
if (isDirty2) {
|
|
948
1102
|
event.preventDefault();
|
|
@@ -984,19 +1138,19 @@ var ClassManagerButton = () => {
|
|
|
984
1138
|
}
|
|
985
1139
|
openPanel();
|
|
986
1140
|
};
|
|
987
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(import_ui10.Tooltip, { title: (0, import_i18n9.__)("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React11.createElement(import_ui10.IconButton, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React11.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React11.createElement(SaveChangesDialog, null, /* @__PURE__ */ React11.createElement(SaveChangesDialog.Title, null, (0, import_i18n9.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React11.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React11.createElement(SaveChangesDialog.ContentText, { sx: { mb: 2 } }, (0, import_i18n9.__)(
|
|
988
1142
|
"To open the Class Manager, save your page first. You can't continue without saving.",
|
|
989
1143
|
"elementor"
|
|
990
|
-
))), /* @__PURE__ */
|
|
1144
|
+
))), /* @__PURE__ */ React11.createElement(
|
|
991
1145
|
SaveChangesDialog.Actions,
|
|
992
1146
|
{
|
|
993
1147
|
actions: {
|
|
994
1148
|
cancel: {
|
|
995
|
-
label: (0,
|
|
1149
|
+
label: (0, import_i18n9.__)("Stay here", "elementor"),
|
|
996
1150
|
action: closeSaveChangesDialog
|
|
997
1151
|
},
|
|
998
1152
|
confirm: {
|
|
999
|
-
label: (0,
|
|
1153
|
+
label: (0, import_i18n9.__)("Save & Continue", "elementor"),
|
|
1000
1154
|
action: async () => {
|
|
1001
1155
|
await saveDocument();
|
|
1002
1156
|
closeSaveChangesDialog();
|
|
@@ -1009,11 +1163,11 @@ var ClassManagerButton = () => {
|
|
|
1009
1163
|
};
|
|
1010
1164
|
|
|
1011
1165
|
// src/components/populate-store.tsx
|
|
1012
|
-
var
|
|
1166
|
+
var import_react7 = require("react");
|
|
1013
1167
|
var import_store18 = require("@elementor/store");
|
|
1014
1168
|
function PopulateStore() {
|
|
1015
1169
|
const dispatch5 = (0, import_store18.__useDispatch)();
|
|
1016
|
-
(0,
|
|
1170
|
+
(0, import_react7.useEffect)(() => {
|
|
1017
1171
|
Promise.all([apiClient.all("preview"), apiClient.all("frontend")]).then(
|
|
1018
1172
|
([previewRes, frontendRes]) => {
|
|
1019
1173
|
const { data: previewData } = previewRes;
|
|
@@ -1038,7 +1192,7 @@ function PopulateStore() {
|
|
|
1038
1192
|
|
|
1039
1193
|
// src/sync-with-document-save.ts
|
|
1040
1194
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
1041
|
-
var
|
|
1195
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
1042
1196
|
var import_store20 = require("@elementor/store");
|
|
1043
1197
|
function syncWithDocumentSave() {
|
|
1044
1198
|
const unsubscribe = syncDirtyState();
|
|
@@ -1054,7 +1208,7 @@ function syncDirtyState() {
|
|
|
1054
1208
|
});
|
|
1055
1209
|
}
|
|
1056
1210
|
function bindSaveAction() {
|
|
1057
|
-
(0,
|
|
1211
|
+
(0, import_editor_v1_adapters6.registerDataHook)("after", "document/save/save", (args) => {
|
|
1058
1212
|
return saveGlobalClasses({
|
|
1059
1213
|
context: args.status === "publish" ? "frontend" : "preview"
|
|
1060
1214
|
});
|
|
@@ -1073,15 +1227,15 @@ function init() {
|
|
|
1073
1227
|
id: "global-classes-populate-store",
|
|
1074
1228
|
component: PopulateStore
|
|
1075
1229
|
});
|
|
1076
|
-
(0,
|
|
1230
|
+
(0, import_editor_editing_panel3.injectIntoClassSelectorActions)({
|
|
1077
1231
|
id: "global-classes-manager-button",
|
|
1078
1232
|
component: ClassManagerButton
|
|
1079
1233
|
});
|
|
1080
|
-
(0,
|
|
1234
|
+
(0, import_editor_editing_panel3.registerStyleProviderToColors)(GLOBAL_CLASSES_PROVIDER_KEY, {
|
|
1081
1235
|
name: "global",
|
|
1082
1236
|
getThemeColor: (theme) => theme.palette.global.dark
|
|
1083
1237
|
});
|
|
1084
|
-
(0,
|
|
1238
|
+
(0, import_editor_v1_adapters7.__privateListenTo)((0, import_editor_v1_adapters7.v1ReadyEvent)(), () => {
|
|
1085
1239
|
syncWithDocumentSave();
|
|
1086
1240
|
});
|
|
1087
1241
|
}
|