@bettercms-ai/astro 0.3.0 → 0.4.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.
|
@@ -34,15 +34,20 @@ const anyProps = (b: ContentBlock) => (b as { props?: Record<string, any> }).pro
|
|
|
34
34
|
}
|
|
35
35
|
case "text":
|
|
36
36
|
return <div class="bcms-text" data-bcms-field={`${block.id}__html`} data-bcms-kind="richtext" set:html={p.html ?? ""} />;
|
|
37
|
-
case "image":
|
|
37
|
+
case "image": {
|
|
38
|
+
// Matches the Next adapter: the image block is click-to-select on the Visual Editor
|
|
39
|
+
// canvas like heading/text/button, rather than dock-only. `kind="image"` means select
|
|
40
|
+
// + live src reflection, never contentEditable.
|
|
41
|
+
const bind = { "data-bcms-field": `${block.id}__src`, "data-bcms-kind": "image" };
|
|
38
42
|
return p.caption ? (
|
|
39
43
|
<figure>
|
|
40
|
-
<BcmsImage src={p.src} alt={p.alt ?? ""} width={p.width} height={p.height} />
|
|
44
|
+
<BcmsImage src={p.src} alt={p.alt ?? ""} width={p.width} height={p.height} {...bind} />
|
|
41
45
|
<figcaption>{p.caption}</figcaption>
|
|
42
46
|
</figure>
|
|
43
47
|
) : (
|
|
44
|
-
<BcmsImage src={p.src} alt={p.alt ?? ""} width={p.width} height={p.height} />
|
|
48
|
+
<BcmsImage src={p.src} alt={p.alt ?? ""} width={p.width} height={p.height} {...bind} />
|
|
45
49
|
);
|
|
50
|
+
}
|
|
46
51
|
case "button":
|
|
47
52
|
return (
|
|
48
53
|
<a class={`bcms-btn bcms-btn-${p.variant === "secondary" ? "secondary" : "primary"}`} href={p.href ?? "#"} data-bcms-field={`${block.id}__text`}>
|
|
@@ -21,6 +21,8 @@ interface Props {
|
|
|
21
21
|
sizes?: string;
|
|
22
22
|
loading?: "lazy" | "eager";
|
|
23
23
|
class?: string;
|
|
24
|
+
/** Any other attribute (e.g. `data-bcms-field`) is forwarded to the <img>. */
|
|
25
|
+
[attr: string]: unknown;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
const {
|
|
@@ -34,6 +36,7 @@ const {
|
|
|
34
36
|
sizes,
|
|
35
37
|
loading = "lazy",
|
|
36
38
|
class: className,
|
|
39
|
+
...rest
|
|
37
40
|
} = Astro.props;
|
|
38
41
|
|
|
39
42
|
const builder = imageUrlBuilder({ baseUrl: config.mediaUrl });
|
|
@@ -60,4 +63,5 @@ const src2x = make().dpr(2).url();
|
|
|
60
63
|
sizes={sizes}
|
|
61
64
|
loading={loading}
|
|
62
65
|
class={className}
|
|
66
|
+
{...rest}
|
|
63
67
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettercms-ai/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|