@orion-studios/payload-studio 0.6.0-beta.50 → 0.6.0-beta.52

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.
@@ -589,7 +589,20 @@ var normalizeDefinition = (type, value) => {
589
589
  type: value.type || type
590
590
  };
591
591
  };
592
- var decodeHtmlAttribute2 = (value) => typeof value === "string" ? value.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">") : "";
592
+ var decodeHtmlAttribute2 = (value) => {
593
+ if (typeof value !== "string") {
594
+ return "";
595
+ }
596
+ let decoded = value;
597
+ for (let index = 0; index < 3; index += 1) {
598
+ const next = decoded.replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
599
+ if (next === decoded) {
600
+ break;
601
+ }
602
+ decoded = next;
603
+ }
604
+ return decoded;
605
+ };
593
606
  var attrToPropName = (name) => name.replace(/^data-orion-/, "").replace(/^data-/, "").replace(/-([a-z])/g, (_, char) => char.toUpperCase());
594
607
  var propsFromAttributes = (attributes = {}) => {
595
608
  const props = {};
@@ -799,6 +812,7 @@ function GrapesPageEditor({
799
812
  const [saving, setSaving] = (0, import_react.useState)(null);
800
813
  const [saveMessage, setSaveMessage] = (0, import_react.useState)("");
801
814
  const [validationIssues, setValidationIssues] = (0, import_react.useState)([]);
815
+ const editorPageBasePath = initialData?.meta?.editorPageBasePath || "/admin/pages";
802
816
  const pageTree = initialData?.meta?.pageTree || [];
803
817
  const updateHistoryState = (editor) => {
804
818
  const next = {
@@ -1115,10 +1129,25 @@ function GrapesPageEditor({
1115
1129
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { className: "orion-builder-v2-sidebar", children: [
1116
1130
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-panel", children: [
1117
1131
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "Pages" }),
1118
- /* @__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)("a", { className: "orion-builder-v2-page-link", href: `#page-${page.id}`, children: [
1119
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: page.title }),
1120
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: page.path })
1121
- ] }, page.id)) })
1132
+ /* @__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)(
1133
+ "a",
1134
+ {
1135
+ className: "orion-builder-v2-page-link",
1136
+ href: `${editorPageBasePath}/${page.id}`,
1137
+ onClick: (event) => {
1138
+ const target = `${editorPageBasePath}/${page.id}`;
1139
+ if (window.parent && window.parent !== window) {
1140
+ event.preventDefault();
1141
+ window.parent.location.href = target;
1142
+ }
1143
+ },
1144
+ children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: page.title }),
1146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: page.path })
1147
+ ]
1148
+ },
1149
+ page.id
1150
+ )) })
1122
1151
  ] }),
1123
1152
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-panel", children: [
1124
1153
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "Blocks" }),
@@ -465,7 +465,20 @@ var normalizeDefinition = (type, value) => {
465
465
  type: value.type || type
466
466
  };
467
467
  };
468
- var decodeHtmlAttribute2 = (value) => typeof value === "string" ? value.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">") : "";
468
+ var decodeHtmlAttribute2 = (value) => {
469
+ if (typeof value !== "string") {
470
+ return "";
471
+ }
472
+ let decoded = value;
473
+ for (let index = 0; index < 3; index += 1) {
474
+ const next = decoded.replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
475
+ if (next === decoded) {
476
+ break;
477
+ }
478
+ decoded = next;
479
+ }
480
+ return decoded;
481
+ };
469
482
  var attrToPropName = (name) => name.replace(/^data-orion-/, "").replace(/^data-/, "").replace(/-([a-z])/g, (_, char) => char.toUpperCase());
470
483
  var propsFromAttributes = (attributes = {}) => {
471
484
  const props = {};
@@ -675,6 +688,7 @@ function GrapesPageEditor({
675
688
  const [saving, setSaving] = useState(null);
676
689
  const [saveMessage, setSaveMessage] = useState("");
677
690
  const [validationIssues, setValidationIssues] = useState([]);
691
+ const editorPageBasePath = initialData?.meta?.editorPageBasePath || "/admin/pages";
678
692
  const pageTree = initialData?.meta?.pageTree || [];
679
693
  const updateHistoryState = (editor) => {
680
694
  const next = {
@@ -991,10 +1005,25 @@ function GrapesPageEditor({
991
1005
  /* @__PURE__ */ jsxs("aside", { className: "orion-builder-v2-sidebar", children: [
992
1006
  /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-panel", children: [
993
1007
  /* @__PURE__ */ jsx("h2", { children: "Pages" }),
994
- /* @__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("a", { className: "orion-builder-v2-page-link", href: `#page-${page.id}`, children: [
995
- /* @__PURE__ */ jsx("span", { children: page.title }),
996
- /* @__PURE__ */ jsx("small", { children: page.path })
997
- ] }, page.id)) })
1008
+ /* @__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(
1009
+ "a",
1010
+ {
1011
+ className: "orion-builder-v2-page-link",
1012
+ href: `${editorPageBasePath}/${page.id}`,
1013
+ onClick: (event) => {
1014
+ const target = `${editorPageBasePath}/${page.id}`;
1015
+ if (window.parent && window.parent !== window) {
1016
+ event.preventDefault();
1017
+ window.parent.location.href = target;
1018
+ }
1019
+ },
1020
+ children: [
1021
+ /* @__PURE__ */ jsx("span", { children: page.title }),
1022
+ /* @__PURE__ */ jsx("small", { children: page.path })
1023
+ ]
1024
+ },
1025
+ page.id
1026
+ )) })
998
1027
  ] }),
999
1028
  /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-panel", children: [
1000
1029
  /* @__PURE__ */ jsx("h2", { children: "Blocks" }),
@@ -66,6 +66,7 @@ type BuilderV2ReusableSection = {
66
66
  thumbnail?: string;
67
67
  };
68
68
  type BuilderV2EditorMeta = {
69
+ editorPageBasePath?: string;
69
70
  pageTree?: BuilderV2PageTreeNode[];
70
71
  permissions?: BuilderV2PermissionSet;
71
72
  themeTokens?: BuilderV2ThemeTokens;
@@ -66,6 +66,7 @@ type BuilderV2ReusableSection = {
66
66
  thumbnail?: string;
67
67
  };
68
68
  type BuilderV2EditorMeta = {
69
+ editorPageBasePath?: string;
69
70
  pageTree?: BuilderV2PageTreeNode[];
70
71
  permissions?: BuilderV2PermissionSet;
71
72
  themeTokens?: BuilderV2ThemeTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.50",
3
+ "version": "0.6.0-beta.52",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",