@domternal/pm
v1.8.0
Published
ProseMirror package re-exports for Domternal
Readme
@domternal/pm
Shared ProseMirror dependencies for Domternal. Each
@domternal/pm/* subpath re-exports the corresponding prosemirror-* package,
including its TypeScript types. Domternal packages use these entry points to share
the same ProseMirror classes and plugins.
Install
@domternal/core already depends on this package. Add it directly when your own
code imports from @domternal/pm/*, or when an extension's peer dependencies
require it:
pnpm add @domternal/pmThe package declares Node.js 22 or later for tooling and has no peer dependencies.
Use version 1.8.0 for all installed Domternal Free packages. Free 1.8.x extensions
require @domternal/core and @domternal/pm peers in >=1.8.0 <2.0.0.
Core 1.8.0 requires PM >=1.8.0 <2.0.0 at runtime.
Usage
Always import a subpath. There is no @domternal/pm root export.
import { Plugin, PluginKey } from '@domternal/pm/state';
export const documentChangeLogger = new Plugin({
key: new PluginKey('documentChangeLogger'),
view: () => ({
update(view, previousState) {
if (!view.state.doc.eq(previousState.doc)) {
console.log(view.state.doc.toJSON());
}
},
}),
});Register a plugin through an extension's addProseMirrorPlugins() hook or
editor.registerPlugin(). See custom extensions
and dynamic plugins.
Entry points
Every subpath supports ESM, CommonJS, and TypeScript:
| Import | Re-exports |
| --- | --- |
| @domternal/pm/commands | prosemirror-commands |
| @domternal/pm/dropcursor | prosemirror-dropcursor |
| @domternal/pm/gapcursor | prosemirror-gapcursor |
| @domternal/pm/history | prosemirror-history |
| @domternal/pm/inputrules | prosemirror-inputrules |
| @domternal/pm/keymap | prosemirror-keymap |
| @domternal/pm/model | prosemirror-model |
| @domternal/pm/schema-list | prosemirror-schema-list |
| @domternal/pm/state | prosemirror-state |
| @domternal/pm/tables | prosemirror-tables |
| @domternal/pm/transform | prosemirror-transform |
| @domternal/pm/view | prosemirror-view |
Avoid duplicate ProseMirror copies
ProseMirror compares objects by identity. Loading two copies can cause fragment
conversion errors, keyed-plugin collisions, and broken selections. Prefer these
subpaths over direct prosemirror-* imports in code that interacts with Domternal.
Other dependencies and linked workspaces can still introduce duplicates. The single-copy guide explains runtime diagnostics and the package-manager and bundler fixes, including collaboration integrations.
