@cmssy/cli 11.0.0 → 11.1.1
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/assets/init/astro/src/cmssy/layout-slot.tsx +11 -0
- package/assets/init/astro/src/pages/[...path].astro +4 -0
- package/assets/init/astro/src/pages/cmssy-edit/[...path].astro +9 -5
- package/assets/init/remix/app/cmssy/layout-slot.tsx +11 -0
- package/assets/init/remix/app/routes/page.tsx +6 -1
- package/package.json +2 -2
|
@@ -15,6 +15,13 @@ export interface LayoutSlotProps {
|
|
|
15
15
|
enabledLocales: string[];
|
|
16
16
|
/** Set on a VERIFIED editor request; the loader reports it as `isEdit`. */
|
|
17
17
|
edit?: { editorOrigin: string | string[] };
|
|
18
|
+
/**
|
|
19
|
+
* The editor's block data, both halves, straight from the loader. Without
|
|
20
|
+
* `resolvedContent` the canvas shows a relation field as the raw ids it
|
|
21
|
+
* stores - the site looks right and the editor cannot fill the header.
|
|
22
|
+
*/
|
|
23
|
+
data?: Record<string, unknown>;
|
|
24
|
+
resolvedContent?: Record<string, Record<string, unknown>>;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
/**
|
|
@@ -34,6 +41,8 @@ export default function LayoutSlot({
|
|
|
34
41
|
defaultLocale,
|
|
35
42
|
enabledLocales,
|
|
36
43
|
edit,
|
|
44
|
+
data,
|
|
45
|
+
resolvedContent,
|
|
37
46
|
}: LayoutSlotProps) {
|
|
38
47
|
if (edit) {
|
|
39
48
|
return (
|
|
@@ -44,6 +53,8 @@ export default function LayoutSlot({
|
|
|
44
53
|
defaultLocale={defaultLocale}
|
|
45
54
|
enabledLocales={enabledLocales}
|
|
46
55
|
edit={edit}
|
|
56
|
+
data={data}
|
|
57
|
+
resolvedContent={resolvedContent}
|
|
47
58
|
load={() => import("./blocks")}
|
|
48
59
|
/>
|
|
49
60
|
);
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { loadCmssyPage } from "@cmssy/astro";
|
|
3
3
|
import { cmssy } from "../cmssy.config";
|
|
4
|
+
import { blocks } from "../cmssy/blocks";
|
|
4
5
|
import { Blocks } from "../components/Blocks";
|
|
5
6
|
import LayoutSlot from "../cmssy/layout-slot";
|
|
6
7
|
|
|
7
8
|
export const prerender = false;
|
|
8
9
|
|
|
10
|
+
// `blocks` is what lets the loader resolve the editor's layout data. Drop it
|
|
11
|
+
// and the site still renders - the editor just cannot fill the header.
|
|
9
12
|
const { page, layouts, locale, defaultLocale, enabledLocales } = await loadCmssyPage(
|
|
10
13
|
cmssy,
|
|
11
14
|
Astro.request,
|
|
12
15
|
Astro.url,
|
|
16
|
+
{ blocks },
|
|
13
17
|
);
|
|
14
18
|
|
|
15
19
|
if (!page) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { loadCmssyPage } from "@cmssy/astro";
|
|
3
3
|
import { cmssy } from "../../cmssy.config";
|
|
4
|
+
import { blocks } from "../../cmssy/blocks";
|
|
4
5
|
import CmssyEditor from "../../cmssy/editor";
|
|
5
6
|
import LayoutSlot from "../../cmssy/layout-slot";
|
|
6
7
|
|
|
@@ -8,11 +9,10 @@ import LayoutSlot from "../../cmssy/layout-slot";
|
|
|
8
9
|
// must be dynamic: a prerendered page never sees the query string.
|
|
9
10
|
export const prerender = false;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Astro.url,
|
|
15
|
-
);
|
|
12
|
+
// `blocks` is what resolves the editor's layout data. Without it the editor
|
|
13
|
+
// can select the header and not fill it, and a relation field shows raw ids.
|
|
14
|
+
const { page, layouts, locale, defaultLocale, enabledLocales, editorData } =
|
|
15
|
+
await loadCmssyPage(cmssy, Astro.request, Astro.url, { blocks });
|
|
16
16
|
const editorOrigin = cmssy.editorOrigin ?? "*";
|
|
17
17
|
---
|
|
18
18
|
|
|
@@ -30,6 +30,8 @@ const editorOrigin = cmssy.editorOrigin ?? "*";
|
|
|
30
30
|
defaultLocale={defaultLocale}
|
|
31
31
|
enabledLocales={enabledLocales}
|
|
32
32
|
edit={{ editorOrigin }}
|
|
33
|
+
data={editorData?.header?.data}
|
|
34
|
+
resolvedContent={editorData?.header?.resolvedContent}
|
|
33
35
|
/>
|
|
34
36
|
<CmssyEditor
|
|
35
37
|
client:load
|
|
@@ -47,6 +49,8 @@ const editorOrigin = cmssy.editorOrigin ?? "*";
|
|
|
47
49
|
defaultLocale={defaultLocale}
|
|
48
50
|
enabledLocales={enabledLocales}
|
|
49
51
|
edit={{ editorOrigin }}
|
|
52
|
+
data={editorData?.footer?.data}
|
|
53
|
+
resolvedContent={editorData?.footer?.resolvedContent}
|
|
50
54
|
/>
|
|
51
55
|
</body>
|
|
52
56
|
</html>
|
|
@@ -15,6 +15,13 @@ export interface LayoutSlotProps {
|
|
|
15
15
|
enabledLocales: string[];
|
|
16
16
|
/** Set on a VERIFIED editor request; the loader reports it as `isEdit`. */
|
|
17
17
|
edit?: { editorOrigin: string | string[] };
|
|
18
|
+
/**
|
|
19
|
+
* The editor's block data, both halves, straight from the loader. Without
|
|
20
|
+
* `resolvedContent` the canvas shows a relation field as the raw ids it
|
|
21
|
+
* stores - the site looks right and the editor cannot fill the header.
|
|
22
|
+
*/
|
|
23
|
+
data?: Record<string, unknown>;
|
|
24
|
+
resolvedContent?: Record<string, Record<string, unknown>>;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
/**
|
|
@@ -31,6 +38,8 @@ export function LayoutSlot({
|
|
|
31
38
|
defaultLocale,
|
|
32
39
|
enabledLocales,
|
|
33
40
|
edit,
|
|
41
|
+
data,
|
|
42
|
+
resolvedContent,
|
|
34
43
|
}: LayoutSlotProps) {
|
|
35
44
|
if (edit) {
|
|
36
45
|
return (
|
|
@@ -41,6 +50,8 @@ export function LayoutSlot({
|
|
|
41
50
|
defaultLocale={defaultLocale}
|
|
42
51
|
enabledLocales={enabledLocales}
|
|
43
52
|
edit={edit}
|
|
53
|
+
data={data}
|
|
54
|
+
resolvedContent={resolvedContent}
|
|
44
55
|
load={() => import("./blocks")}
|
|
45
56
|
/>
|
|
46
57
|
);
|
|
@@ -6,7 +6,9 @@ import { CmssyEditor } from "../cmssy/editor";
|
|
|
6
6
|
import { LayoutSlot } from "../cmssy/layout-slot";
|
|
7
7
|
import type { Route } from "./+types/page";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// `blocks` is what lets the loader resolve the editor's layout data. Drop it
|
|
10
|
+
// and the site still renders - the editor just cannot fill the header.
|
|
11
|
+
export const loader = createCmssyLoader(cmssy, { blocks });
|
|
10
12
|
|
|
11
13
|
// Without these the admin cannot frame the site, and the editor shows an empty
|
|
12
14
|
// box with no error anywhere.
|
|
@@ -22,6 +24,7 @@ export default function CmssyPage({ loaderData }: Route.ComponentProps) {
|
|
|
22
24
|
isEdit,
|
|
23
25
|
editorOrigin,
|
|
24
26
|
diagnostics,
|
|
27
|
+
editorData,
|
|
25
28
|
} = loaderData;
|
|
26
29
|
|
|
27
30
|
if (diagnostics) {
|
|
@@ -38,6 +41,8 @@ export default function CmssyPage({ loaderData }: Route.ComponentProps) {
|
|
|
38
41
|
defaultLocale={defaultLocale}
|
|
39
42
|
enabledLocales={enabledLocales}
|
|
40
43
|
edit={isEdit ? { editorOrigin } : undefined}
|
|
44
|
+
data={editorData?.[position]?.data}
|
|
45
|
+
resolvedContent={editorData?.[position]?.resolvedContent}
|
|
41
46
|
/>
|
|
42
47
|
);
|
|
43
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/cli",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "The cmssy CLI: `cmssy init` wires cmssy into an existing Next.js, Astro or React Router app; `cmssy link` connects it to a workspace and verifies the editor wiring.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"assets"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cmssy/core": "11.
|
|
30
|
+
"@cmssy/core": "11.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20.0.0",
|