commit | 33b51ab61b5064a317afddbc09240eebe07320ea | [log] [tgz] |
---|---|---|
author | Gojko Adzic <gojko@gojko.com> | Mon Apr 08 03:23:55 2013 +0100 |
committer | Gojko Adzic <gojko@gojko.com> | Mon Apr 08 03:23:55 2013 +0100 |
tree | 3b93474a0f8378c3b6f8baa515cdd4ab9df4a573 | |
parent | b7bfd3eb01d9ac36d6556afc318b1bac32454af3 [diff] |
clean up naming;
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' } });