Indent
Customize text indentation.
Indentation
Installation
npm install @udecode/plate-indent
Usage
// ...
import { createIndentPlugin } from '@udecode/plate-indent';
const plugins = [
// ...otherPlugins,
createHeadingPlugin(),
createParagraphPlugin(),
createIndentPlugin({
inject: {
props: {
validTypes: [ELEMENT_PARAGRAPH, ELEMENT_H1],
},
},
}),
];
API
createIndentPlugin
Options
- Default:
40
- Default:
'px'
The indentation offset used in (offset * element.indent) + unit
.
The indentation unit used in (offset * element.indent) + unit
.
The maximum number of indentations that can be applied to an element.
createTextIndentPlugin
indent
Indents the selected block(s) in the editor.
Parameters
The editor instance.
outdent
Decrease the indentation of the selected blocks.
Parameters
The editor instance.
setIndent
Add offset to the indentation of the selected blocks.
Parameters
The editor instance.
SetIndentOptions
Used to provide options for setting the indentation of a block of text.
State
Defines the change in indentation. A value of 1 increases the indentation (indents the block), whereas a value of -1 decreases the indentation (outdents the block). By default, the offset is set to 1.
Additional getNodes
options.
Additional setNodes
options.
A list of property names that should be unset when the indentation is 0.
API Components
useIndentButton
A behavior hook for the indent button component.
Returns
useOutdentButton
A behavior hook for the outdent button component.