Registry / testing / prosemirror-schema-list

prosemirror-schema-list

JSON →
library1.5.1jsnpmunverified

Provides list-related schema elements (orderedList, bulletList, listItem) and commands (wrapInList, splitListItem, liftListItem, sinkListItem) for ProseMirror, a collaborative rich-text editor framework. Current stable version is 1.5.1. Released as a standalone package in the ProseMirror ecosystem, it follows semver and the same release cadence as core modules. Key differentiators: built specifically for ProseMirror's schema-based architecture, works with any node type, and supports nested lists out of the box. Unlike generic list implementations, it integrates deeply with ProseMirror's transaction system and selection handling.

npm install prosemirror-schema-list
INSTALL
IMPORT
SIG · PROSEMIRROR-SCHEMA
P
prosemirror-schema-list
testingjavascriptv1.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wrapInList
import { wrapInList } from 'prosemirror-schema-list'
const { wrapInList } = require('prosemirror-schema-list')
ESM-only since v1.0. Do not use require() unless you are transpiling.
splitListItem
import { splitListItem } from 'prosemirror-schema-list'
import splitListItem from 'prosemirror-schema-list'
splitListItem is a named export, not a default export.
orderedList
import { orderedList } from 'prosemirror-schema-list'
const orderedList = require('prosemirror-schema-list').orderedList
The schema node spec is a named export. Use ESM import for tree-shaking.
liftListItem
import { liftListItem } from 'prosemirror-schema-list'
import { liftListItem as lift } from 'prosemirror-schema-list'
Valid rename but commonly mis-imported from wrong module.
addListNodes
import { addListNodes } from 'prosemirror-schema-list'
import { addListNodes } from 'prosemirror-model'
addListNodes is a helper to combine list schema with existing schema. It is not exported from prosemirror-model.

Shows creating a ProseMirror editor with list support: add list nodes to the basic schema, then wrap a paragraph in a bullet list.

import { Schema } from 'prosemirror-model'; import { schema } from 'prosemirror-schema-basic'; import { addListNodes } from 'prosemirror-schema-list'; import { EditorState } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import { wrapInList } from 'prosemirror-schema-list'; const mySchema = new Schema({ nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'), marks: schema.spec.marks }); const state = EditorState.create({ schema: mySchema }); const view = new EditorView(document.querySelector('#editor'), { state }); // After user selects a paragraph and triggers command: // view.dispatch(wrapInList(mySchema.nodes.bulletList)(view.state.tr));
Debug
Known issues
breakingVersion 1.0.0 removed deprecated items: 'wrapInList', 'splitListItem', 'liftListItem', 'sinkListItem' are now standalone commands instead of arrays of commands.
fix
Wrap command names with the new export (e.g., wrapInList(schema.nodes.orderedList) instead of wrapInList(schema.nodes.orderedList, ...)).
affects: <1.0.0
breakingProseMirror 1.0 changed the list command signatures: wrapInList, liftListItem, etc. now take a node type as first argument, and an optional attrs as second.
fix
Update command calls: previously wrapInList('orderedList'), now wrapInList(schema.nodes.orderedList).
affects: >=1.0.0
gotchaThe list schema nodes (orderedList, bulletList) do not include a 'listItem' child by default; you must add listItem as part of the schema content expression.
fix
Ensure schema content for lists includes 'listItem+', e.g., orderedList: {content: 'listItem+', group: 'block'}.
affects: >=1.0.0
gotchasplitListItem works only if the current selection is inside a list item. Otherwise it does nothing.
fix
Check that the command is only enabled when selection is inside a list item (use custom keymap or menu).
affects: >=1.0.0
deprecatedThe 'addListNodes' helper was deprecated in favor of manually composing schema nodes. It may be removed in future versions.
fix
Manually define list nodes in your schema spec instead of using addListNodes.
affects: >=1.4.0
Errors
Common errors & fixes
TypeError: wrapInList is not a function
wrapInList was imported incorrectly (e.g., as default import) or from wrong path.
fix
Use: import { wrapInList } from 'prosemirror-schema-list'
Module not found: Error: Can't resolve 'prosemirror-schema-list'
Package not installed or import path wrong.
fix
Run: npm install prosemirror-schema-list
Uncaught Error: Schema node 'orderedList' not found
List nodes were not added to the schema (missing addListNodes or custom schema).
fix
Add list nodes using addListNodes(schema.spec.nodes, 'paragraph block*', 'block') or manually define orderedList/bulletList.
Cannot read property 'listItem' of undefined
Trying to access listItem node type before schema nodes are defined.
fix
Ensure mySchema.nodes.listItem exists; you may need to include 'listItem' in your schema nodes.
Upgrade
Version history
1.5.1latest on npm
Audit
Dependencies
prosemirror-modelrequiredProvides schema node types and schema creation
prosemirror-staterequiredProvides EditorState and transaction handling for commands
prosemirror-transformrequiredProvides ReplaceStep and other transformations used by list commands
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
prosemirror-schema-list — npm install prosemirror-schema-list · libregistry