@wikifactory/slate-edit-blockquote

0.7.1 • Public • Published

@wikifactory/slate-edit-blockquote

NPM version Linux Build Status

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

Install

npm install @wikifactory/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 '@wikifactory/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

@wikifactory/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(editor: Editor) => Editor

Wrap current block in a new blockquote.

changes.unwrapBlockquote

plugin.changes.unwrapBlockquote(editor: Editor) => Editor

Unwrap from current blockquote if any.

Readme

Keywords

Package Sidebar

Install

npm i @wikifactory/slate-edit-blockquote

Weekly Downloads

1,391

Version

0.7.1

License

Apache-2.0

Unpacked Size

28.7 kB

Total Files

19

Last publish

Collaborators

  • drewler
  • salfield