Forced Layout
Features
- Automatically ensures the use of specified elements as required to maintain document structure (e.g., first block should be an H1 element).
- To force a trailing block of a specific type, see Trailing Block.
Installation
npm install @udecode/plate-normalizers
Usage
import { NormalizeTypesPlugin } from '@udecode/plate-normalizers';
import { TrailingBlockPlugin } from '@udecode/plate-trailing-block';
import { ParagraphPlugin } from '@udecode/plate/react';
import { HEADING_KEYS } from '@udecode/plate-heading/react';
const plugins = [
// ...otherPlugins
NormalizeTypesPlugin.configure({
options: {
rules: [{ path: [0], strictType: 'h1' }],
},
}),
];