@bettercms-ai/astro 0.14.2 → 0.14.4
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 +19 -0
- package/package.json +5 -5
|
@@ -33,6 +33,7 @@ import { applyOverrides } from "@bettercms-ai/ui/resolve";
|
|
|
33
33
|
import { addressFor } from "../dist/bindings.js";
|
|
34
34
|
import { portableTextToHtml } from "@bettercms-ai/richtext/html";
|
|
35
35
|
import { readStructuredContent } from "@bettercms-ai/richtext";
|
|
36
|
+
import { headingParts, richtextHeadingLevel } from "@bettercms-ai/richtext/heading";
|
|
36
37
|
import BcmsImage from "./BcmsImage.astro";
|
|
37
38
|
import BcmsForm from "./BcmsForm.astro";
|
|
38
39
|
|
|
@@ -225,6 +226,24 @@ const pass = { forms, components, turnstileSiteKey, nested: true, fieldAddresses
|
|
|
225
226
|
* The per-block `#<_key>` addresses are stamped by the serialiser, so one paragraph
|
|
226
227
|
* inside the field is clickable rather than the field being one opaque string.
|
|
227
228
|
*/
|
|
229
|
+
/**
|
|
230
|
+
* `props.level` renders the rich copy AS <hN>, with the SAME shared helper the hosted
|
|
231
|
+
* renderer and @bettercms-ai/next use (src/lib/richtext/heading.ts) — a heading assembled
|
|
232
|
+
* per lane is the divergence `src/__tests__/parity.test.ts` exists to catch. Absent ⇒ the
|
|
233
|
+
* ordinary container below, byte-identical to before; a value that is not one line of
|
|
234
|
+
* inline copy falls through rather than nesting paragraphs inside a heading.
|
|
235
|
+
*/
|
|
236
|
+
const level = richtextHeadingLevel(p.level);
|
|
237
|
+
if (level) {
|
|
238
|
+
const heading = headingParts(p, addressFor(block.id, "html", bctx));
|
|
239
|
+
if (heading !== null) {
|
|
240
|
+
const HTag = `h${level}` as keyof HTMLElementTagNameMap;
|
|
241
|
+
const headingBind = heading.address
|
|
242
|
+
? { "data-bcms-field": heading.address, "data-bcms-kind": "richtext" }
|
|
243
|
+
: {};
|
|
244
|
+
return <HTag {...headingBind} {...blockAttrs} set:html={heading.inner} />;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
228
247
|
const structured = readStructuredContent(p);
|
|
229
248
|
if (structured) {
|
|
230
249
|
const base = addressFor(block.id, "html", bctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettercms-ai/astro",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
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",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@bettercms-ai/image-url": "^0.3.0",
|
|
57
|
-
"@bettercms-ai/next": "^0.13.
|
|
58
|
-
"@bettercms-ai/richtext": "^0.
|
|
57
|
+
"@bettercms-ai/next": "^0.13.3",
|
|
58
|
+
"@bettercms-ai/richtext": "^0.4.0",
|
|
59
59
|
"@bettercms-ai/sdk": "^1.22.0",
|
|
60
|
-
"@bettercms-ai/types": "^1.
|
|
61
|
-
"@bettercms-ai/ui": "^0.
|
|
60
|
+
"@bettercms-ai/types": "^1.18.0",
|
|
61
|
+
"@bettercms-ai/ui": "^0.8.1",
|
|
62
62
|
"libphonenumber-js": "^1.13.13"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|