An easy way for formatting in content editable.
Install with component(1):
$ component install lepture/format
var format = require('format')
Format to the given style.
Toggle bold style of current caret selection.
Toggle italic style of current caret selection.
Toggle strikethrough style of current caret selection.
Toggle subscript style of current caret selection.
Toggle superscript style of current caret selection.
Toggle underline style of current caret selection.
Toggle tag name p.
Toggle tag name h1.
Toggle tag name h2.
Toggle tag name h3.
Toggle tag name h4.
Toggle tag name h5.
Toggle tag name h6.
Toggle tag name blockquote.
Toggle tag name div.
Toggle tag name ol.
Toggle tag name ul.
Remove format of current caret selection.
Add tag hr.
Add tag a (link).
Add tag img (image).
Add tag br.
Insert html snippet.
Remove the selected link.
Is the given name status?
Is bold status of current caret selection?
Is italic status of current caret selection?
Is strike status of current caret selection?
Is subscript status of current caret selection?
Is superscript status of current caret selection?
Is underline status of current caret selection?
Is p tag?
Is h1 tag?
Is h2 tag?
Is h3 tag?
Is h4 tag?
Is h5 tag?
Is h6 tag?
Is blockquote tag?
Is div tag?
Is ol tag?
Is ul tag?
Is hr tag?
Is a tag?
Is img tag?
Listen on event. See component/emitter.
Listen on event. See component/emitter.
Listen off event. See component/emitter.
The default behavior of document.execCommand
is weird, we will use other
machanism to replace it in the future.
MIT