⚠️ This repository is archived and has moved to GitBook's fork of ianstormtaylor/slate. Previous versions are still available on NPM All the versions using GitBook's fork of slate are now published under the@gitbook
NPM scope. To learn more about why we forked Slate, read our manifest
A Slate plugin to handle keyboard events in blockquotes. Blockquotes can contain blocks.
npm install slate-edit-blockquote
Natural keybindings:
- Pressing Enter in an empty block of a blockquote, exits the blockquote
- Pressing Backspace at the start of a block in a blockquote, unwraps from the blockquote
import EditBlockquote from 'slate-edit-blockquote'
const plugins = [
EditBlockquote()
]
This plugin accepts options to redefine the following block types:
[type: String]
— type for blockquotes[typeDefault: String]
— type for default block in blockquote.
slate-edit-blockquote
exports utilities and changes:
plugin.utils.isSelectionInBlockquote(value: Value) => Boolean
Return true if selection is inside a blockquote (and it can be unwrap).
plugin.changes.wrapInBlockquote(change: Change) => Change
Wrap current block in a new blockquote.
plugin.changes.unwrapBlockquote(change: Change) => Change
Unwrap from current blockquote if any.