Trailing Node extension
This extension adds a node after the last block node in the editor. This can be useful for adding a trailing node like a placeholder or a button.
Install
npm install @tiptap/extensions
Usage
import { Editor } from '@tiptap/core'
import { TrailingNode } from '@tiptap/extensions'
new Editor({
extensions: [TrailingNode],
})
Settings
node
The node type that should be inserted at the end of the document.
Default: 'paragraph'
TrailingNode.configure({
node: 'paragraph',
})
notAfter
The node types after which the trailing node should not be inserted.
Default: ['paragraph']
TrailingNode.configure({
node: 'paragraph',
notAfter: ['heading', 'blockquote'],
})
Source code
packages/extensions/src/trailing-node/
Minimal Install
import { Editor } from '@tiptap/core'
import { TrailingNode } from '@tiptap/extensions/trailing-node'
new Editor({
extensions: [TrailingNode],
})