@bettercms-ai/astro 0.7.0 → 0.8.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/components/BcmsBlocks.astro +32 -2
- package/package.json +1 -1
|
@@ -137,7 +137,16 @@ const needsTabs = !nested && containsType(blocks, "tabs");
|
|
|
137
137
|
const pass = { forms, components, turnstileSiteKey, nested: true };
|
|
138
138
|
---
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
<!--
|
|
141
|
+
`data-bcms-page` marks this subtree as ours to edit — the Astro equivalent of the hosted
|
|
142
|
+
renderer's `<main class="bcms-page">` and the Next adapter's container marker. The editor gates
|
|
143
|
+
the whole section lane on a CONTAINER marker rather than on the presence of blocks, so a page
|
|
144
|
+
with NO sections yet is still recognised and can be given its first one.
|
|
145
|
+
|
|
146
|
+
Only on the outermost render: every self-recursion passes `nested: true`, and a marker on each
|
|
147
|
+
nested container would claim a column's interior is a page.
|
|
148
|
+
-->
|
|
149
|
+
<div class={className} data-bcms-page={nested ? undefined : ""}>
|
|
141
150
|
{blocks.map((block) => {
|
|
142
151
|
const p = anyProps(block);
|
|
143
152
|
const style = styleAttr(block);
|
|
@@ -295,7 +304,28 @@ const pass = { forms, components, turnstileSiteKey, nested: true };
|
|
|
295
304
|
})();
|
|
296
305
|
// FLO-264: honour the block's bounded style tokens here too, so Astro output matches
|
|
297
306
|
// the builder canvas, the Next adapter and the hosted site.
|
|
298
|
-
|
|
307
|
+
if (node == null) return null;
|
|
308
|
+
/**
|
|
309
|
+
* 🔴 `data-bcms-block` — the Visual Editor hit-tests this to find sections. Without it the
|
|
310
|
+
* editor renders every block and recognises none of them, so move / duplicate / delete /
|
|
311
|
+
* reorder and per-section presence never appear on an Astro site. Field bindings alone
|
|
312
|
+
* (`data-bcms-field`) make text editable and tell the editor nothing about structure.
|
|
313
|
+
*
|
|
314
|
+
* TOP LEVEL ONLY (`!nested`): a section IS a top-level block, and tagging nested ones would
|
|
315
|
+
* make a column's child look like a section you could drag out of its parent.
|
|
316
|
+
*
|
|
317
|
+
* A wrapper element rather than an attribute on `node`, because Astro renders to HTML and has
|
|
318
|
+
* no `cloneElement` — the same constraint that made the hosted renderer wrap
|
|
319
|
+
* (`render-page.ts`), and the same reasoning applies: a plain block-level div, so a full-bleed
|
|
320
|
+
* section background still reaches the edges. The Next adapter clones instead, precisely
|
|
321
|
+
* because React lets it and a wrapper there would land inside the customer's own layout.
|
|
322
|
+
*
|
|
323
|
+
* When a style wrapper already exists the attribute rides it, so this never adds a SECOND div.
|
|
324
|
+
*/
|
|
325
|
+
const blockId = nested ? undefined : block.id;
|
|
326
|
+
if (style) return <div style={style} data-bcms-block={blockId}>{node}</div>;
|
|
327
|
+
if (blockId) return <div data-bcms-block={blockId}>{node}</div>;
|
|
328
|
+
return node;
|
|
299
329
|
})}
|
|
300
330
|
</div>
|
|
301
331
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettercms-ai/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The BetterCMS adapter for Astro — a `bettercms()` integration, a `bettercms:client` virtual module, typed content loaders, draft preview, and native .astro rendering components.",
|
|
6
6
|
"main": "./dist/index.js",
|