@types/prosemirror-keymap

  • Version 1.0.4
  • Published
  • 6.19 kB
  • 4 dependencies
  • MIT license

Install

npm i @types/prosemirror-keymap
yarn add @types/prosemirror-keymap
pnpm add @types/prosemirror-keymap

Overview

TypeScript definitions for prosemirror-keymap

Index

Functions

function keydownHandler

keydownHandler: <S extends Schema = any>(
bindings: Keymap<S>
) => (view: EditorView, event: KeyboardEvent) => boolean;
  • Given a set of bindings (using the same format as [keymap](#keymap.keymap), return a [keydown handler](#view.EditorProps.handleKeyDown) handles them.

function keymap

keymap: <S extends Schema = any>(bindings: Keymap<S>) => Plugin;
  • Create a keymap plugin for the given set of bindings.

    Bindings should map key names to [command](#commands)-style functions, which will be called with `(EditorState, dispatch, EditorView)` arguments, and should return true when they've handled the key. Note that the view argument isn't part of the command protocol, but can be used as an escape hatch if a binding needs to directly interact with the UI.

    Key names may be strings like "Shift-Ctrl-Enter"—a key identifier prefixed with zero or more modifiers. Key identifiers are based on the strings that can appear in [KeyEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key). Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held). You may use "Space" as an alias for the " " name.

    Modifiers can be given in any order. Shift- (or s-), Alt- (or a-), Ctrl- (or c- or Control-) and Cmd- (or m- or Meta-) are recognized. For characters that are created by holding shift, the Shift- prefix is implied, and should not be added explicitly.

    You can use Mod- as a shorthand for Cmd- on Mac and Ctrl- on other platforms.

    You can add multiple keymap plugins to an editor. The order in which they appear determines their precedence (the ones early in the array get to dispatch first).

Package Files (1)

Dependencies (4)

Dev Dependencies (0)

No dev dependencies.

Peer Dependencies (0)

No peer dependencies.

Badge

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/@types/prosemirror-keymap.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/prosemirror-keymap)
  • HTML
    <a href="https://www.jsdocs.io/package/@types/prosemirror-keymap"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>