• Version 1.0.16
  • Published
  • 74.3 kB
  • 31 dependencies
  • MIT license


npm i @remirror/pm
yarn add @remirror/pm
pnpm add @remirror/pm


A bundled library containing all the core prosemirror libraries required for using remirror



function chainableEditorState

chainableEditorState: <Schema extends any = any>(
tr: Transaction<Schema>,
state: EditorState<Schema>
) => EditorState<Schema>;
  • Creates a fake state that can be used on ProseMirror library commands to make them chainable. The provided Transaction tr can be a shared one.

    Parameter tr

    the chainable transaction that should be amended.

    Parameter state

    the state of the editor (available via view.state).

    This should not be used other than for passing to prosemirror-* library commands.

function chainCommands

chainCommands: <Schema extends any = any, Extra extends object = object>(
...commands: Array<CommandFunction<Schema, Extra>>
) => CommandFunction<Schema, Extra>;
  • Similar to the chainCommands from the prosemirror-commands library. Allows multiple commands to be chained together and runs until one of them returns true.

function convertCommand

convertCommand: <Schema extends any = any, Extra extends object = object>(
commandFunction: ProsemirrorCommandFunction<Schema>
) => CommandFunction<Schema, Extra>;
  • Wraps the default [[ProsemirrorCommandFunction]] and makes it compatible with the default **remirror** [[CommandFunction]] call signature.

    It extracts all the public APIs of the state object and assigns the chainable transaction to the state.tr property to support chaining.

function nonChainable

nonChainable: <Schema extends any = any, Extra extends object = object>(
commandFunction: CommandFunction<Schema, Extra>
) => NonChainableCommandFunction<Schema, Extra>;
  • Marks a command function as non chainable. It will throw an error when chaining is attempted.


    const command = nonChainable(({ state, dispatch }) => {...});


interface CommandFunctionProps

interface CommandFunctionProps<Schema extends EditorSchema = EditorSchema> {}
  • A parameter builder interface for the remirror CommandFunction.

    Schema - the underlying editor schema.

property dispatch

dispatch?: DispatchFunction<Schema>;
  • The dispatch function which causes the command to be performed.


    dispatch can be undefined. When no dispatch callback is provided the command should perform a 'dry run', determining whether the command is applicable (return true), but not actually performing the action.

property state

state: EditorState<Schema>;
  • A snapshot of the ProseMirror editor state.

property tr

tr: Transaction<Schema>;
  • The shared ProseMirror Transaction.

property view

view?: EditorView<Schema>;
  • An instance of the ProseMirror editor view.

Type Aliases

type CommandFunction

type CommandFunction<
Schema extends EditorSchema = EditorSchema,
ExtraProps extends object = object
> = (params: CommandFunctionProps<Schema> & ExtraProps) => boolean;
  • A command method for running commands in your editor.

    Schema - the underlying editor schema. ExtraProps - extra parameters to add to the command function.


    This groups all the prosemirror command arguments into a single parameter.

    tldr; When dispatch=undefined make sure the command function is **idempotent**.

    One thing to be aware of is that when creating a command function the tr should only be updated when the dispatch method is available. This is because by convention calling the command function with dispatch=undefined is used to check if the function returns true, an indicator that it is enabled, or returns false to indicate it is not enabled.

    If the transaction has been updated outside of the dispatch=true condition then running the command again will result in multiple transaction updates and unpredictable behavior.

    See Also

type Decoration

type Decoration = import('../view').Decoration;

    type DecorationSet

    type DecorationSet<Schema extends EditorSchema = EditorSchema> =

      type DispatchFunction

      type DispatchFunction<Schema extends EditorSchema = EditorSchema> = (
      tr: Transaction<Schema>
      ) => void;
      • Used to apply the Prosemirror transaction to the current EditorState.

        Schema - the underlying editor schema.

      type EditorSchema

      type EditorSchema<
      Nodes extends string = string,
      Marks extends string = string
      > = import('../model').Schema<Nodes, Marks>;

        type EditorState

        type EditorState<Schema extends EditorSchema = EditorSchema> = Readonly<

          type EditorView

          type EditorView<Schema extends EditorSchema = EditorSchema> =

            type Fragment

            type Fragment<Schema extends EditorSchema = EditorSchema> =

              type InputRule

              type InputRule<Schema extends EditorSchema = EditorSchema> =

                type Mapping

                type Mapping = import('../transform').Mapping;

                  type Mark

                  type Mark<Schema extends EditorSchema = EditorSchema> =

                    type MarkType

                    type MarkType<Schema extends EditorSchema = EditorSchema> =

                      type NodeType

                      type NodeType<Schema extends EditorSchema = EditorSchema> =

                        type NodeView

                        type NodeView<Schema extends EditorSchema = EditorSchema> =

                          type NonChainableCommandFunction

                          type NonChainableCommandFunction<
                          Schema extends EditorSchema = EditorSchema,
                          Extra extends object = object
                          > = Brand<CommandFunction<Schema, Extra>, 'non-chainable'>;
                          • Brands a command as non chainable so that it can be excluded from the inferred chainable commands.

                          type PluginKey

                          type PluginKey<PluginState = EditorSchema> = import('../state').PluginKey<

                            type ProsemirrorCommandFunction

                            type ProsemirrorCommandFunction<Schema extends EditorSchema = EditorSchema> = (
                            state: EditorState<Schema>,
                            dispatch: DispatchFunction<Schema> | undefined,
                            view: EditorView<Schema> | undefined
                            ) => boolean;
                            • This is the type signature for commands within the prosemirror editor.


                              A command function takes an editor state and optionally a dispatch function that it can use to dispatch a transaction. It should return a boolean that indicates whether it could perform any action.

                              When no dispatch callback is passed, the command should do a 'dry run', determining whether it is applicable, but not actually performing any action.

                              Schema - the underlying editor schema.

                            type ProsemirrorNode

                            type ProsemirrorNode<Schema extends EditorSchema = EditorSchema> =

                              type ProsemirrorPlugin

                              type ProsemirrorPlugin<PluginState = any> = import('../state').Plugin<

                                type ResolvedPos

                                type ResolvedPos<Schema extends EditorSchema = EditorSchema> =

                                  type Selection

                                  type Selection<Schema extends EditorSchema = EditorSchema> =

                                    type Slice

                                    type Slice<Schema extends EditorSchema = EditorSchema> =

                                      type Transaction

                                      type Transaction<Schema extends EditorSchema = EditorSchema> =

                                        Package Files (3)

                                        Dependencies (31)

                                        Dev Dependencies (0)

                                        No dev dependencies.

                                        Peer Dependencies (0)

                                        No peer dependencies.


                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@remirror/pm.

                                        • Markdown
                                        • HTML
                                          <a href="https://www.jsdocs.io/package/@remirror/pm"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>