Docs
Forced Layout

Forced Layout

Strict document structure.



Features

  • Automatically ensures the use of specified elements as required to maintain document structure (e.g., first block should be an H1 element).

Installation

npm install @udecode/plate-normalizers @udecode/plate-trailing-block

Usage

import { createNormalizeTypesPlugin } from '@udecode/plate-normalizers';
import { createTrailingBlockPlugin } from '@udecode/plate-trailing-block';
 
const plugins = [
  // ...otherPlugins
  createTrailingBlockPlugin({ options: { type: ELEMENT_PARAGRAPH } }),
  createNormalizeTypesPlugin({
    options: {
      rules: [{ path: [0], strictType: ELEMENT_H1 }],
    },
  }),
];

API

createNormalizeTypesPlugin

Attributes

Collapse all

    An array of rule objects.