@guestbell/slate-edit-blockquote
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

@guestbell/slate-edit-blockquote

npm version

A Slate plugin to handle keyboard events in blockquotes. Blockquotes can contain blocks.

Install

yarn add slate-edit-blockquote

Features

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

Simple Usage

import EditBlockquote from '@guestbell/slate-edit-blockquote'

const plugins = [
  EditBlockquote()
]

Arguments

This plugin accepts options to redefine the following block types:

  • [type: String] — type for blockquotes
  • [typeDefault: String] — type for default block in blockquote.

Utilities

slate-edit-blockquote exports utilities and changes:

utils.isSelectionInBlockquote

plugin.utils.isSelectionInBlockquote(value: Value) => Boolean

Return true if selection is inside a blockquote (and it can be unwrap).

changes.wrapInBlockquote

plugin.changes.wrapInBlockquote(change: Change) => Change

Wrap current block in a new blockquote.

changes.unwrapBlockquote

plugin.changes.unwrapBlockquote(change: Change) => Change

Unwrap from current blockquote if any.

Readme

Keywords

none

Package Sidebar

Install

npm i @guestbell/slate-edit-blockquote

Weekly Downloads

13

Version

0.3.3

License

MIT

Unpacked Size

38.1 kB

Total Files

78

Last publish

Collaborators

  • peterkottas