diff --git a/plugins/carhop-blocks/src/content-box/block.json b/plugins/carhop-blocks/src/content-box/block.json
index 6654b0f..738d502 100644
--- a/plugins/carhop-blocks/src/content-box/block.json
+++ b/plugins/carhop-blocks/src/content-box/block.json
@@ -37,6 +37,14 @@
"blockVariant": {
"type": "string",
"default": "framed"
+ },
+ "blockWidth": {
+ "type": "string",
+ "default": "full",
+ "enum": [
+ "full",
+ "contained"
+ ]
}
}
}
\ No newline at end of file
diff --git a/plugins/carhop-blocks/src/content-box/edit.js b/plugins/carhop-blocks/src/content-box/edit.js
index f6062ca..d429505 100644
--- a/plugins/carhop-blocks/src/content-box/edit.js
+++ b/plugins/carhop-blocks/src/content-box/edit.js
@@ -37,6 +37,7 @@ export default function Edit({ attributes, setAttributes, ...props }) {
textColor,
hasLightBackground,
blockVariant,
+ blockWidth,
} = attributes;
// Détecter le type de post actuel
@@ -77,6 +78,11 @@ export default function Edit({ attributes, setAttributes, ...props }) {
}
function onBlockVariantChange(value) {
setAttributes({ blockVariant: value });
+
+ if (value === "framed" || value === "nude") {
+ setAttributes({ backgroundColor: "#fff" });
+ setAttributes({ hasLightBackground: true });
+ }
}
return (
<>
@@ -90,12 +96,24 @@ export default function Edit({ attributes, setAttributes, ...props }) {
__nextHasNoMarginBottom
__next40pxDefaultSize
>
+
+ setAttributes({ blockWidth: value })}
+ isBlock
+ __nextHasNoMarginBottom
+ __next40pxDefaultSize
+ >
+
+
+
{blockVariant === "backgrounded" && (
@@ -138,7 +156,8 @@ export default function Edit({ attributes, setAttributes, ...props }) {
hasLightBackground
? "content-box--bg-light"
: "content-box--bg-dark"
- }`,
+ }
+ ${blockWidth === "contained" ? "alignwide" : "alignfull"}`,
style: {
"--content-box-text-color": textColor ?? "inherit",
"--content-box-background-color":
diff --git a/plugins/carhop-blocks/src/content-box/save.js b/plugins/carhop-blocks/src/content-box/save.js
index 15b053f..1b01e75 100644
--- a/plugins/carhop-blocks/src/content-box/save.js
+++ b/plugins/carhop-blocks/src/content-box/save.js
@@ -8,13 +8,15 @@ export default function save({ attributes }) {
hasLightBackground,
hasBackgroundColor,
blockVariant,
+ blockWidth,
} = attributes;
return (