0.1.2 • Published 9 years ago

compose-formatinline v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Compose-formatinline

An inline formatting plugin for the Compose editor.

Usage

This plugin is consumed like any other Compose plugin:

var formatInline = require('compose-formatinline'),
    Compose = require('compose-editor')

var editor = new Compose('#someElement')
editor.use(formatInline)

API

This module exports its functionality on Compose as format-inline:

var inline = editor.require('format-inline')

inline.status( type )

Returns a boolean indicating whether or not the currently selected text has the given type of formatting. If type is one of bold, italic, or code, and the selection is not collapsed, this method returns true if all of the selected text has the given type of formatting. For link formatting, this method behaves a little differently; if the selection is not collapsed, it returns true if there are one or more wholly or partially selected links anywhere in the selection. If the selection is collapsed, the return value of this method indicates whether or not the next input will have the given formatting. If there is no selection, this method returns false.

inline.exec( type , href )

Applies or removes the given type of formatting. When adding link markups, an href should also be passed in. If the selection is collapsed, non-link markups will get applied over the next input; if the selection is collapsed, and the caret is in a link, that link will be removed.

License

MIT