Every extension
trailingNode
Always a paragraph at the end of the document.
A document that ends in a table, an image or a code block has nowhere to put a caret after it, and the only way to write below it is to know the trick. So whenever the last block is anything else, an empty paragraph is added after it — its own transaction, grouped by undo with whatever caused it.
Adding it
import { createEditor, document, paragraph, text, trailingNode } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, trailingNode({ … })],
element: document.querySelector('#editor'),
})
There is no separate package · trailingNode 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 | |
|---|---|---|
node | string | The node kept at the end. Default `paragraph`. |