commit | 8bf70ddaff689ae151f8eafcf1c2b4706193d869 | [log] [tgz] |
---|---|---|
author | Gojko Adzic <gojko@gojko.com> | Mon Apr 08 03:50:10 2013 +0100 |
committer | Gojko Adzic <gojko@gojko.com> | Mon Apr 08 03:50:10 2013 +0100 |
tree | 418115e605da72ee07b243932f7fa6b1a241ecdc | |
parent | b5abe176707db453ffac6ede974db9d3e22f8cd2 [diff] |
mark selection cleanup
Tiny bootstrap-compatible WISWYG rich text editor, based on browser execCommand, built originally for MindMup. Here are the key features:
See http://mindmup.github.com/bootstrap-wysiwyg/
You can assign commands to hotkeys and toolbar links. For a toolbar link, just put the execCommand command name into a data-edit attribute. For more info on execCommand, see http://www.quirksmode.org/dom/execCommand.html and https://developer.mozilla.org/en/docs/Rich-Text_Editing_in_Mozilla
<div class="btn-toolbar" data-role="editor-toolbar" data-target="#editor"> <a class="btn btn-large" data-edit="bold"><i class="icon-bold"></i></a> </div>
To pass arguments to a command, separate a command with a space.
<a data-edit="fontName Arial">...</a>
You can also use input type='text' with a data-edit attribute. When the value is changed, the command from the data-edit attribute will be applied using the input value as the command argument
<input type="text" data-edit="createLink">
If the input type is file, when a file is selected the contents will be read in using the FileReader API and the data URL will be used as the argument
<input type="file" data-edit="insertImage">
To change hotkeys, specify the map of hotkeys to commands in the hotKeys option. For example:
$('#editor').wysiwyg({ hotKeys: { 'ctrl+b meta+b': 'bold', 'ctrl+i meta+i': 'italic', 'ctrl+u meta+u': 'underline', 'ctrl+z meta+z': 'undo', 'ctrl+y meta+y meta+shift+z': 'redo' } });