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
This commit is contained in:
@@ -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}`}
|
||||
>
|
||||
<BlockEditorStyles />
|
||||
|
||||
@@ -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')
|
||||
/>
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user