Compose-formatblock
A block formatting plugin for the Compose editor.
Usage
This plugin is consumed like any other Compose plugin:
var formatBlock = Compose = var editor = '#someElement'editor
By default, this plugin adds support for the following elements: H2
, H3
, and PRE
. To support a wider range of elements, pass in an array of (lowercase) tag names as a second parameter to Compose#use
:
editor
With the above configuration, all types of headings will be supported. Note: passing in a custom list of allowed elements completely replaces the default list. Since pre
was not included in the above example, PRE
elements would not be supported.
API
// This plugin exports its functionality as “format-block”:var block = editor // Check if all selected paragraphs have the given type.// If none are selected, this is vacuously true.var areAllH2 = blockstatus'h2' // Converts all selected paragraphs to the given type.// Partially selected paragraphs are also converted.// If no paragraphs are selected, calling this method does nothing.block
License
MIT.