@orion-studios/payload-studio 0.6.0-beta.51 → 0.6.0-beta.53
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.
|
@@ -627,6 +627,25 @@ var propsFromAttributes = (attributes = {}) => {
|
|
|
627
627
|
return props;
|
|
628
628
|
};
|
|
629
629
|
var previewForDefinition = (definition, props) => definition.editorPreview?.(props) || `<div class="orion-builder-v2-dynamic-placeholder"><strong>${definition.label}</strong></div>`;
|
|
630
|
+
var lockPreviewChildren = (component) => {
|
|
631
|
+
const children = typeof component.components === "function" ? component.components() : null;
|
|
632
|
+
const childList = children && typeof children === "object" && "forEach" in children ? children : null;
|
|
633
|
+
childList?.forEach((child) => {
|
|
634
|
+
if (typeof child.set === "function") {
|
|
635
|
+
child.set({
|
|
636
|
+
copyable: false,
|
|
637
|
+
draggable: false,
|
|
638
|
+
droppable: false,
|
|
639
|
+
editable: false,
|
|
640
|
+
highlightable: false,
|
|
641
|
+
hoverable: false,
|
|
642
|
+
removable: false,
|
|
643
|
+
selectable: false
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
lockPreviewChildren(child);
|
|
647
|
+
});
|
|
648
|
+
};
|
|
630
649
|
var registerProjectDynamicComponents = (editor, adapter) => {
|
|
631
650
|
const components = adapter?.components || {};
|
|
632
651
|
Object.keys(components).forEach((type) => {
|
|
@@ -669,6 +688,7 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
669
688
|
const attributes = this.model.getAttributes?.() || {};
|
|
670
689
|
const props = propsFromAttributes(attributes);
|
|
671
690
|
this.model.components(previewForDefinition(definition, props));
|
|
691
|
+
lockPreviewChildren(this.model);
|
|
672
692
|
}
|
|
673
693
|
}
|
|
674
694
|
});
|
|
@@ -812,6 +832,7 @@ function GrapesPageEditor({
|
|
|
812
832
|
const [saving, setSaving] = (0, import_react.useState)(null);
|
|
813
833
|
const [saveMessage, setSaveMessage] = (0, import_react.useState)("");
|
|
814
834
|
const [validationIssues, setValidationIssues] = (0, import_react.useState)([]);
|
|
835
|
+
const editorPageBasePath = initialData?.meta?.editorPageBasePath || "/admin/pages";
|
|
815
836
|
const pageTree = initialData?.meta?.pageTree || [];
|
|
816
837
|
const updateHistoryState = (editor) => {
|
|
817
838
|
const next = {
|
|
@@ -1128,10 +1149,25 @@ function GrapesPageEditor({
|
|
|
1128
1149
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { className: "orion-builder-v2-sidebar", children: [
|
|
1129
1150
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-panel", children: [
|
|
1130
1151
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "Pages" }),
|
|
1131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "orion-builder-v2-page-tree", children: pageTree.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No pages loaded." }) : pageTree.map((page) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "orion-builder-v2-page-tree", children: pageTree.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "No pages loaded." }) : pageTree.map((page) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1153
|
+
"a",
|
|
1154
|
+
{
|
|
1155
|
+
className: "orion-builder-v2-page-link",
|
|
1156
|
+
href: `${editorPageBasePath}/${page.id}`,
|
|
1157
|
+
onClick: (event) => {
|
|
1158
|
+
const target = `${editorPageBasePath}/${page.id}`;
|
|
1159
|
+
if (window.parent && window.parent !== window) {
|
|
1160
|
+
event.preventDefault();
|
|
1161
|
+
window.parent.location.href = target;
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: page.title }),
|
|
1166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: page.path })
|
|
1167
|
+
]
|
|
1168
|
+
},
|
|
1169
|
+
page.id
|
|
1170
|
+
)) })
|
|
1135
1171
|
] }),
|
|
1136
1172
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-panel", children: [
|
|
1137
1173
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "Blocks" }),
|
|
@@ -503,6 +503,25 @@ var propsFromAttributes = (attributes = {}) => {
|
|
|
503
503
|
return props;
|
|
504
504
|
};
|
|
505
505
|
var previewForDefinition = (definition, props) => definition.editorPreview?.(props) || `<div class="orion-builder-v2-dynamic-placeholder"><strong>${definition.label}</strong></div>`;
|
|
506
|
+
var lockPreviewChildren = (component) => {
|
|
507
|
+
const children = typeof component.components === "function" ? component.components() : null;
|
|
508
|
+
const childList = children && typeof children === "object" && "forEach" in children ? children : null;
|
|
509
|
+
childList?.forEach((child) => {
|
|
510
|
+
if (typeof child.set === "function") {
|
|
511
|
+
child.set({
|
|
512
|
+
copyable: false,
|
|
513
|
+
draggable: false,
|
|
514
|
+
droppable: false,
|
|
515
|
+
editable: false,
|
|
516
|
+
highlightable: false,
|
|
517
|
+
hoverable: false,
|
|
518
|
+
removable: false,
|
|
519
|
+
selectable: false
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
lockPreviewChildren(child);
|
|
523
|
+
});
|
|
524
|
+
};
|
|
506
525
|
var registerProjectDynamicComponents = (editor, adapter) => {
|
|
507
526
|
const components = adapter?.components || {};
|
|
508
527
|
Object.keys(components).forEach((type) => {
|
|
@@ -545,6 +564,7 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
545
564
|
const attributes = this.model.getAttributes?.() || {};
|
|
546
565
|
const props = propsFromAttributes(attributes);
|
|
547
566
|
this.model.components(previewForDefinition(definition, props));
|
|
567
|
+
lockPreviewChildren(this.model);
|
|
548
568
|
}
|
|
549
569
|
}
|
|
550
570
|
});
|
|
@@ -688,6 +708,7 @@ function GrapesPageEditor({
|
|
|
688
708
|
const [saving, setSaving] = useState(null);
|
|
689
709
|
const [saveMessage, setSaveMessage] = useState("");
|
|
690
710
|
const [validationIssues, setValidationIssues] = useState([]);
|
|
711
|
+
const editorPageBasePath = initialData?.meta?.editorPageBasePath || "/admin/pages";
|
|
691
712
|
const pageTree = initialData?.meta?.pageTree || [];
|
|
692
713
|
const updateHistoryState = (editor) => {
|
|
693
714
|
const next = {
|
|
@@ -1004,10 +1025,25 @@ function GrapesPageEditor({
|
|
|
1004
1025
|
/* @__PURE__ */ jsxs("aside", { className: "orion-builder-v2-sidebar", children: [
|
|
1005
1026
|
/* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-panel", children: [
|
|
1006
1027
|
/* @__PURE__ */ jsx("h2", { children: "Pages" }),
|
|
1007
|
-
/* @__PURE__ */ jsx("div", { className: "orion-builder-v2-page-tree", children: pageTree.length === 0 ? /* @__PURE__ */ jsx("p", { children: "No pages loaded." }) : pageTree.map((page) => /* @__PURE__ */ jsxs(
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1028
|
+
/* @__PURE__ */ jsx("div", { className: "orion-builder-v2-page-tree", children: pageTree.length === 0 ? /* @__PURE__ */ jsx("p", { children: "No pages loaded." }) : pageTree.map((page) => /* @__PURE__ */ jsxs(
|
|
1029
|
+
"a",
|
|
1030
|
+
{
|
|
1031
|
+
className: "orion-builder-v2-page-link",
|
|
1032
|
+
href: `${editorPageBasePath}/${page.id}`,
|
|
1033
|
+
onClick: (event) => {
|
|
1034
|
+
const target = `${editorPageBasePath}/${page.id}`;
|
|
1035
|
+
if (window.parent && window.parent !== window) {
|
|
1036
|
+
event.preventDefault();
|
|
1037
|
+
window.parent.location.href = target;
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
children: [
|
|
1041
|
+
/* @__PURE__ */ jsx("span", { children: page.title }),
|
|
1042
|
+
/* @__PURE__ */ jsx("small", { children: page.path })
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
page.id
|
|
1046
|
+
)) })
|
|
1011
1047
|
] }),
|
|
1012
1048
|
/* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-panel", children: [
|
|
1013
1049
|
/* @__PURE__ */ jsx("h2", { children: "Blocks" }),
|
package/package.json
CHANGED