@xiwebdesign/xicms-core 7.8.0 → 7.9.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/dist/admin/lib/pagesClient.js +5 -1
- package/dist/admin/lib/pagesClient.js.map +1 -1
- package/dist/admin/shop/ProductsTab.js +4 -5
- package/dist/admin/shop/ProductsTab.js.map +1 -1
- package/dist/admin/shop/productClient.d.ts +11 -13
- package/dist/admin/shop/productClient.js +44 -4
- package/dist/admin/shop/productClient.js.map +1 -1
- package/dist/admin/visual/VisualEditor.js +140 -47
- package/dist/admin/visual/VisualEditor.js.map +1 -1
- package/dist/components/EditBar.js +3 -1
- package/dist/components/EditBar.js.map +1 -1
- package/dist/components/barOffset.d.ts +23 -0
- package/dist/components/barOffset.js +37 -0
- package/dist/components/barOffset.js.map +1 -0
- package/dist/demo/demoStore.d.ts +2 -0
- package/dist/demo/demoStore.js +4 -0
- package/dist/demo/demoStore.js.map +1 -1
- package/dist/editor/EditorProvider.d.ts +9 -0
- package/dist/editor/EditorProvider.js +11 -2
- package/dist/editor/EditorProvider.js.map +1 -1
- package/dist/media/ImageContext.d.ts +1 -1
- package/dist/media/ImageContext.js +3 -1
- package/dist/media/ImageContext.js.map +1 -1
- package/dist/render/PublishedPage.js +16 -2
- package/dist/render/PublishedPage.js.map +1 -1
- package/dist/styles.css +26 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ import { StyleEditor } from "../blockEditors/StyleEditor.js";
|
|
|
21
21
|
import { siteLocales, parseLocaleSlugs, localizeBlocks } from "../../i18n/overlay.js";
|
|
22
22
|
import { useEditor } from "../../editor/EditorProvider.js";
|
|
23
23
|
import { AdminModes } from "../../components/EditBar.js";
|
|
24
|
+
import { useBalkOffset } from "../../components/barOffset.js";
|
|
24
25
|
import { aantalWijzigingen, bepaalWijzigingen, GEEN_WIJZIGINGEN } from "./wijzigingen.js";
|
|
25
26
|
import { TranslationPanel } from "./TranslationPanel.js";
|
|
26
27
|
import { PatternInserter } from "../patterns/PatternInserter.js";
|
|
@@ -108,6 +109,7 @@ function VisualEditorInner({ onClose }) {
|
|
|
108
109
|
const canvasRef = useRef(null);
|
|
109
110
|
const [conflict, setConflict] = useState(false);
|
|
110
111
|
const [liveBlocks, setLiveBlocks] = useState(void 0);
|
|
112
|
+
useBalkOffset(true);
|
|
111
113
|
const { vars: themeVars, darkAuto } = useThemeVars();
|
|
112
114
|
const nestedDialogOpen = useNestedDialogOpen();
|
|
113
115
|
const { containerRef, focusFirst } = useFocusTrap({ isActive: !nestedDialogOpen });
|
|
@@ -280,7 +282,13 @@ function VisualEditorInner({ onClose }) {
|
|
|
280
282
|
[blocks, liveBlocks]
|
|
281
283
|
);
|
|
282
284
|
nietLiveRef.current = wijzigingen.iets;
|
|
283
|
-
const { publishDraft } = useEditor();
|
|
285
|
+
const { publishDraft, zetFotoVervanger } = useEditor();
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
zetFotoVervanger((field, blockKey) => {
|
|
288
|
+
if (blockKey) setImgPicker({ key: blockKey, field });
|
|
289
|
+
});
|
|
290
|
+
return () => zetFotoVervanger(null);
|
|
291
|
+
}, [zetFotoVervanger]);
|
|
284
292
|
const laatstGepubliceerd = useRef("");
|
|
285
293
|
useEffect(() => {
|
|
286
294
|
if (!draft) return;
|
|
@@ -363,8 +371,12 @@ function VisualEditorInner({ onClose }) {
|
|
|
363
371
|
setBlokknoppen((v) => v.length === 0 ? v : []);
|
|
364
372
|
return;
|
|
365
373
|
}
|
|
374
|
+
let veilig = veiligeBovenkant();
|
|
375
|
+
const herijk = () => {
|
|
376
|
+
veilig = veiligeBovenkant();
|
|
377
|
+
meet();
|
|
378
|
+
};
|
|
366
379
|
const meet = () => {
|
|
367
|
-
const veilig = veiligeBovenkant();
|
|
368
380
|
const gevonden = [];
|
|
369
381
|
for (const el of Array.from(document.querySelectorAll("[data-xicms-block]"))) {
|
|
370
382
|
const key = el.dataset.xicmsBlock;
|
|
@@ -375,6 +387,7 @@ function VisualEditorInner({ onClose }) {
|
|
|
375
387
|
const type = el.dataset.xicmsBlockType ?? "";
|
|
376
388
|
gevonden.push({
|
|
377
389
|
key,
|
|
390
|
+
type,
|
|
378
391
|
top: Math.max(r.top + 8, veilig + 8),
|
|
379
392
|
left: Math.max(r.right - 62, 8),
|
|
380
393
|
label: registryRef.current.get(type)?.label ?? type
|
|
@@ -387,12 +400,18 @@ function VisualEditorInner({ onClose }) {
|
|
|
387
400
|
return gevonden;
|
|
388
401
|
});
|
|
389
402
|
};
|
|
403
|
+
let frame = 0;
|
|
404
|
+
const meetGepland = () => {
|
|
405
|
+
cancelAnimationFrame(frame);
|
|
406
|
+
frame = requestAnimationFrame(meet);
|
|
407
|
+
};
|
|
390
408
|
meet();
|
|
391
|
-
window.addEventListener("scroll",
|
|
392
|
-
window.addEventListener("resize",
|
|
409
|
+
window.addEventListener("scroll", meetGepland, { capture: true, passive: true });
|
|
410
|
+
window.addEventListener("resize", herijk);
|
|
393
411
|
return () => {
|
|
394
|
-
|
|
395
|
-
window.removeEventListener("
|
|
412
|
+
cancelAnimationFrame(frame);
|
|
413
|
+
window.removeEventListener("scroll", meetGepland, { capture: true });
|
|
414
|
+
window.removeEventListener("resize", herijk);
|
|
396
415
|
};
|
|
397
416
|
}, [draft, displayBlocks, registryRef]);
|
|
398
417
|
const [productKnop, setProductKnop] = useState(null);
|
|
@@ -806,7 +825,7 @@ function VisualEditorInner({ onClose }) {
|
|
|
806
825
|
}
|
|
807
826
|
setConflict(false);
|
|
808
827
|
}, [siteId, path, mutateDraft]);
|
|
809
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "xicms-ve__shell", role: "group", "aria-label": `Pagina bewerken: ${path}`, children: [
|
|
828
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "xicms-ve__shell", "data-xicms-tooling": "", role: "group", "aria-label": `Pagina bewerken: ${path}`, children: [
|
|
810
829
|
/* @__PURE__ */ jsxs("header", { className: "xicms-ve__bar", role: "toolbar", "aria-label": "Beheer", children: [
|
|
811
830
|
/* @__PURE__ */ jsx("span", { className: "xicms-editbar__brand", children: isDemoActive() ? "XiCMS \xB7 demo" : "XiCMS" }),
|
|
812
831
|
/* @__PURE__ */ jsx(
|
|
@@ -968,46 +987,120 @@ function VisualEditorInner({ onClose }) {
|
|
|
968
987
|
}
|
|
969
988
|
}
|
|
970
989
|
),
|
|
971
|
-
blokknoppen.map((b) =>
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
990
|
+
blokknoppen.map((b) => {
|
|
991
|
+
const i = blocks.findIndex((blok) => blok._key === b.key);
|
|
992
|
+
const isSymbool = b.type === "symbolRef";
|
|
993
|
+
return /* @__PURE__ */ jsxs("div", { className: "xicms-ve-blokknoppen", style: { top: b.top, left: b.left }, children: [
|
|
994
|
+
/* @__PURE__ */ jsx(
|
|
995
|
+
"button",
|
|
996
|
+
{
|
|
997
|
+
type: "button",
|
|
998
|
+
className: `xicms-ve-blokknop${b.key === selectedKey ? " is-on" : ""}`,
|
|
999
|
+
title: `Tekst van ${b.label} bewerken`,
|
|
1000
|
+
"aria-label": `Tekst van ${b.label} bewerken`,
|
|
1001
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1002
|
+
onClick: () => {
|
|
1003
|
+
wilInlineRef.current = true;
|
|
1004
|
+
setSelectedProduct(null);
|
|
1005
|
+
setSelectedKey(b.key);
|
|
1006
|
+
},
|
|
1007
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1008
|
+
/* @__PURE__ */ jsx("path", { d: "M4 20h4L19.5 8.5a2.1 2.1 0 0 0-3-3L5 17v3z" }),
|
|
1009
|
+
/* @__PURE__ */ jsx("path", { d: "M14.5 6.5l3 3" })
|
|
1010
|
+
] })
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
/* @__PURE__ */ jsx(
|
|
1014
|
+
"button",
|
|
1015
|
+
{
|
|
1016
|
+
type: "button",
|
|
1017
|
+
className: `xicms-ve-blokknop${b.key === selectedKey && panelOpen ? " is-on" : ""}`,
|
|
1018
|
+
title: `Instellingen van ${b.label}`,
|
|
1019
|
+
"aria-label": `Instellingen van ${b.label}`,
|
|
1020
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1021
|
+
onClick: () => {
|
|
1022
|
+
setSelectedProduct(null);
|
|
1023
|
+
setSelectedKey(b.key);
|
|
1024
|
+
setPanelOpen(true);
|
|
1025
|
+
},
|
|
1026
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1027
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1028
|
+
/* @__PURE__ */ jsx("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
1029
|
+
] })
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
i >= 0 && /* @__PURE__ */ jsxs("span", { className: "xicms-ve-blokknoppen__meer", children: [
|
|
1033
|
+
/* @__PURE__ */ jsx(
|
|
1034
|
+
"button",
|
|
1035
|
+
{
|
|
1036
|
+
type: "button",
|
|
1037
|
+
className: "xicms-ve-blokknop",
|
|
1038
|
+
title: "Blok omhoog",
|
|
1039
|
+
"aria-label": `${b.label} omhoog`,
|
|
1040
|
+
disabled: i === 0,
|
|
1041
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1042
|
+
onClick: () => move(i, -1),
|
|
1043
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 19V5M5 12l7-7 7 7" }) })
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ jsx(
|
|
1047
|
+
"button",
|
|
1048
|
+
{
|
|
1049
|
+
type: "button",
|
|
1050
|
+
className: "xicms-ve-blokknop",
|
|
1051
|
+
title: "Blok omlaag",
|
|
1052
|
+
"aria-label": `${b.label} omlaag`,
|
|
1053
|
+
disabled: i === blocks.length - 1,
|
|
1054
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1055
|
+
onClick: () => move(i, 1),
|
|
1056
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" }) })
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1059
|
+
/* @__PURE__ */ jsx(
|
|
1060
|
+
"button",
|
|
1061
|
+
{
|
|
1062
|
+
type: "button",
|
|
1063
|
+
className: "xicms-ve-blokknop",
|
|
1064
|
+
title: "Blok dupliceren",
|
|
1065
|
+
"aria-label": `${b.label} dupliceren`,
|
|
1066
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1067
|
+
onClick: () => duplicate(i),
|
|
1068
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1069
|
+
/* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
1070
|
+
/* @__PURE__ */ jsx("path", { d: "M5 15V5a2 2 0 0 1 2-2h10" })
|
|
1071
|
+
] })
|
|
1072
|
+
}
|
|
1073
|
+
),
|
|
1074
|
+
isSymbool && /* @__PURE__ */ jsx(
|
|
1075
|
+
"button",
|
|
1076
|
+
{
|
|
1077
|
+
type: "button",
|
|
1078
|
+
className: "xicms-ve-blokknop",
|
|
1079
|
+
title: "Symbool loskoppelen (wordt een losse kopie)",
|
|
1080
|
+
"aria-label": `${b.label} loskoppelen`,
|
|
1081
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1082
|
+
onClick: () => void detachSymbol(i),
|
|
1083
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1084
|
+
/* @__PURE__ */ jsx("path", { d: "M9 12h6M8 7a4 4 0 0 0 0 8M16 7a4 4 0 0 1 0 8" }),
|
|
1085
|
+
/* @__PURE__ */ jsx("path", { d: "M3 3l18 18" })
|
|
1086
|
+
] })
|
|
1087
|
+
}
|
|
1088
|
+
),
|
|
1089
|
+
/* @__PURE__ */ jsx(
|
|
1090
|
+
"button",
|
|
1091
|
+
{
|
|
1092
|
+
type: "button",
|
|
1093
|
+
className: "xicms-ve-blokknop xicms-ve-blokknop--gevaar",
|
|
1094
|
+
title: "Blok verwijderen",
|
|
1095
|
+
"aria-label": `${b.label} verwijderen`,
|
|
1096
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1097
|
+
onClick: () => void remove(i),
|
|
1098
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14" }) })
|
|
1099
|
+
}
|
|
1100
|
+
)
|
|
1101
|
+
] })
|
|
1102
|
+
] }, b.key);
|
|
1103
|
+
}),
|
|
1011
1104
|
spots.map((s, i) => /* @__PURE__ */ jsx(
|
|
1012
1105
|
"button",
|
|
1013
1106
|
{
|