From d57d3a1ca10b0eec2085a77370875450ad5f6255 Mon Sep 17 00:00:00 2001 From: Hyko Date: Sun, 26 Apr 2026 11:55:51 -0400 Subject: [PATCH] feat(BlockEditor): add minHeight prop to control minimum container height - accept `minHeight` as number (converted to px) or css string value - apply inline style on container when prop is defined - document new prop in README --- src/shared/components/BlockEditor/BlockEditor.client.js | 2 ++ src/shared/components/BlockEditor/README.md | 1 + 2 files changed, 3 insertions(+) diff --git a/src/shared/components/BlockEditor/BlockEditor.client.js b/src/shared/components/BlockEditor/BlockEditor.client.js index 0e28144..a42d9d6 100644 --- a/src/shared/components/BlockEditor/BlockEditor.client.js +++ b/src/shared/components/BlockEditor/BlockEditor.client.js @@ -69,6 +69,7 @@ export default function BlockEditor({ disabled = false, className = '', enabledBlocks, + minHeight, }) { const blocks = useMemo(() => ensureNonEmpty(value), [value]); const blockRefs = useRef(new Map()); @@ -1014,6 +1015,7 @@ export default function BlockEditor({ ref={containerRef} onKeyDown={handleGlobalKeyDown} onMouseDownCapture={handleContainerMouseDown} + style={minHeight != null ? { minHeight: typeof minHeight === 'number' ? `${minHeight}px` : minHeight } : undefined} className={`block-editor border rounded-xl bg-white dark:bg-neutral-900/60 px-3 py-6 ${error ? 'border-red-500/50' : 'border-neutral-300 dark:border-neutral-700/50'} ${blocks.length === 1 && inlineLength(blocks[0].content ?? []) === 0 ? 'block-editor--sole-empty' : ''} ${className}`} > diff --git a/src/shared/components/BlockEditor/README.md b/src/shared/components/BlockEditor/README.md index 524a238..53abaec 100644 --- a/src/shared/components/BlockEditor/README.md +++ b/src/shared/components/BlockEditor/README.md @@ -93,6 +93,7 @@ Tous les helpers sont **purs** : ils retournent un nouveau tableau normalisé onChange={setBlocks} // (Block[]) => void label, error, placeholder, disabled, className enabledBlocks={[...]} // optionnel : restreindre les types disponibles + minHeight={240} // optionnel : hauteur minimum du conteneur (number = px, ou string CSS ex. '12rem') /> ```