@bettercms-ai/astro 0.7.0 → 0.8.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/components/BcmsBlocks.astro +36 -2
- package/package.json +1 -1
|
@@ -137,7 +137,20 @@ 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
|
+
An expression comment, NOT `<!-- -->`: Astro emits HTML comments to the output, and this
|
|
150
|
+
component recurses into itself for columns/tabs/sliders/components, so an HTML comment here
|
|
151
|
+
shipped once per nesting level to every visitor (FLO-1161).
|
|
152
|
+
*/}
|
|
153
|
+
<div class={className} data-bcms-page={nested ? undefined : ""}>
|
|
141
154
|
{blocks.map((block) => {
|
|
142
155
|
const p = anyProps(block);
|
|
143
156
|
const style = styleAttr(block);
|
|
@@ -295,7 +308,28 @@ const pass = { forms, components, turnstileSiteKey, nested: true };
|
|
|
295
308
|
})();
|
|
296
309
|
// FLO-264: honour the block's bounded style tokens here too, so Astro output matches
|
|
297
310
|
// the builder canvas, the Next adapter and the hosted site.
|
|
298
|
-
|
|
311
|
+
if (node == null) return null;
|
|
312
|
+
/**
|
|
313
|
+
* 🔴 `data-bcms-block` — the Visual Editor hit-tests this to find sections. Without it the
|
|
314
|
+
* editor renders every block and recognises none of them, so move / duplicate / delete /
|
|
315
|
+
* reorder and per-section presence never appear on an Astro site. Field bindings alone
|
|
316
|
+
* (`data-bcms-field`) make text editable and tell the editor nothing about structure.
|
|
317
|
+
*
|
|
318
|
+
* TOP LEVEL ONLY (`!nested`): a section IS a top-level block, and tagging nested ones would
|
|
319
|
+
* make a column's child look like a section you could drag out of its parent.
|
|
320
|
+
*
|
|
321
|
+
* A wrapper element rather than an attribute on `node`, because Astro renders to HTML and has
|
|
322
|
+
* no `cloneElement` — the same constraint that made the hosted renderer wrap
|
|
323
|
+
* (`render-page.ts`), and the same reasoning applies: a plain block-level div, so a full-bleed
|
|
324
|
+
* section background still reaches the edges. The Next adapter clones instead, precisely
|
|
325
|
+
* because React lets it and a wrapper there would land inside the customer's own layout.
|
|
326
|
+
*
|
|
327
|
+
* When a style wrapper already exists the attribute rides it, so this never adds a SECOND div.
|
|
328
|
+
*/
|
|
329
|
+
const blockId = nested ? undefined : block.id;
|
|
330
|
+
if (style) return <div style={style} data-bcms-block={blockId}>{node}</div>;
|
|
331
|
+
if (blockId) return <div data-bcms-block={blockId}>{node}</div>;
|
|
332
|
+
return node;
|
|
299
333
|
})}
|
|
300
334
|
</div>
|
|
301
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettercms-ai/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|