Trailing Node extension

VersionDownloads

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. When you leave it unset, Trailing Node asks the ProseMirror schema for whatever fallback node it defines (usually the default block node), but you can override that behavior with the node option. This is particularly relevant when you define a custom document structure - see the Forced content structure example for how custom documents may affect the assumed fallback node.

Default: undefined

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],
})