{"library":"prosemirror-trailing-node","title":"ProseMirror Trailing Node Plugin","description":"prosemirror-trailing-node is a plugin for the ProseMirror rich text editor that ensures there's always an editable node at the end of the document. This is particularly useful for preventing users from getting stuck within non-editable or complex nodes, allowing for continuous input. It automatically appends a configurable default node, such as a paragraph, when the last node in the document is not empty. The current stable version is 3.0.0, aligning with the major version 3 of the Remirror ecosystem, of which it is a part. Remirror, and by extension its associated plugins like this one, maintains an active release cadence with frequent patch updates to address issues and align with ProseMirror core updates, as seen in recent changelogs. Its key differentiator is its simple, focused solution for a common ProseMirror UX problem, integrated within a broader, actively developed framework.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install prosemirror-trailing-node"],"cli":null},"imports":["import { trailingNode } from 'prosemirror-trailing-node';","import type { TrailingNodeOptions } from 'prosemirror-trailing-node';","import { EditorState } from 'prosemirror-state';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { schema } from 'prosemirror-schema-basic';\nimport { EditorState } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { trailingNode } from 'prosemirror-trailing-node';\n\nconst editorSchema = schema;\n\n// Initialize the editor state with the trailingNode plugin.\nconst state = EditorState.create({\n  schema: editorSchema,\n  plugins: [\n    trailingNode({\n      ignoredNodes: ['code_block'], // Example: don't add trailing node after code blocks\n      nodeName: 'paragraph' // The node type to append\n    })\n  ]\n});\n\n// Create the editor view and mount it to the DOM.\nconst view = new EditorView(document.body, { \n  state,\n  dispatchTransaction(transaction) {\n    const newState = view.state.apply(transaction);\n    view.updateState(newState);\n  }\n});\n\nconsole.log('ProseMirror editor with trailing node plugin initialized.');","lang":"typescript","description":"This quickstart demonstrates how to initialize a basic ProseMirror editor with the `prosemirror-trailing-node` plugin, configuring it to append a paragraph node and ignore specific node types. It sets up the editor state and view, making it runnable in a browser environment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}