prosemirror-trailing-node
v3.0.0
Published
A trailing node plugin for the prosemirror editor.
Downloads
4,782,989
Readme
prosemirror-trailing-node
"A trailing node plugin for the prosemirror editor.
The problem
You want your editor to always have allow exiting the current non-empty node.
This solution
prosemirror-trailing-node
allows you to set a default node that will be appended to the end of the document.
Installation
# yarn
yarn add prosemirror-trailing-node prosemirror-view prosemirror-state prosemirror-keymap
# pnpm
pnpm add prosemirror-trailing-node prosemirror-view prosemirror-state prosemirror-keymap
# npm
npm install prosemirror-trailing-node prosemirror-view prosemirror-state prosemirror-keymap
The installation requires the installation of the peer dependencies prosemirror-view
, prosemirror-state
and prosemirror-model
to avoid version clashes.
Getting Started
import { schema } from 'prosemirror-schema-basic';
import { trailingNode } from 'prosemirror-trailing-node';
// Include the plugin in the created editor state.
const state = EditorState.create({
schema,
plugins: [trailingNode({ ignoredNodes: [], nodeName: 'paragraph' })],
});