@elementor/editor-canvas 4.2.0-911 → 4.2.0-912
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 +228 -225
- package/dist/index.mjs +115 -112
- package/package.json +18 -18
- package/src/components/grid-outline/__tests__/grid-outline-overlay.test.tsx +2 -2
- package/src/components/grid-outline/__tests__/grid-outline.test.tsx +28 -27
- package/src/components/grid-outline/{grid-outline-line.tsx → grid-outline-cell.tsx} +11 -10
- package/src/components/grid-outline/grid-outline.tsx +10 -20
- package/src/hooks/__tests__/use-grid-tracks.test.ts +57 -35
- package/src/hooks/use-grid-tracks.ts +26 -25
- package/src/utils/__tests__/grid-outline-utils.test.ts +128 -38
- package/src/utils/grid-outline-utils.ts +52 -26
package/dist/index.js
CHANGED
|
@@ -423,12 +423,12 @@ var renameClass = (oldClassName, newClassName) => {
|
|
|
423
423
|
|
|
424
424
|
// src/components/elements-overlays.tsx
|
|
425
425
|
var React5 = __toESM(require("react"));
|
|
426
|
-
var
|
|
427
|
-
var
|
|
426
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
427
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
428
428
|
|
|
429
429
|
// src/components/grid-outline/grid-outline-overlay.tsx
|
|
430
430
|
var React4 = __toESM(require("react"));
|
|
431
|
-
var
|
|
431
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
432
432
|
var import_editor_props2 = require("@elementor/editor-props");
|
|
433
433
|
var import_ui2 = require("@elementor/ui");
|
|
434
434
|
var import_react8 = require("@floating-ui/react");
|
|
@@ -539,37 +539,53 @@ function useFloatingOnElement({ element, isSelected }) {
|
|
|
539
539
|
|
|
540
540
|
// src/hooks/use-grid-tracks.ts
|
|
541
541
|
var import_react5 = require("react");
|
|
542
|
+
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
543
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
542
544
|
|
|
543
545
|
// src/utils/grid-outline-utils.ts
|
|
544
|
-
function
|
|
545
|
-
const { columns, rows, columnGap, rowGap, padding } = tracks;
|
|
546
|
+
function toGridTracks(computedStyle) {
|
|
546
547
|
return {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
548
|
+
columns: parseTrackList(computedStyle.gridTemplateColumns),
|
|
549
|
+
rows: parseTrackList(computedStyle.gridTemplateRows),
|
|
550
|
+
columnGap: toPx(computedStyle.columnGap),
|
|
551
|
+
rowGap: toPx(computedStyle.rowGap),
|
|
552
|
+
padding: {
|
|
553
|
+
top: toPx(computedStyle.paddingTop),
|
|
554
|
+
right: toPx(computedStyle.paddingRight),
|
|
555
|
+
bottom: toPx(computedStyle.paddingBottom),
|
|
556
|
+
left: toPx(computedStyle.paddingLeft)
|
|
557
|
+
},
|
|
558
|
+
borderColor: computedStyle.getPropertyValue("--e-a-border-color-bold").trim()
|
|
553
559
|
};
|
|
554
560
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
561
|
+
function computeCellRects(tracks, width, height) {
|
|
562
|
+
const { columns, rows, columnGap, rowGap, padding } = tracks;
|
|
563
|
+
const hasColumns = columns.length > 0;
|
|
564
|
+
const hasRows = rows.length > 0;
|
|
565
|
+
if (!hasColumns && !hasRows) {
|
|
557
566
|
return [];
|
|
558
567
|
}
|
|
559
|
-
const
|
|
568
|
+
const columnSegments = hasColumns ? computeTrackSegments(columns, columnGap, padding.left) : [{ start: padding.left, size: width - padding.left - padding.right }];
|
|
569
|
+
const rowSegments = hasRows ? computeTrackSegments(rows, rowGap, padding.top) : [{ start: padding.top, size: height - padding.top - padding.bottom }];
|
|
570
|
+
const cells = [];
|
|
571
|
+
for (const row of rowSegments) {
|
|
572
|
+
for (const column of columnSegments) {
|
|
573
|
+
cells.push({ x: column.start, y: row.start, width: column.size, height: row.size });
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return cells;
|
|
577
|
+
}
|
|
578
|
+
function computeTrackSegments(sizes, gap, offset2) {
|
|
579
|
+
const segments = [];
|
|
560
580
|
let cursor = offset2;
|
|
561
581
|
for (let i = 0; i < sizes.length; i++) {
|
|
562
|
-
|
|
563
|
-
boundaries.push(cursor);
|
|
564
|
-
}
|
|
582
|
+
segments.push({ start: cursor, size: sizes[i] });
|
|
565
583
|
cursor += sizes[i];
|
|
566
|
-
|
|
567
|
-
if (i < sizes.length - 1 && gap > 0) {
|
|
584
|
+
if (i < sizes.length - 1) {
|
|
568
585
|
cursor += gap;
|
|
569
|
-
boundaries.push(cursor);
|
|
570
586
|
}
|
|
571
587
|
}
|
|
572
|
-
return
|
|
588
|
+
return segments;
|
|
573
589
|
}
|
|
574
590
|
function snapToHalfPixel(value) {
|
|
575
591
|
return Math.round(value) + 0.5;
|
|
@@ -594,30 +610,27 @@ var EMPTY = {
|
|
|
594
610
|
padding: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
595
611
|
borderColor: ""
|
|
596
612
|
};
|
|
613
|
+
var DEVICE_MODE_CHANGE_EVENT = "elementor/device-mode/change";
|
|
597
614
|
function useGridTracks(element, rect) {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
615
|
+
const [tracks, setTracks] = (0, import_react5.useState)(EMPTY);
|
|
616
|
+
const trigger = (0, import_editor_v1_adapters2.__privateUseListenTo)(
|
|
617
|
+
[(0, import_editor_v1_adapters2.windowEvent)(import_editor_elements3.ELEMENT_STYLE_CHANGE_EVENT), (0, import_editor_v1_adapters2.windowEvent)(DEVICE_MODE_CHANGE_EVENT)],
|
|
618
|
+
() => ({})
|
|
619
|
+
);
|
|
620
|
+
(0, import_react5.useEffect)(() => {
|
|
621
|
+
const previewWindow = element?.ownerDocument?.defaultView;
|
|
622
|
+
if (!element || !previewWindow) {
|
|
623
|
+
setTracks(EMPTY);
|
|
624
|
+
return;
|
|
605
625
|
}
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
rowGap: toPx(computedStyle.rowGap),
|
|
612
|
-
padding: {
|
|
613
|
-
top: toPx(computedStyle.paddingTop),
|
|
614
|
-
right: toPx(computedStyle.paddingRight),
|
|
615
|
-
bottom: toPx(computedStyle.paddingBottom),
|
|
616
|
-
left: toPx(computedStyle.paddingLeft)
|
|
617
|
-
},
|
|
618
|
-
borderColor: computedStyle.getPropertyValue("--e-a-border-color-bold").trim()
|
|
626
|
+
const frame = previewWindow.requestAnimationFrame(() => {
|
|
627
|
+
setTracks(toGridTracks(previewWindow.getComputedStyle(element)));
|
|
628
|
+
});
|
|
629
|
+
return () => {
|
|
630
|
+
previewWindow.cancelAnimationFrame(frame);
|
|
619
631
|
};
|
|
620
|
-
}, [element, rect.width, rect.height]);
|
|
632
|
+
}, [element, rect.width, rect.height, trigger]);
|
|
633
|
+
return tracks;
|
|
621
634
|
}
|
|
622
635
|
|
|
623
636
|
// src/components/outline-overlay.tsx
|
|
@@ -711,18 +724,19 @@ var OutlineOverlay = ({ element, isSelected, id, isGlobal = false }) => {
|
|
|
711
724
|
// src/components/grid-outline/grid-outline.tsx
|
|
712
725
|
var React3 = __toESM(require("react"));
|
|
713
726
|
|
|
714
|
-
// src/components/grid-outline/grid-outline-
|
|
727
|
+
// src/components/grid-outline/grid-outline-cell.tsx
|
|
715
728
|
var React2 = __toESM(require("react"));
|
|
716
729
|
var FALLBACK_COLOR = "rgba(0, 0, 0, 0.12)";
|
|
717
730
|
var DASH = "2 2";
|
|
718
|
-
function
|
|
731
|
+
function GridOutlineCell({ x, y, width, height, color }) {
|
|
719
732
|
return /* @__PURE__ */ React2.createElement(
|
|
720
|
-
"
|
|
733
|
+
"rect",
|
|
721
734
|
{
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
735
|
+
x,
|
|
736
|
+
y,
|
|
737
|
+
width,
|
|
738
|
+
height,
|
|
739
|
+
fill: "none",
|
|
726
740
|
stroke: color || FALLBACK_COLOR,
|
|
727
741
|
strokeWidth: 1,
|
|
728
742
|
strokeDasharray: DASH,
|
|
@@ -733,7 +747,7 @@ function GridOutlineLine({ x1, x2, y1, y2, color }) {
|
|
|
733
747
|
|
|
734
748
|
// src/components/grid-outline/grid-outline.tsx
|
|
735
749
|
function GridOutline({ tracks, width, height }) {
|
|
736
|
-
const
|
|
750
|
+
const cells = computeCellRects(tracks, width, height);
|
|
737
751
|
return /* @__PURE__ */ React3.createElement(
|
|
738
752
|
"svg",
|
|
739
753
|
{
|
|
@@ -742,25 +756,14 @@ function GridOutline({ tracks, width, height }) {
|
|
|
742
756
|
style: { position: "absolute", inset: 0, overflow: "visible" },
|
|
743
757
|
xmlns: "http://www.w3.org/2000/svg"
|
|
744
758
|
},
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
{
|
|
748
|
-
key: `v-${i}`,
|
|
749
|
-
x1: snapToHalfPixel(x),
|
|
750
|
-
x2: snapToHalfPixel(x),
|
|
751
|
-
y1: top,
|
|
752
|
-
y2: bottom,
|
|
753
|
-
color: tracks.borderColor
|
|
754
|
-
}
|
|
755
|
-
)),
|
|
756
|
-
horizontal.map((y, i) => /* @__PURE__ */ React3.createElement(
|
|
757
|
-
GridOutlineLine,
|
|
759
|
+
cells.map((cell, i) => /* @__PURE__ */ React3.createElement(
|
|
760
|
+
GridOutlineCell,
|
|
758
761
|
{
|
|
759
|
-
key:
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
762
|
+
key: i,
|
|
763
|
+
x: snapToHalfPixel(cell.x),
|
|
764
|
+
y: snapToHalfPixel(cell.y),
|
|
765
|
+
width: Math.round(cell.width),
|
|
766
|
+
height: Math.round(cell.height),
|
|
764
767
|
color: tracks.borderColor
|
|
765
768
|
}
|
|
766
769
|
))
|
|
@@ -769,7 +772,7 @@ function GridOutline({ tracks, width, height }) {
|
|
|
769
772
|
|
|
770
773
|
// src/components/grid-outline/grid-outline-overlay.tsx
|
|
771
774
|
var GridOutlineOverlay = ({ element, id, isSelected }) => {
|
|
772
|
-
const { settings } = (0,
|
|
775
|
+
const { settings } = (0, import_editor_elements4.useSelectedElementSettings)();
|
|
773
776
|
const enabled = import_editor_props2.booleanPropTypeUtil.extract(settings?.grid_outline);
|
|
774
777
|
const rect = useElementRect(element);
|
|
775
778
|
const tracks = useGridTracks(element, rect);
|
|
@@ -805,11 +808,11 @@ var overlayRegistry = [
|
|
|
805
808
|
}
|
|
806
809
|
];
|
|
807
810
|
function ElementsOverlays() {
|
|
808
|
-
const selected = (0,
|
|
811
|
+
const selected = (0, import_editor_elements5.useSelectedElement)();
|
|
809
812
|
const elements = useElementsDom();
|
|
810
|
-
const currentEditMode = (0,
|
|
813
|
+
const currentEditMode = (0, import_editor_v1_adapters3.useEditMode)();
|
|
811
814
|
const isEditMode = currentEditMode === "edit";
|
|
812
|
-
const isKitRouteActive = (0,
|
|
815
|
+
const isKitRouteActive = (0, import_editor_v1_adapters3.__privateUseIsRouteActive)("panel/global");
|
|
813
816
|
const isActive = isEditMode && !isKitRouteActive;
|
|
814
817
|
if (!isActive) {
|
|
815
818
|
return null;
|
|
@@ -831,10 +834,10 @@ function ElementsOverlays() {
|
|
|
831
834
|
});
|
|
832
835
|
}
|
|
833
836
|
function useElementsDom() {
|
|
834
|
-
return (0,
|
|
835
|
-
[(0,
|
|
837
|
+
return (0, import_editor_v1_adapters3.__privateUseListenTo)(
|
|
838
|
+
[(0, import_editor_v1_adapters3.windowEvent)("elementor/editor/element-rendered"), (0, import_editor_v1_adapters3.windowEvent)("elementor/editor/element-destroyed")],
|
|
836
839
|
() => {
|
|
837
|
-
return (0,
|
|
840
|
+
return (0, import_editor_elements5.getElements)().filter((el) => isV4Element(el.view?.el?.dataset)).map((element) => ({
|
|
838
841
|
id: element.id,
|
|
839
842
|
domElement: element.view?.getDomElement?.()?.get?.(0),
|
|
840
843
|
isGlobal: element.model.get("isGlobal") ?? false
|
|
@@ -851,13 +854,13 @@ function isV4Element(dataset) {
|
|
|
851
854
|
|
|
852
855
|
// src/components/interactions-renderer.tsx
|
|
853
856
|
var React6 = __toESM(require("react"));
|
|
854
|
-
var
|
|
857
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
855
858
|
var import_ui3 = require("@elementor/ui");
|
|
856
859
|
|
|
857
860
|
// src/hooks/use-interactions-items.ts
|
|
858
861
|
var import_react10 = require("react");
|
|
859
862
|
var import_editor_interactions = require("@elementor/editor-interactions");
|
|
860
|
-
var
|
|
863
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
861
864
|
|
|
862
865
|
// src/hooks/use-on-mount.ts
|
|
863
866
|
var import_react9 = require("react");
|
|
@@ -913,7 +916,7 @@ function useInteractionsItems() {
|
|
|
913
916
|
if (providerAndSubscribers.length === 0) {
|
|
914
917
|
return;
|
|
915
918
|
}
|
|
916
|
-
(0,
|
|
919
|
+
(0, import_editor_v1_adapters4.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
917
920
|
providerAndSubscribers.forEach(({ subscriber }) => {
|
|
918
921
|
try {
|
|
919
922
|
subscriber();
|
|
@@ -964,23 +967,23 @@ function InteractionsRenderer() {
|
|
|
964
967
|
));
|
|
965
968
|
}
|
|
966
969
|
function usePortalContainer() {
|
|
967
|
-
return (0,
|
|
970
|
+
return (0, import_editor_v1_adapters5.__privateUseListenTo)((0, import_editor_v1_adapters5.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters5.getCanvasIframeDocument)()?.head);
|
|
968
971
|
}
|
|
969
972
|
|
|
970
973
|
// src/components/style-renderer.tsx
|
|
971
974
|
var React7 = __toESM(require("react"));
|
|
972
|
-
var
|
|
975
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
973
976
|
var import_ui4 = require("@elementor/ui");
|
|
974
977
|
|
|
975
978
|
// src/hooks/use-documents-css-links.ts
|
|
976
|
-
var
|
|
979
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
977
980
|
var REMOVED_ATTR = "data-e-removed";
|
|
978
981
|
var DOCUMENT_WRAPPER_ATTR = "data-elementor-id";
|
|
979
982
|
var CSS_LINK_ID_PREFIX = "elementor-post-";
|
|
980
983
|
var CSS_LINK_ID_SUFFIX = "-css";
|
|
981
984
|
function useDocumentsCssLinks() {
|
|
982
|
-
return (0,
|
|
983
|
-
const iframeDocument = (0,
|
|
985
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => {
|
|
986
|
+
const iframeDocument = (0, import_editor_v1_adapters6.getCanvasIframeDocument)();
|
|
984
987
|
if (!iframeDocument) {
|
|
985
988
|
return [];
|
|
986
989
|
}
|
|
@@ -1024,7 +1027,7 @@ var import_react13 = require("react");
|
|
|
1024
1027
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
1025
1028
|
var import_editor_styles4 = require("@elementor/editor-styles");
|
|
1026
1029
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
1027
|
-
var
|
|
1030
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
1028
1031
|
|
|
1029
1032
|
// src/utils/abort-previous-runs.ts
|
|
1030
1033
|
function abortPreviousRuns(cb) {
|
|
@@ -1039,13 +1042,13 @@ function abortPreviousRuns(cb) {
|
|
|
1039
1042
|
}
|
|
1040
1043
|
|
|
1041
1044
|
// src/utils/pregenerated-links-removal.ts
|
|
1042
|
-
var
|
|
1045
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
1043
1046
|
var removedProviderKeys = /* @__PURE__ */ new Set();
|
|
1044
1047
|
function removeProviderPregeneratedLinks(providerKey, removePregeneratedLink) {
|
|
1045
1048
|
if (removedProviderKeys.has(providerKey)) {
|
|
1046
1049
|
return;
|
|
1047
1050
|
}
|
|
1048
|
-
const iframeDocument = (0,
|
|
1051
|
+
const iframeDocument = (0, import_editor_v1_adapters7.getCanvasIframeDocument)();
|
|
1049
1052
|
if (!iframeDocument) {
|
|
1050
1053
|
return;
|
|
1051
1054
|
}
|
|
@@ -1084,7 +1087,7 @@ function signalizedProcess(signal, steps = []) {
|
|
|
1084
1087
|
// src/hooks/use-style-prop-resolver.ts
|
|
1085
1088
|
var import_react11 = require("react");
|
|
1086
1089
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1087
|
-
var
|
|
1090
|
+
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
1088
1091
|
|
|
1089
1092
|
// src/renderers/create-props-resolver.ts
|
|
1090
1093
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
@@ -1218,7 +1221,7 @@ function useStylePropResolver() {
|
|
|
1218
1221
|
if (key !== "font-family" || typeof value !== "string") {
|
|
1219
1222
|
return;
|
|
1220
1223
|
}
|
|
1221
|
-
(0,
|
|
1224
|
+
(0, import_editor_v1_adapters8.enqueueFont)(value);
|
|
1222
1225
|
}
|
|
1223
1226
|
});
|
|
1224
1227
|
}, []);
|
|
@@ -1385,7 +1388,7 @@ function useStyleItems() {
|
|
|
1385
1388
|
};
|
|
1386
1389
|
}, [providerAndSubscribers]);
|
|
1387
1390
|
useOnMount(() => {
|
|
1388
|
-
(0,
|
|
1391
|
+
(0, import_editor_v1_adapters9.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
1389
1392
|
resetRemovedProviders();
|
|
1390
1393
|
const promises = providerAndSubscribers.map(async ({ subscriber }) => subscriber());
|
|
1391
1394
|
await Promise.all(promises);
|
|
@@ -1540,7 +1543,7 @@ function StyleRenderer() {
|
|
|
1540
1543
|
return /* @__PURE__ */ React7.createElement(import_ui4.Portal, { container }, filterUniqueStyleDefinitions(styleItems).map((item) => /* @__PURE__ */ React7.createElement("style", { key: `${item.id}-${item.breakpoint}-${item.state ?? "normal"}` }, item.value)), linksAttrs.map((attrs) => /* @__PURE__ */ React7.createElement("link", { ...attrs, key: attrs.id })));
|
|
1541
1544
|
}
|
|
1542
1545
|
function usePortalContainer2() {
|
|
1543
|
-
return (0,
|
|
1546
|
+
return (0, import_editor_v1_adapters10.__privateUseListenTo)((0, import_editor_v1_adapters10.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters10.getCanvasIframeDocument)()?.head);
|
|
1544
1547
|
}
|
|
1545
1548
|
function filterUniqueStyleDefinitions(styleItems) {
|
|
1546
1549
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -1563,11 +1566,11 @@ function filterUniqueStyleDefinitions(styleItems) {
|
|
|
1563
1566
|
|
|
1564
1567
|
// src/form-structure/enforce-form-ancestor-commands.ts
|
|
1565
1568
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
1566
|
-
var
|
|
1569
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
1567
1570
|
var import_i18n = require("@wordpress/i18n");
|
|
1568
1571
|
|
|
1569
1572
|
// src/form-structure/utils.ts
|
|
1570
|
-
var
|
|
1573
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1571
1574
|
var FORM_ELEMENT_TYPE = "e-form";
|
|
1572
1575
|
var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set([
|
|
1573
1576
|
"e-form-input",
|
|
@@ -1597,10 +1600,10 @@ function isWithinForm(element) {
|
|
|
1597
1600
|
return isElementWithinFormSelector(element);
|
|
1598
1601
|
}
|
|
1599
1602
|
function hasElementType(element, type) {
|
|
1600
|
-
return (0,
|
|
1603
|
+
return (0, import_editor_elements6.getAllDescendants)(element).some((item) => getElementType(item) === type);
|
|
1601
1604
|
}
|
|
1602
1605
|
function hasElementTypes(element, types) {
|
|
1603
|
-
return (0,
|
|
1606
|
+
return (0, import_editor_elements6.getAllDescendants)(element).some((item) => {
|
|
1604
1607
|
const itemType = getElementType(item);
|
|
1605
1608
|
return itemType ? types.has(itemType) : false;
|
|
1606
1609
|
});
|
|
@@ -1640,15 +1643,15 @@ var FORM_FIELDS_OUTSIDE_ALERT = {
|
|
|
1640
1643
|
id: "form-fields-outside-form-blocked"
|
|
1641
1644
|
};
|
|
1642
1645
|
function initFormAncestorEnforcement() {
|
|
1643
|
-
(0,
|
|
1646
|
+
(0, import_editor_v1_adapters11.blockCommand)({
|
|
1644
1647
|
command: "document/elements/create",
|
|
1645
1648
|
condition: blockFormFieldCreate
|
|
1646
1649
|
});
|
|
1647
|
-
(0,
|
|
1650
|
+
(0, import_editor_v1_adapters11.blockCommand)({
|
|
1648
1651
|
command: "document/elements/move",
|
|
1649
1652
|
condition: blockFormFieldMove
|
|
1650
1653
|
});
|
|
1651
|
-
(0,
|
|
1654
|
+
(0, import_editor_v1_adapters11.blockCommand)({
|
|
1652
1655
|
command: "document/elements/paste",
|
|
1653
1656
|
condition: blockFormFieldPaste
|
|
1654
1657
|
});
|
|
@@ -1697,7 +1700,7 @@ function handleBlockedFormField() {
|
|
|
1697
1700
|
|
|
1698
1701
|
// src/form-structure/prevent-form-nesting-commands.ts
|
|
1699
1702
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
1700
|
-
var
|
|
1703
|
+
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
1701
1704
|
var import_i18n2 = require("@wordpress/i18n");
|
|
1702
1705
|
var FORM_NESTING_ALERT = {
|
|
1703
1706
|
type: "default",
|
|
@@ -1705,15 +1708,15 @@ var FORM_NESTING_ALERT = {
|
|
|
1705
1708
|
id: "form-nesting-blocked"
|
|
1706
1709
|
};
|
|
1707
1710
|
function initFormNestingPrevention() {
|
|
1708
|
-
(0,
|
|
1711
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
1709
1712
|
command: "document/elements/create",
|
|
1710
1713
|
condition: blockFormCreate
|
|
1711
1714
|
});
|
|
1712
|
-
(0,
|
|
1715
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
1713
1716
|
command: "document/elements/move",
|
|
1714
1717
|
condition: blockFormMove
|
|
1715
1718
|
});
|
|
1716
|
-
(0,
|
|
1719
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
1717
1720
|
command: "document/elements/paste",
|
|
1718
1721
|
condition: blockFormPaste
|
|
1719
1722
|
});
|
|
@@ -2328,8 +2331,8 @@ function initStyleTransformers() {
|
|
|
2328
2331
|
}
|
|
2329
2332
|
|
|
2330
2333
|
// src/legacy/init-legacy-views.ts
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2334
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
2335
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
2333
2336
|
|
|
2334
2337
|
// src/renderers/create-dom-renderer.ts
|
|
2335
2338
|
var import_twing = require("@elementor/twing");
|
|
@@ -2457,25 +2460,25 @@ function createElementViewClassDeclaration() {
|
|
|
2457
2460
|
}
|
|
2458
2461
|
|
|
2459
2462
|
// src/legacy/create-nested-templated-element-type.ts
|
|
2460
|
-
var
|
|
2463
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2461
2464
|
|
|
2462
2465
|
// src/legacy/create-pending-element.ts
|
|
2463
|
-
var
|
|
2466
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2464
2467
|
function createPendingElement(wrapperView, data, options = {}) {
|
|
2465
2468
|
const parentContainer = wrapperView.getContainer();
|
|
2466
2469
|
const model = { ...data };
|
|
2467
2470
|
if (!model.id) {
|
|
2468
|
-
model.id = (0,
|
|
2471
|
+
model.id = (0, import_editor_elements7.generateElementId)();
|
|
2469
2472
|
}
|
|
2470
2473
|
if (!model.elements) {
|
|
2471
2474
|
model.elements = [];
|
|
2472
2475
|
}
|
|
2473
|
-
const added = (0,
|
|
2476
|
+
const added = (0, import_editor_elements7.addModelToParent)(parentContainer.id, model, options);
|
|
2474
2477
|
if (!added) {
|
|
2475
2478
|
return void 0;
|
|
2476
2479
|
}
|
|
2477
2480
|
const childId = model.id;
|
|
2478
|
-
const childModel = (0,
|
|
2481
|
+
const childModel = (0, import_editor_elements7.findModelInDocument)(childId);
|
|
2479
2482
|
if (!childModel) {
|
|
2480
2483
|
return void 0;
|
|
2481
2484
|
}
|
|
@@ -2486,7 +2489,7 @@ function createPendingElement(wrapperView, data, options = {}) {
|
|
|
2486
2489
|
model: childModel,
|
|
2487
2490
|
view: void 0,
|
|
2488
2491
|
lookup() {
|
|
2489
|
-
return (0,
|
|
2492
|
+
return (0, import_editor_elements7.getContainer)(childId) ?? pendingContainer;
|
|
2490
2493
|
}
|
|
2491
2494
|
};
|
|
2492
2495
|
wrapperView.once("render", () => {
|
|
@@ -2499,7 +2502,7 @@ function createPendingElement(wrapperView, data, options = {}) {
|
|
|
2499
2502
|
}
|
|
2500
2503
|
function selectChildWhenWrapperRenders(wrapperView, childId) {
|
|
2501
2504
|
wrapperView.once("render", () => {
|
|
2502
|
-
const childContainer = (0,
|
|
2505
|
+
const childContainer = (0, import_editor_elements7.getContainer)(childId);
|
|
2503
2506
|
if (childContainer?.model?.trigger) {
|
|
2504
2507
|
childContainer.model.trigger("request:edit");
|
|
2505
2508
|
return;
|
|
@@ -2765,7 +2768,7 @@ function createNestedTemplatedElementView({
|
|
|
2765
2768
|
this._initAlpine();
|
|
2766
2769
|
});
|
|
2767
2770
|
this.model.trigger("render:complete");
|
|
2768
|
-
window.dispatchEvent(new CustomEvent(
|
|
2771
|
+
window.dispatchEvent(new CustomEvent(import_editor_elements8.ELEMENT_STYLE_CHANGE_EVENT));
|
|
2769
2772
|
},
|
|
2770
2773
|
async _renderTemplate() {
|
|
2771
2774
|
const model = this.model;
|
|
@@ -3006,9 +3009,9 @@ var import_client = require("react-dom/client");
|
|
|
3006
3009
|
|
|
3007
3010
|
// src/legacy/replacements/inline-editing/inline-editing-elements.tsx
|
|
3008
3011
|
var React9 = __toESM(require("react"));
|
|
3009
|
-
var
|
|
3012
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
3010
3013
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3011
|
-
var
|
|
3014
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
3012
3015
|
var import_i18n3 = require("@wordpress/i18n");
|
|
3013
3016
|
|
|
3014
3017
|
// src/legacy/replacements/base.ts
|
|
@@ -3326,7 +3329,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3326
3329
|
return this.editing;
|
|
3327
3330
|
}
|
|
3328
3331
|
shouldRenderReplacement() {
|
|
3329
|
-
return this.isInlineEditingEligible() && (0,
|
|
3332
|
+
return this.isInlineEditingEligible() && (0, import_editor_v1_adapters13.getCurrentEditMode)() === "edit";
|
|
3330
3333
|
}
|
|
3331
3334
|
handleRenderInlineEditor = () => {
|
|
3332
3335
|
if (this.isEditingModeActive() || !this.isInlineEditingEligible()) {
|
|
@@ -3382,7 +3385,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3382
3385
|
return INLINE_EDITING_PROPERTY_PER_TYPE[this.type] ?? "";
|
|
3383
3386
|
}
|
|
3384
3387
|
getInlineEditablePropType() {
|
|
3385
|
-
const propSchema = (0,
|
|
3388
|
+
const propSchema = (0, import_editor_elements9.getElementType)(this.type)?.propsSchema;
|
|
3386
3389
|
const propertyName = this.getInlineEditablePropertyName();
|
|
3387
3390
|
return propSchema?.[propertyName] ?? null;
|
|
3388
3391
|
}
|
|
@@ -3404,7 +3407,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3404
3407
|
content: parsed.content ? import_editor_props5.stringPropTypeUtil.create(parsed.content) : null,
|
|
3405
3408
|
children: parsed.children
|
|
3406
3409
|
});
|
|
3407
|
-
(0,
|
|
3410
|
+
(0, import_editor_v1_adapters13.undoable)(
|
|
3408
3411
|
{
|
|
3409
3412
|
do: () => {
|
|
3410
3413
|
const prevValue = this.getInlineEditablePropValue();
|
|
@@ -3416,7 +3419,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3416
3419
|
}
|
|
3417
3420
|
},
|
|
3418
3421
|
{
|
|
3419
|
-
title: (0,
|
|
3422
|
+
title: (0, import_editor_elements9.getElementLabel)(this.id),
|
|
3420
3423
|
// translators: %s is the name of the property that was edited.
|
|
3421
3424
|
subtitle: (0, import_i18n3.__)("%s edited", "elementor").replace(
|
|
3422
3425
|
"%s",
|
|
@@ -3446,17 +3449,17 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3446
3449
|
return null;
|
|
3447
3450
|
}
|
|
3448
3451
|
runCommand(key, value) {
|
|
3449
|
-
(0,
|
|
3452
|
+
(0, import_editor_v1_adapters13.__privateRunCommandSync)(
|
|
3450
3453
|
"document/elements/set-settings",
|
|
3451
3454
|
{
|
|
3452
|
-
container: (0,
|
|
3455
|
+
container: (0, import_editor_elements9.getContainer)(this.id),
|
|
3453
3456
|
settings: {
|
|
3454
3457
|
[key]: value
|
|
3455
3458
|
}
|
|
3456
3459
|
},
|
|
3457
3460
|
{ internal: true }
|
|
3458
3461
|
);
|
|
3459
|
-
(0,
|
|
3462
|
+
(0, import_editor_v1_adapters13.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
|
|
3460
3463
|
}
|
|
3461
3464
|
getExpectedTag() {
|
|
3462
3465
|
const tagPropType = this.getTagPropType();
|
|
@@ -3464,7 +3467,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3464
3467
|
return import_editor_props5.stringPropTypeUtil.extract(this.getSetting(tagSettingKey) ?? null) ?? import_editor_props5.stringPropTypeUtil.extract(tagPropType?.default ?? null) ?? null;
|
|
3465
3468
|
}
|
|
3466
3469
|
getTagPropType() {
|
|
3467
|
-
const propsSchema = (0,
|
|
3470
|
+
const propsSchema = (0, import_editor_elements9.getElementType)(this.type)?.propsSchema;
|
|
3468
3471
|
if (!propsSchema?.tag) {
|
|
3469
3472
|
return null;
|
|
3470
3473
|
}
|
|
@@ -3623,8 +3626,8 @@ function registerElementType(type, elementTypeGenerator) {
|
|
|
3623
3626
|
elementsLegacyTypes[type] = elementTypeGenerator;
|
|
3624
3627
|
}
|
|
3625
3628
|
function initLegacyViews() {
|
|
3626
|
-
(0,
|
|
3627
|
-
const widgetsCache = (0,
|
|
3629
|
+
(0, import_editor_v1_adapters14.__privateListenTo)((0, import_editor_v1_adapters14.v1ReadyEvent)(), () => {
|
|
3630
|
+
const widgetsCache = (0, import_editor_elements10.getWidgetsCache)() ?? {};
|
|
3628
3631
|
const legacyWindow = window;
|
|
3629
3632
|
const renderer = createDomRenderer();
|
|
3630
3633
|
registerProPromotionTypes(widgetsCache);
|
|
@@ -3711,7 +3714,7 @@ function initTabsModelExtensions() {
|
|
|
3711
3714
|
}
|
|
3712
3715
|
|
|
3713
3716
|
// src/mcp/resources/available-widgets-resource.ts
|
|
3714
|
-
var
|
|
3717
|
+
var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
|
|
3715
3718
|
var AVAILABLE_WIDGETS_URI = "elementor://context/available-widgets";
|
|
3716
3719
|
var AVAILABLE_WIDGETS_URI_V4 = "elementor://context/available-widgets/v4";
|
|
3717
3720
|
var initAvailableWidgetsResource = (reg) => {
|
|
@@ -3754,7 +3757,7 @@ var initAvailableWidgetsResource = (reg) => {
|
|
|
3754
3757
|
},
|
|
3755
3758
|
async () => buildContents(AVAILABLE_WIDGETS_URI)
|
|
3756
3759
|
);
|
|
3757
|
-
const eventName = (0,
|
|
3760
|
+
const eventName = (0, import_editor_v1_adapters15.v1ReadyEvent)().name;
|
|
3758
3761
|
const onV1Ready = () => {
|
|
3759
3762
|
const widgets = getAvailableWidgets();
|
|
3760
3763
|
if (widgets.length === 0) {
|
|
@@ -3768,8 +3771,8 @@ var initAvailableWidgetsResource = (reg) => {
|
|
|
3768
3771
|
};
|
|
3769
3772
|
|
|
3770
3773
|
// src/mcp/resources/document-structure-resource.ts
|
|
3771
|
-
var
|
|
3772
|
-
var
|
|
3774
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3775
|
+
var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
|
|
3773
3776
|
var DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
|
|
3774
3777
|
var initDocumentStructureResource = (reg) => {
|
|
3775
3778
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -3782,15 +3785,15 @@ var initDocumentStructureResource = (reg) => {
|
|
|
3782
3785
|
sendResourceUpdated({ uri: DOCUMENT_STRUCTURE_URI });
|
|
3783
3786
|
}
|
|
3784
3787
|
};
|
|
3785
|
-
(0,
|
|
3788
|
+
(0, import_editor_v1_adapters16.__privateListenTo)(
|
|
3786
3789
|
[
|
|
3787
|
-
(0,
|
|
3788
|
-
(0,
|
|
3789
|
-
(0,
|
|
3790
|
-
(0,
|
|
3791
|
-
(0,
|
|
3792
|
-
(0,
|
|
3793
|
-
(0,
|
|
3790
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("document/elements/create"),
|
|
3791
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("document/elements/delete"),
|
|
3792
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("document/elements/move"),
|
|
3793
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("document/elements/copy"),
|
|
3794
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("document/elements/paste"),
|
|
3795
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("editor/documents/attach-preview"),
|
|
3796
|
+
(0, import_editor_v1_adapters16.commandEndEvent)("editor/documents/switch")
|
|
3794
3797
|
],
|
|
3795
3798
|
updateDocumentStructure
|
|
3796
3799
|
);
|
|
@@ -3833,7 +3836,7 @@ function resolveElementVersion(element) {
|
|
|
3833
3836
|
return "v4";
|
|
3834
3837
|
}
|
|
3835
3838
|
const widgetType = element.model?.attributes?.widgetType;
|
|
3836
|
-
if (widgetType && (0,
|
|
3839
|
+
if (widgetType && (0, import_editor_elements11.getWidgetsCache)()?.[widgetType]?.atomic_props_schema) {
|
|
3837
3840
|
return "v4";
|
|
3838
3841
|
}
|
|
3839
3842
|
return "v3";
|
|
@@ -3860,7 +3863,7 @@ function extractElementData(element) {
|
|
|
3860
3863
|
}
|
|
3861
3864
|
|
|
3862
3865
|
// src/mcp/resources/editor-state-resource.ts
|
|
3863
|
-
var
|
|
3866
|
+
var import_editor_v1_adapters17 = require("@elementor/editor-v1-adapters");
|
|
3864
3867
|
var CURRENTLY_VIEWED_SCREEN = "The user is currently viewing the Elementor editor";
|
|
3865
3868
|
var PAGE_CONTENT_CHARACTER_LIMIT = 500;
|
|
3866
3869
|
var PREVIEW_TEXT_NODE_MIN_LENGTH = 2;
|
|
@@ -3881,8 +3884,8 @@ var initEditorStateResource = (reg) => {
|
|
|
3881
3884
|
lastSerializedState = serialized;
|
|
3882
3885
|
sendResourceUpdated({ uri: EDITOR_STATE_URI });
|
|
3883
3886
|
};
|
|
3884
|
-
(0,
|
|
3885
|
-
[(0,
|
|
3887
|
+
(0, import_editor_v1_adapters17.__privateListenTo)(
|
|
3888
|
+
[(0, import_editor_v1_adapters17.commandEndEvent)("editor/documents/switch"), (0, import_editor_v1_adapters17.commandEndEvent)("editor/documents/attach-preview")],
|
|
3886
3889
|
notifyIfChanged
|
|
3887
3890
|
);
|
|
3888
3891
|
lastSerializedState = JSON.stringify(buildState());
|
|
@@ -3956,7 +3959,7 @@ function getPageTitle() {
|
|
|
3956
3959
|
}
|
|
3957
3960
|
|
|
3958
3961
|
// src/mcp/resources/general-context-resource.ts
|
|
3959
|
-
var
|
|
3962
|
+
var import_editor_v1_adapters18 = require("@elementor/editor-v1-adapters");
|
|
3960
3963
|
var GENERAL_CONTEXT_URI = "elementor://context/general";
|
|
3961
3964
|
var initGeneralContextResource = (reg) => {
|
|
3962
3965
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -4017,11 +4020,11 @@ var initGeneralContextResource = (reg) => {
|
|
|
4017
4020
|
};
|
|
4018
4021
|
}
|
|
4019
4022
|
);
|
|
4020
|
-
(0,
|
|
4023
|
+
(0, import_editor_v1_adapters18.__privateListenTo)(
|
|
4021
4024
|
[
|
|
4022
|
-
(0,
|
|
4023
|
-
(0,
|
|
4024
|
-
(0,
|
|
4025
|
+
(0, import_editor_v1_adapters18.commandEndEvent)("editor/documents/switch"),
|
|
4026
|
+
(0, import_editor_v1_adapters18.commandEndEvent)("editor/documents/attach-preview"),
|
|
4027
|
+
(0, import_editor_v1_adapters18.commandEndEvent)("document/elements/settings")
|
|
4025
4028
|
],
|
|
4026
4029
|
pushUpdateIfChanged
|
|
4027
4030
|
);
|
|
@@ -4029,8 +4032,8 @@ var initGeneralContextResource = (reg) => {
|
|
|
4029
4032
|
};
|
|
4030
4033
|
|
|
4031
4034
|
// src/mcp/resources/selected-element-resource.ts
|
|
4032
|
-
var
|
|
4033
|
-
var
|
|
4035
|
+
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
4036
|
+
var import_editor_v1_adapters19 = require("@elementor/editor-v1-adapters");
|
|
4034
4037
|
var SELECTED_ELEMENT_URI = "elementor://context/selected-element";
|
|
4035
4038
|
var initSelectedElementResource = (reg) => {
|
|
4036
4039
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -4061,11 +4064,11 @@ var initSelectedElementResource = (reg) => {
|
|
|
4061
4064
|
}
|
|
4062
4065
|
publishIfChanged(readSelectionFromEditor());
|
|
4063
4066
|
};
|
|
4064
|
-
(0,
|
|
4067
|
+
(0, import_editor_v1_adapters19.__privateListenTo)(
|
|
4065
4068
|
[
|
|
4066
|
-
(0,
|
|
4067
|
-
(0,
|
|
4068
|
-
(0,
|
|
4069
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/select"),
|
|
4070
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/deselect-all"),
|
|
4071
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/settings")
|
|
4069
4072
|
],
|
|
4070
4073
|
onCommand
|
|
4071
4074
|
);
|
|
@@ -4100,11 +4103,11 @@ function createEmptySelectedElementPayload() {
|
|
|
4100
4103
|
};
|
|
4101
4104
|
}
|
|
4102
4105
|
function readSelectionFromEditor() {
|
|
4103
|
-
const elements = (0,
|
|
4106
|
+
const elements = (0, import_editor_elements12.getSelectedElements)();
|
|
4104
4107
|
if (elements.length !== 1) {
|
|
4105
4108
|
return createEmptySelectedElementPayload();
|
|
4106
4109
|
}
|
|
4107
|
-
const container = (0,
|
|
4110
|
+
const container = (0, import_editor_elements12.getContainer)(elements[0].id);
|
|
4108
4111
|
return buildPayloadFromContainer(container);
|
|
4109
4112
|
}
|
|
4110
4113
|
function buildPayloadFromContainer(container) {
|
|
@@ -4127,7 +4130,7 @@ function resolveElementVersion2(container, widgetType) {
|
|
|
4127
4130
|
if (container.model?.config?.atomic) {
|
|
4128
4131
|
return "v4";
|
|
4129
4132
|
}
|
|
4130
|
-
if (widgetType && (0,
|
|
4133
|
+
if (widgetType && (0, import_editor_elements12.getWidgetsCache)()?.[widgetType]?.atomic_props_schema) {
|
|
4131
4134
|
return "v4";
|
|
4132
4135
|
}
|
|
4133
4136
|
return "v3";
|
|
@@ -4137,7 +4140,7 @@ function getElementProperties(container, widgetType) {
|
|
|
4137
4140
|
if (!settings || typeof settings !== "object") {
|
|
4138
4141
|
return null;
|
|
4139
4142
|
}
|
|
4140
|
-
const widgetConfig = widgetType ? (0,
|
|
4143
|
+
const widgetConfig = widgetType ? (0, import_editor_elements12.getWidgetsCache)()?.[widgetType] : null;
|
|
4141
4144
|
const controls = widgetConfig?.controls;
|
|
4142
4145
|
const filtered = {};
|
|
4143
4146
|
for (const [key, value] of Object.entries(settings)) {
|
|
@@ -4176,16 +4179,16 @@ function getElementDisplayName(container) {
|
|
|
4176
4179
|
|
|
4177
4180
|
// src/mcp/tools/build-composition/tool.ts
|
|
4178
4181
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
4179
|
-
var
|
|
4182
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
4180
4183
|
|
|
4181
4184
|
// src/composition-builder/composition-builder.ts
|
|
4182
|
-
var
|
|
4185
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
4183
4186
|
|
|
4184
4187
|
// src/mcp/utils/do-update-element-property.ts
|
|
4185
|
-
var
|
|
4188
|
+
var import_editor_elements13 = require("@elementor/editor-elements");
|
|
4186
4189
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
4187
4190
|
var import_editor_styles5 = require("@elementor/editor-styles");
|
|
4188
|
-
var
|
|
4191
|
+
var import_editor_v1_adapters20 = require("@elementor/editor-v1-adapters");
|
|
4189
4192
|
function resolvePropValue(value, forceKey) {
|
|
4190
4193
|
const Utils = window.elementorV2.editorVariables.Utils;
|
|
4191
4194
|
return import_editor_props7.Schema.adjustLlmPropValueSchema(value, {
|
|
@@ -4196,7 +4199,7 @@ function resolvePropValue(value, forceKey) {
|
|
|
4196
4199
|
var doUpdateElementProperty = (params) => {
|
|
4197
4200
|
const { elementId, propertyName, propertyValue, elementType } = params;
|
|
4198
4201
|
if (propertyName === "_styles") {
|
|
4199
|
-
const elementStyles = (0,
|
|
4202
|
+
const elementStyles = (0, import_editor_elements13.getElementStyles)(elementId) || {};
|
|
4200
4203
|
const propertyMapValue = propertyValue;
|
|
4201
4204
|
const styleSchema = (0, import_editor_styles5.getStylesSchema)();
|
|
4202
4205
|
const transformedStyleValues = Object.fromEntries(
|
|
@@ -4244,7 +4247,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4244
4247
|
delete transformedStyleValues.custom_css;
|
|
4245
4248
|
const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
|
|
4246
4249
|
if (!localStyle) {
|
|
4247
|
-
(0,
|
|
4250
|
+
(0, import_editor_elements13.createElementStyle)({
|
|
4248
4251
|
elementId,
|
|
4249
4252
|
...typeof customCss !== "undefined" ? { custom_css: customCss } : {},
|
|
4250
4253
|
classesProp: "classes",
|
|
@@ -4258,7 +4261,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4258
4261
|
}
|
|
4259
4262
|
});
|
|
4260
4263
|
} else {
|
|
4261
|
-
(0,
|
|
4264
|
+
(0, import_editor_elements13.updateElementStyle)({
|
|
4262
4265
|
elementId,
|
|
4263
4266
|
styleId: localStyle.id,
|
|
4264
4267
|
meta: {
|
|
@@ -4273,7 +4276,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4273
4276
|
}
|
|
4274
4277
|
return;
|
|
4275
4278
|
}
|
|
4276
|
-
const elementPropSchema = (0,
|
|
4279
|
+
const elementPropSchema = (0, import_editor_elements13.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
4277
4280
|
if (!elementPropSchema) {
|
|
4278
4281
|
throw new Error(`No prop schema found for element type: ${elementType}`);
|
|
4279
4282
|
}
|
|
@@ -4296,18 +4299,18 @@ var doUpdateElementProperty = (params) => {
|
|
|
4296
4299
|
Expected Schema: ${jsonSchema}`
|
|
4297
4300
|
);
|
|
4298
4301
|
}
|
|
4299
|
-
(0,
|
|
4302
|
+
(0, import_editor_elements13.updateElementSettings)({
|
|
4300
4303
|
id: elementId,
|
|
4301
4304
|
props: {
|
|
4302
4305
|
[propertyName]: value
|
|
4303
4306
|
},
|
|
4304
4307
|
withHistory: false
|
|
4305
4308
|
});
|
|
4306
|
-
(0,
|
|
4309
|
+
(0, import_editor_v1_adapters20.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
|
|
4307
4310
|
};
|
|
4308
4311
|
|
|
4309
4312
|
// src/mcp/utils/validate-input.ts
|
|
4310
|
-
var
|
|
4313
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
4311
4314
|
var import_editor_props8 = require("@elementor/editor-props");
|
|
4312
4315
|
var import_editor_styles6 = require("@elementor/editor-styles");
|
|
4313
4316
|
var _widgetsSchema = null;
|
|
@@ -4315,7 +4318,7 @@ var validateInput = {
|
|
|
4315
4318
|
get widgetsSchema() {
|
|
4316
4319
|
if (!_widgetsSchema) {
|
|
4317
4320
|
const schema2 = {};
|
|
4318
|
-
const cache = (0,
|
|
4321
|
+
const cache = (0, import_editor_elements14.getWidgetsCache)();
|
|
4319
4322
|
if (!cache) {
|
|
4320
4323
|
return {};
|
|
4321
4324
|
}
|
|
@@ -4439,11 +4442,11 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4439
4442
|
elementCustomCSS = {};
|
|
4440
4443
|
rootContainers = [];
|
|
4441
4444
|
api = {
|
|
4442
|
-
createElement:
|
|
4443
|
-
deleteElement:
|
|
4444
|
-
getWidgetsCache:
|
|
4445
|
-
generateElementId:
|
|
4446
|
-
getContainer:
|
|
4445
|
+
createElement: import_editor_elements15.createElement,
|
|
4446
|
+
deleteElement: import_editor_elements15.deleteElement,
|
|
4447
|
+
getWidgetsCache: import_editor_elements15.getWidgetsCache,
|
|
4448
|
+
generateElementId: import_editor_elements15.generateElementId,
|
|
4449
|
+
getContainer: import_editor_elements15.getContainer,
|
|
4447
4450
|
doUpdateElementProperty
|
|
4448
4451
|
};
|
|
4449
4452
|
xml;
|
|
@@ -4956,19 +4959,19 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
4956
4959
|
assertCompositionXmlUsesV4WidgetsOnly(rawParams.xmlStructure);
|
|
4957
4960
|
const { xmlStructure, elementConfig, stylesConfig, customCSS } = adaptLeafRootParams({
|
|
4958
4961
|
...rawParams,
|
|
4959
|
-
widgetsCache: (0,
|
|
4962
|
+
widgetsCache: (0, import_editor_elements16.getWidgetsCache)() ?? {}
|
|
4960
4963
|
});
|
|
4961
4964
|
let generatedXML = "";
|
|
4962
4965
|
const errors = [];
|
|
4963
4966
|
const rootContainers = [];
|
|
4964
|
-
const documentContainer = (0,
|
|
4967
|
+
const documentContainer = (0, import_editor_elements16.getContainer)("document");
|
|
4965
4968
|
const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
|
|
4966
4969
|
const targetContainer = getCompositionTargetContainer(documentContainer, currentDocument?.type.value);
|
|
4967
4970
|
try {
|
|
4968
4971
|
const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
|
|
4969
|
-
createElement:
|
|
4970
|
-
deleteElement:
|
|
4971
|
-
getWidgetsCache:
|
|
4972
|
+
createElement: import_editor_elements16.createElement,
|
|
4973
|
+
deleteElement: import_editor_elements16.deleteElement,
|
|
4974
|
+
getWidgetsCache: import_editor_elements16.getWidgetsCache
|
|
4972
4975
|
});
|
|
4973
4976
|
compositionBuilder.setElementConfig(elementConfig);
|
|
4974
4977
|
compositionBuilder.setStylesConfig(stylesConfig);
|
|
@@ -5004,7 +5007,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
5004
5007
|
}
|
|
5005
5008
|
if (errors.length) {
|
|
5006
5009
|
rootContainers.forEach((rootContainer) => {
|
|
5007
|
-
(0,
|
|
5010
|
+
(0, import_editor_elements16.deleteElement)({
|
|
5008
5011
|
container: rootContainer,
|
|
5009
5012
|
options: { useHistory: false }
|
|
5010
5013
|
});
|
|
@@ -5058,7 +5061,7 @@ function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
|
|
|
5058
5061
|
if (doc.querySelector("parsererror")) {
|
|
5059
5062
|
throw new Error("Failed to parse XML string: " + doc);
|
|
5060
5063
|
}
|
|
5061
|
-
const widgetsCache = (0,
|
|
5064
|
+
const widgetsCache = (0, import_editor_elements16.getWidgetsCache)() ?? {};
|
|
5062
5065
|
for (const node of doc.querySelectorAll("*")) {
|
|
5063
5066
|
const type = node.tagName;
|
|
5064
5067
|
const widgetData = widgetsCache[type];
|
|
@@ -5075,7 +5078,7 @@ function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
|
|
|
5075
5078
|
}
|
|
5076
5079
|
|
|
5077
5080
|
// src/mcp/tools/configure-element/tool.ts
|
|
5078
|
-
var
|
|
5081
|
+
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
5079
5082
|
|
|
5080
5083
|
// src/mcp/tools/configure-element/prompt.ts
|
|
5081
5084
|
var import_editor_mcp3 = require("@elementor/editor-mcp");
|
|
@@ -5244,7 +5247,7 @@ var initConfigureElementTool = (reg) => {
|
|
|
5244
5247
|
{ description: "Configure element guide", uri: CONFIGURE_ELEMENT_GUIDE_URI }
|
|
5245
5248
|
],
|
|
5246
5249
|
handler: ({ elementId, propertiesToChange, elementType, stylePropertiesToChange }) => {
|
|
5247
|
-
const widgetData = (0,
|
|
5250
|
+
const widgetData = (0, import_editor_elements17.getWidgetsCache)()?.[elementType];
|
|
5248
5251
|
if (!widgetData) {
|
|
5249
5252
|
throw new Error(
|
|
5250
5253
|
`Unknown element type: ${elementType}. Check the available-widgets resource for valid types.`
|
|
@@ -5336,7 +5339,7 @@ Check the styles schema at the resource [${STYLE_SCHEMA_URI.replace(
|
|
|
5336
5339
|
}
|
|
5337
5340
|
|
|
5338
5341
|
// src/mcp/tools/get-element-config/tool.ts
|
|
5339
|
-
var
|
|
5342
|
+
var import_editor_elements18 = require("@elementor/editor-elements");
|
|
5340
5343
|
var import_editor_props9 = require("@elementor/editor-props");
|
|
5341
5344
|
var import_schema5 = require("@elementor/schema");
|
|
5342
5345
|
var schema = {
|
|
@@ -5371,12 +5374,12 @@ var initGetElementConfigTool = (reg) => {
|
|
|
5371
5374
|
schema,
|
|
5372
5375
|
outputSchema: outputSchema3,
|
|
5373
5376
|
handler: async ({ elementId }) => {
|
|
5374
|
-
const element = (0,
|
|
5377
|
+
const element = (0, import_editor_elements18.getContainer)(elementId);
|
|
5375
5378
|
if (!element) {
|
|
5376
5379
|
throw new Error(`Element with ID ${elementId} not found.`);
|
|
5377
5380
|
}
|
|
5378
5381
|
const elementType = element.model.get("widgetType") || element.model.get("elType") || "";
|
|
5379
|
-
const widgetData = (0,
|
|
5382
|
+
const widgetData = (0, import_editor_elements18.getWidgetsCache)()?.[elementType];
|
|
5380
5383
|
if (!widgetData) {
|
|
5381
5384
|
throw new Error(
|
|
5382
5385
|
`Unknown element type: ${elementType}. Check the available-widgets resource for valid types.`
|
|
@@ -5388,7 +5391,7 @@ var initGetElementConfigTool = (reg) => {
|
|
|
5388
5391
|
);
|
|
5389
5392
|
}
|
|
5390
5393
|
const elementRawSettings = element.settings;
|
|
5391
|
-
const propSchema = (0,
|
|
5394
|
+
const propSchema = (0, import_editor_elements18.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
5392
5395
|
if (!elementRawSettings || !propSchema) {
|
|
5393
5396
|
throw new Error(`No settings or prop schema found for element ID: ${elementId}`);
|
|
5394
5397
|
}
|
|
@@ -5397,7 +5400,7 @@ var initGetElementConfigTool = (reg) => {
|
|
|
5397
5400
|
import_editor_props9.Schema.configurableKeys(propSchema).forEach((key) => {
|
|
5398
5401
|
propValues[key] = structuredClone(elementRawSettings.get(key));
|
|
5399
5402
|
});
|
|
5400
|
-
const elementStyles = (0,
|
|
5403
|
+
const elementStyles = (0, import_editor_elements18.getElementStyles)(elementId) || {};
|
|
5401
5404
|
const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
|
|
5402
5405
|
if (localStyle) {
|
|
5403
5406
|
const defaultVariant = localStyle.variants.find(
|
|
@@ -5555,16 +5558,16 @@ Note: The "size" property controls image resolution/loading, not visual size. Se
|
|
|
5555
5558
|
`;
|
|
5556
5559
|
|
|
5557
5560
|
// src/prevent-link-in-link-commands.ts
|
|
5558
|
-
var
|
|
5561
|
+
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
5559
5562
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
5560
|
-
var
|
|
5563
|
+
var import_editor_v1_adapters21 = require("@elementor/editor-v1-adapters");
|
|
5561
5564
|
var import_i18n4 = require("@wordpress/i18n");
|
|
5562
5565
|
function initLinkInLinkPrevention() {
|
|
5563
|
-
(0,
|
|
5566
|
+
(0, import_editor_v1_adapters21.blockCommand)({
|
|
5564
5567
|
command: "document/elements/paste",
|
|
5565
5568
|
condition: blockLinkInLinkPaste
|
|
5566
5569
|
});
|
|
5567
|
-
(0,
|
|
5570
|
+
(0, import_editor_v1_adapters21.blockCommand)({
|
|
5568
5571
|
command: "document/elements/move",
|
|
5569
5572
|
condition: blockLinkInLinkMove
|
|
5570
5573
|
});
|
|
@@ -5626,24 +5629,24 @@ function shouldBlock(sourceElements, targetElements) {
|
|
|
5626
5629
|
return false;
|
|
5627
5630
|
}
|
|
5628
5631
|
const isSourceContainsAnAnchor = sourceElements.some((src) => {
|
|
5629
|
-
return src?.id ? (0,
|
|
5632
|
+
return src?.id ? (0, import_editor_elements19.isElementAnchored)(src.id) || !!(0, import_editor_elements19.getAnchoredDescendantId)(src.id) : false;
|
|
5630
5633
|
});
|
|
5631
5634
|
if (!isSourceContainsAnAnchor) {
|
|
5632
5635
|
return false;
|
|
5633
5636
|
}
|
|
5634
5637
|
const isTargetContainsAnAnchor = targetElements.some((target) => {
|
|
5635
|
-
return target?.id ? (0,
|
|
5638
|
+
return target?.id ? (0, import_editor_elements19.isElementAnchored)(target.id) || !!(0, import_editor_elements19.getAnchoredAncestorId)(target.id) : false;
|
|
5636
5639
|
});
|
|
5637
5640
|
return isTargetContainsAnAnchor;
|
|
5638
5641
|
}
|
|
5639
5642
|
|
|
5640
5643
|
// src/style-commands/paste-style.ts
|
|
5641
|
-
var
|
|
5644
|
+
var import_editor_elements22 = require("@elementor/editor-elements");
|
|
5642
5645
|
var import_editor_props11 = require("@elementor/editor-props");
|
|
5643
|
-
var
|
|
5646
|
+
var import_editor_v1_adapters23 = require("@elementor/editor-v1-adapters");
|
|
5644
5647
|
|
|
5645
5648
|
// src/utils/command-utils.ts
|
|
5646
|
-
var
|
|
5649
|
+
var import_editor_elements20 = require("@elementor/editor-elements");
|
|
5647
5650
|
var import_editor_props10 = require("@elementor/editor-props");
|
|
5648
5651
|
var import_i18n5 = require("@wordpress/i18n");
|
|
5649
5652
|
function hasAtomicWidgets(args) {
|
|
@@ -5668,7 +5671,7 @@ function getClassesProp(container) {
|
|
|
5668
5671
|
}
|
|
5669
5672
|
function getContainerSchema(container) {
|
|
5670
5673
|
const type = container?.model.get("widgetType") || container?.model.get("elType");
|
|
5671
|
-
const widgetsCache = (0,
|
|
5674
|
+
const widgetsCache = (0, import_editor_elements20.getWidgetsCache)();
|
|
5672
5675
|
const elementType = widgetsCache?.[type];
|
|
5673
5676
|
return elementType?.atomic_props_schema ?? null;
|
|
5674
5677
|
}
|
|
@@ -5681,15 +5684,15 @@ function getClipboardElements(storageKey = "clipboard") {
|
|
|
5681
5684
|
}
|
|
5682
5685
|
}
|
|
5683
5686
|
function getTitleForContainers(containers) {
|
|
5684
|
-
return containers.length > 1 ? (0, import_i18n5.__)("Elements", "elementor") : (0,
|
|
5687
|
+
return containers.length > 1 ? (0, import_i18n5.__)("Elements", "elementor") : (0, import_editor_elements20.getElementLabel)(containers[0].id);
|
|
5685
5688
|
}
|
|
5686
5689
|
|
|
5687
5690
|
// src/style-commands/undoable-actions/paste-element-style.ts
|
|
5688
|
-
var
|
|
5691
|
+
var import_editor_elements21 = require("@elementor/editor-elements");
|
|
5689
5692
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
5690
|
-
var
|
|
5693
|
+
var import_editor_v1_adapters22 = require("@elementor/editor-v1-adapters");
|
|
5691
5694
|
var import_i18n6 = require("@wordpress/i18n");
|
|
5692
|
-
var undoablePasteElementStyle = () => (0,
|
|
5695
|
+
var undoablePasteElementStyle = () => (0, import_editor_v1_adapters22.undoable)(
|
|
5693
5696
|
{
|
|
5694
5697
|
do: ({ containers, newStyle }) => {
|
|
5695
5698
|
return containers.map((container) => {
|
|
@@ -5698,7 +5701,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5698
5701
|
if (!classesProp) {
|
|
5699
5702
|
return null;
|
|
5700
5703
|
}
|
|
5701
|
-
const originalStyles = (0,
|
|
5704
|
+
const originalStyles = (0, import_editor_elements21.getElementStyles)(container.id);
|
|
5702
5705
|
const [styleId, styleDef] = Object.entries(originalStyles ?? {})[0] ?? [];
|
|
5703
5706
|
const originalStyle = Object.keys(styleDef ?? {}).length ? styleDef : null;
|
|
5704
5707
|
const revertData = {
|
|
@@ -5707,7 +5710,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5707
5710
|
};
|
|
5708
5711
|
if (styleId) {
|
|
5709
5712
|
newStyle.variants.forEach(({ meta, props, custom_css: customCss }) => {
|
|
5710
|
-
(0,
|
|
5713
|
+
(0, import_editor_elements21.updateElementStyle)({
|
|
5711
5714
|
elementId,
|
|
5712
5715
|
styleId,
|
|
5713
5716
|
meta,
|
|
@@ -5718,7 +5721,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5718
5721
|
} else {
|
|
5719
5722
|
const [firstVariant] = newStyle.variants;
|
|
5720
5723
|
const additionalVariants = newStyle.variants.slice(1);
|
|
5721
|
-
revertData.styleId = (0,
|
|
5724
|
+
revertData.styleId = (0, import_editor_elements21.createElementStyle)({
|
|
5722
5725
|
elementId,
|
|
5723
5726
|
classesProp,
|
|
5724
5727
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -5736,7 +5739,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5736
5739
|
return;
|
|
5737
5740
|
}
|
|
5738
5741
|
if (!revertData.originalStyle) {
|
|
5739
|
-
(0,
|
|
5742
|
+
(0, import_editor_elements21.deleteElementStyle)(container.id, revertData.styleId);
|
|
5740
5743
|
return;
|
|
5741
5744
|
}
|
|
5742
5745
|
const classesProp = getClassesProp(container);
|
|
@@ -5745,7 +5748,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5745
5748
|
}
|
|
5746
5749
|
const [firstVariant] = revertData.originalStyle.variants;
|
|
5747
5750
|
const additionalVariants = revertData.originalStyle.variants.slice(1);
|
|
5748
|
-
(0,
|
|
5751
|
+
(0, import_editor_elements21.createElementStyle)({
|
|
5749
5752
|
elementId: container.id,
|
|
5750
5753
|
classesProp,
|
|
5751
5754
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -5765,12 +5768,12 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters21.undoable)(
|
|
|
5765
5768
|
// src/style-commands/paste-style.ts
|
|
5766
5769
|
function initPasteStyleCommand() {
|
|
5767
5770
|
const pasteElementStyleCommand = undoablePasteElementStyle();
|
|
5768
|
-
(0,
|
|
5771
|
+
(0, import_editor_v1_adapters23.blockCommand)({
|
|
5769
5772
|
command: "document/elements/paste-style",
|
|
5770
5773
|
condition: hasAtomicWidgets
|
|
5771
5774
|
});
|
|
5772
|
-
(0,
|
|
5773
|
-
(0,
|
|
5775
|
+
(0, import_editor_v1_adapters23.__privateListenTo)(
|
|
5776
|
+
(0, import_editor_v1_adapters23.commandStartEvent)("document/elements/paste-style"),
|
|
5774
5777
|
(e) => pasteStyles(e.args, pasteElementStyleCommand)
|
|
5775
5778
|
);
|
|
5776
5779
|
}
|
|
@@ -5782,7 +5785,7 @@ function pasteStyles(args, pasteLocalStyle) {
|
|
|
5782
5785
|
}
|
|
5783
5786
|
const clipboardElements = getClipboardElements(storageKey);
|
|
5784
5787
|
const [clipboardElement] = clipboardElements ?? [];
|
|
5785
|
-
const clipboardContainer = (0,
|
|
5788
|
+
const clipboardContainer = (0, import_editor_elements22.getContainer)(clipboardElement.id);
|
|
5786
5789
|
if (!clipboardElement || !clipboardContainer || !isAtomicWidget(clipboardContainer)) {
|
|
5787
5790
|
return;
|
|
5788
5791
|
}
|
|
@@ -5801,7 +5804,7 @@ function getClassesWithoutLocalStyle(clipboardContainer, style) {
|
|
|
5801
5804
|
if (!classesProp) {
|
|
5802
5805
|
return [];
|
|
5803
5806
|
}
|
|
5804
|
-
const classesSetting = (0,
|
|
5807
|
+
const classesSetting = (0, import_editor_elements22.getElementSetting)(clipboardContainer.id, classesProp);
|
|
5805
5808
|
return classesSetting?.value.filter((styleId) => styleId !== style?.id) ?? [];
|
|
5806
5809
|
}
|
|
5807
5810
|
function pasteClasses(containers, classes) {
|
|
@@ -5810,10 +5813,10 @@ function pasteClasses(containers, classes) {
|
|
|
5810
5813
|
if (!classesProp) {
|
|
5811
5814
|
return;
|
|
5812
5815
|
}
|
|
5813
|
-
const classesSetting = (0,
|
|
5816
|
+
const classesSetting = (0, import_editor_elements22.getElementSetting)(container.id, classesProp);
|
|
5814
5817
|
const currentClasses = import_editor_props11.classesPropTypeUtil.extract(classesSetting) ?? [];
|
|
5815
5818
|
const newClasses = import_editor_props11.classesPropTypeUtil.create(Array.from(/* @__PURE__ */ new Set([...classes, ...currentClasses])));
|
|
5816
|
-
(0,
|
|
5819
|
+
(0, import_editor_elements22.updateElementSettings)({
|
|
5817
5820
|
id: container.id,
|
|
5818
5821
|
props: { [classesProp]: newClasses }
|
|
5819
5822
|
});
|
|
@@ -5821,21 +5824,21 @@ function pasteClasses(containers, classes) {
|
|
|
5821
5824
|
}
|
|
5822
5825
|
|
|
5823
5826
|
// src/style-commands/reset-style.ts
|
|
5824
|
-
var
|
|
5827
|
+
var import_editor_v1_adapters25 = require("@elementor/editor-v1-adapters");
|
|
5825
5828
|
|
|
5826
5829
|
// src/style-commands/undoable-actions/reset-element-style.ts
|
|
5827
|
-
var
|
|
5830
|
+
var import_editor_elements23 = require("@elementor/editor-elements");
|
|
5828
5831
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
5829
|
-
var
|
|
5832
|
+
var import_editor_v1_adapters24 = require("@elementor/editor-v1-adapters");
|
|
5830
5833
|
var import_i18n7 = require("@wordpress/i18n");
|
|
5831
|
-
var undoableResetElementStyle = () => (0,
|
|
5834
|
+
var undoableResetElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
5832
5835
|
{
|
|
5833
5836
|
do: ({ containers }) => {
|
|
5834
5837
|
return containers.map((container) => {
|
|
5835
5838
|
const elementId = container.model.get("id");
|
|
5836
|
-
const containerStyles = (0,
|
|
5839
|
+
const containerStyles = (0, import_editor_elements23.getElementStyles)(elementId);
|
|
5837
5840
|
Object.keys(containerStyles ?? {}).forEach(
|
|
5838
|
-
(styleId) => (0,
|
|
5841
|
+
(styleId) => (0, import_editor_elements23.deleteElementStyle)(elementId, styleId)
|
|
5839
5842
|
);
|
|
5840
5843
|
return containerStyles;
|
|
5841
5844
|
});
|
|
@@ -5851,7 +5854,7 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters23.undoable)(
|
|
|
5851
5854
|
Object.entries(containerStyles ?? {}).forEach(([styleId, style]) => {
|
|
5852
5855
|
const [firstVariant] = style.variants;
|
|
5853
5856
|
const additionalVariants = style.variants.slice(1);
|
|
5854
|
-
(0,
|
|
5857
|
+
(0, import_editor_elements23.createElementStyle)({
|
|
5855
5858
|
elementId,
|
|
5856
5859
|
classesProp,
|
|
5857
5860
|
styleId,
|
|
@@ -5872,12 +5875,12 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters23.undoable)(
|
|
|
5872
5875
|
// src/style-commands/reset-style.ts
|
|
5873
5876
|
function initResetStyleCommand() {
|
|
5874
5877
|
const resetElementStyles = undoableResetElementStyle();
|
|
5875
|
-
(0,
|
|
5878
|
+
(0, import_editor_v1_adapters25.blockCommand)({
|
|
5876
5879
|
command: "document/elements/reset-style",
|
|
5877
5880
|
condition: hasAtomicWidgets
|
|
5878
5881
|
});
|
|
5879
|
-
(0,
|
|
5880
|
-
(0,
|
|
5882
|
+
(0, import_editor_v1_adapters25.__privateListenTo)(
|
|
5883
|
+
(0, import_editor_v1_adapters25.commandStartEvent)("document/elements/reset-style"),
|
|
5881
5884
|
(e) => resetStyles(e.args, resetElementStyles)
|
|
5882
5885
|
);
|
|
5883
5886
|
}
|
|
@@ -6026,9 +6029,9 @@ function getRectClipPath(rect, viewport) {
|
|
|
6026
6029
|
}
|
|
6027
6030
|
|
|
6028
6031
|
// src/hooks/use-canvas-document.ts
|
|
6029
|
-
var
|
|
6032
|
+
var import_editor_v1_adapters26 = require("@elementor/editor-v1-adapters");
|
|
6030
6033
|
function useCanvasDocument() {
|
|
6031
|
-
return (0,
|
|
6034
|
+
return (0, import_editor_v1_adapters26.__privateUseListenTo)((0, import_editor_v1_adapters26.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters26.getCanvasIframeDocument)());
|
|
6032
6035
|
}
|
|
6033
6036
|
|
|
6034
6037
|
// src/hooks/use-escape-on-canvas.ts
|
|
@@ -6051,10 +6054,10 @@ function useEscapeOnCanvas(canvasDocument, onEscape) {
|
|
|
6051
6054
|
}
|
|
6052
6055
|
|
|
6053
6056
|
// src/utils/after-render.ts
|
|
6054
|
-
var
|
|
6057
|
+
var import_editor_elements24 = require("@elementor/editor-elements");
|
|
6055
6058
|
function doAfterRender(elementIds, callback) {
|
|
6056
6059
|
const pending = elementIds.map((elementId) => {
|
|
6057
|
-
const view = (0,
|
|
6060
|
+
const view = (0, import_editor_elements24.getContainer)(elementId)?.view;
|
|
6058
6061
|
if (!view || !hasDoAfterRender(view)) {
|
|
6059
6062
|
return void 0;
|
|
6060
6063
|
}
|