@cmssy/core 11.1.1 → 11.2.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/testing.cjs +16 -0
- package/dist/testing.js +16 -0
- package/package.json +1 -1
package/dist/testing.cjs
CHANGED
|
@@ -145,6 +145,10 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
145
145
|
var EDITOR_MARKER = /data-cmssy-editor/;
|
|
146
146
|
var SERVER_LAYOUT_BLOCKS = /<header|<footer/;
|
|
147
147
|
var EDITABLE_LAYOUT_SLOT = /data-cmssy-layout-slot/;
|
|
148
|
+
var EDITOR_CONTENT_COUNT = /data-cmssy-editor-content="(\d+)"/g;
|
|
149
|
+
function resolvedContentCounts(body) {
|
|
150
|
+
return [...body.matchAll(EDITOR_CONTENT_COUNT)].map((m) => Number(m[1]));
|
|
151
|
+
}
|
|
148
152
|
async function html(url) {
|
|
149
153
|
const response = await fetch(url, { redirect: "manual" });
|
|
150
154
|
return { status: response.status, body: await response.text() };
|
|
@@ -216,6 +220,18 @@ async function checkCmssyEditMode(options) {
|
|
|
216
220
|
`edit ${path}: the workspace defines layout blocks and no editable layout slot is mounted - the header and footer cannot be edited (10.0 removed CmssyLayoutSlot; see docs/wiring.md \xA75)`
|
|
217
221
|
);
|
|
218
222
|
}
|
|
223
|
+
if (configured === true && EDITABLE_LAYOUT_SLOT.test(verified.body)) {
|
|
224
|
+
const counts = resolvedContentCounts(verified.body);
|
|
225
|
+
if (counts.length === 0) {
|
|
226
|
+
failures.push(
|
|
227
|
+
`edit ${path}: the layout slot reports no editor-content marker - @cmssy/react is older than 11.2.0, or the slot is not CmssyLazyLayout`
|
|
228
|
+
);
|
|
229
|
+
} else if (counts.every((count) => count === 0)) {
|
|
230
|
+
failures.push(
|
|
231
|
+
`edit ${path}: every layout slot resolved 0 blocks for the editor. The slot is mounted but was not rendered in edit mode - the canvas gets nothing and the fetch ran without the preview secret, so you are editing the published page. Check that the verified request reaches the edit route with its edit signal intact.`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
219
235
|
const { localizedPath } = options;
|
|
220
236
|
if (localizedPath) {
|
|
221
237
|
const locale = options.localizedLocale ?? localizedPath.split("/").filter(Boolean)[0];
|
package/dist/testing.js
CHANGED
|
@@ -143,6 +143,10 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
143
143
|
var EDITOR_MARKER = /data-cmssy-editor/;
|
|
144
144
|
var SERVER_LAYOUT_BLOCKS = /<header|<footer/;
|
|
145
145
|
var EDITABLE_LAYOUT_SLOT = /data-cmssy-layout-slot/;
|
|
146
|
+
var EDITOR_CONTENT_COUNT = /data-cmssy-editor-content="(\d+)"/g;
|
|
147
|
+
function resolvedContentCounts(body) {
|
|
148
|
+
return [...body.matchAll(EDITOR_CONTENT_COUNT)].map((m) => Number(m[1]));
|
|
149
|
+
}
|
|
146
150
|
async function html(url) {
|
|
147
151
|
const response = await fetch(url, { redirect: "manual" });
|
|
148
152
|
return { status: response.status, body: await response.text() };
|
|
@@ -214,6 +218,18 @@ async function checkCmssyEditMode(options) {
|
|
|
214
218
|
`edit ${path}: the workspace defines layout blocks and no editable layout slot is mounted - the header and footer cannot be edited (10.0 removed CmssyLayoutSlot; see docs/wiring.md \xA75)`
|
|
215
219
|
);
|
|
216
220
|
}
|
|
221
|
+
if (configured === true && EDITABLE_LAYOUT_SLOT.test(verified.body)) {
|
|
222
|
+
const counts = resolvedContentCounts(verified.body);
|
|
223
|
+
if (counts.length === 0) {
|
|
224
|
+
failures.push(
|
|
225
|
+
`edit ${path}: the layout slot reports no editor-content marker - @cmssy/react is older than 11.2.0, or the slot is not CmssyLazyLayout`
|
|
226
|
+
);
|
|
227
|
+
} else if (counts.every((count) => count === 0)) {
|
|
228
|
+
failures.push(
|
|
229
|
+
`edit ${path}: every layout slot resolved 0 blocks for the editor. The slot is mounted but was not rendered in edit mode - the canvas gets nothing and the fetch ran without the preview secret, so you are editing the published page. Check that the verified request reaches the edit route with its edit signal intact.`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
217
233
|
const { localizedPath } = options;
|
|
218
234
|
if (localizedPath) {
|
|
219
235
|
const locale = options.localizedLocale ?? localizedPath.split("/").filter(Boolean)[0];
|