Every extension
indent
Block indentation, the way a word processor does it.
An attribute on the block rather than a wrapper node: Tab on a paragraph moves the paragraph in, Shift-Tab moves it back out, and the document says `indent: 2` rather than nesting the paragraph inside something invented to hold it. Inside a list the keys belong to the list, so this stands down there.
Adding it
import { createEditor, document, paragraph, text, indent } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, indent({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · indent is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Options
| Field | Type | |
|---|---|---|
types | readonly string[] | Which blocks can be indented. Default paragraphs and headings. |
max | number | How many levels. Default 8. |
step | number | Width of one level, in `em`. Default 2. |
Commands
-
editor.commands.indent() -
editor.commands.outdent() -
editor.commands.setIndent()
Keys
- Tab ·
indent - Shift-Tab ·
outdent