@convertkit/slate-keymap
v0.1.10
Published
A Slate plugin to simplify keyboard shortcuts
Downloads
4,660
Maintainers
Keywords
Readme
Slate Keymap
A plugin for simplifying keyboard shortcuts with SlateJS. slate-keymap
uses
is-hotkey
under the hood to check if an event matches the configured keys.
Install
yarn add @convertkit/slate-keymap
Usage
Keymap(object: Object, options: Object)
Example
import Keymap from "@convertkit/slate-keymap";
const plugins = [
Keymap({
"mod+a": (event, editor) => editor.selectAll(),
// You can also pass a string and it will call the command with that name
"shift+enter": "softBreak"
})
];
Options
if
: A function that is passed theeditor
instance. If it returns true, then the Keymap is active. Defaults to() => true