|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 |
| - <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> |
5 |
| - <script src="http://raw.github.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js"></script> |
6 |
| - <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> |
7 |
| - <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> |
| 4 | + <link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet"> |
| 5 | + <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> |
8 | 6 | <link href="http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel="stylesheet">
|
| 7 | + |
| 8 | + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> |
| 9 | + <script src="http://raw.github.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js"></script> |
| 10 | + <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> |
| 11 | + <script src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script> |
| 12 | + |
| 13 | + <link href="bootstrap-wysiwyg.css" rel="stylesheet"> |
9 | 14 | <script src="bootstrap-wysiwyg.js"></script>
|
10 | 15 | </head>
|
11 | 16 | <body>
|
12 | 17 |
|
13 | 18 | <div class="container">
|
14 |
| - <div class="hero-unit"> |
15 |
| - <h1>bootstrap-wyswyg <small>very small wyswyg for boostrap</small></h1> |
16 |
| - <hr/> |
17 |
| - <div class="nav" data-role="toolbar" data-target="#editor"> |
18 |
| - </div> |
19 |
| - <div id="#editor"> |
20 |
| - </div> |
21 |
| - </div> |
22 |
| - |
23 |
| - <div class="row"> |
24 |
| - <div class="span6"> |
25 |
| - <h2>About</h2> |
26 |
| - <p> |
27 |
| - Tiny (5K) JQuery Bootstrap plugin to turn any DIV into a WYSIWYG rich-content editor, inspired by <a href="http://premiumsoftware.net/cleditor/">CLEditor<a> and <a href="http://jhollingworth.github.com/bootstrap-wysihtml5/">bootstrap-wysihtml5</a>. Here are the key features: |
28 |
| - <ul> |
29 |
| - <li>Bootstrap compatible and consistent with declarative data configuration</li> |
30 |
| - <li>Automatically binds standard hotkeys</li> |
31 |
| - <li>Uses standard browser features, no magic</li> |
32 |
| - <li>Does not create a separate frame, backup text areas etc - instead keeps it simple and runs everything inline in a DIV</li> |
33 |
| - <li>Requires a modern browser (HTML5 contenteditable)</li> |
34 |
| - </ul> |
35 |
| - </p> |
36 |
| - </div> |
37 |
| - <div class="span6" > |
38 |
| - <h2>Usage</h2> |
39 |
| - <pre>$('#editor').wyswyg();</pre> |
40 |
| - <p style="text-align:center; margin-top:20px"> |
| 19 | + <div class="hero-unit"> |
| 20 | + <h1>bootstrap-wyswyg <small>tiny wyswyg rich text editor for boostrap</small></h1> |
| 21 | + <hr/> |
| 22 | + <div class="btn-toolbar" data-role="editor-toolbar" data-target="#editor"> |
| 23 | + <div class="btn-group"> |
| 24 | + <a class="btn btn-large"><i class="icon-font"></i></a> |
| 25 | + <a class="btn btn-large"><i class="icon-text-height"></i></a> |
| 26 | + </div> |
| 27 | + <div class="btn-group"> |
| 28 | + <a class="btn btn-large" data-edit="bold"><i class="icon-bold"></i></a> |
| 29 | + <a class="btn btn-large" data-edit="italic"><i class="icon-italic"></i></a> |
| 30 | + <a class="btn btn-large" data-edit="strikethrough"><i class="icon-strikethrough"></i></a> |
| 31 | + <a class="btn btn-large" data-edit="underline"><i class="icon-underline"></i></a> |
| 32 | + </div> |
| 33 | + <div class="btn-group"> |
| 34 | + <a class="btn btn-large" data-edit="insertunorderedlist"><i class="icon-list-ol"></i></a> |
| 35 | + <a class="btn btn-large" data-edit="insertorderedlist"><i class="icon-list-ul"></i></a> |
| 36 | + <a class="btn btn-large" data-edit="outdent"><i class="icon-indent-left"></i></a> |
| 37 | + <a class="btn btn-large" data-edit="indent"><i class="icon-indent-right"></i></a> |
| 38 | + </div> |
| 39 | + <div class="btn-group"> |
| 40 | + <a class="btn btn-large" data-edit="undo"><i class="icon-undo"></i></a> |
| 41 | + <a class="btn btn-large" data-edit="redo"><i class="icon-repeat"></i></a> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + <div id="editor"> |
| 45 | + Go ahead... |
| 46 | + </div> |
| 47 | + </div> |
| 48 | + |
| 49 | +<div class="row"> |
| 50 | + <div class="span6"> |
| 51 | + <h2>About</h2> |
| 52 | + <p> |
| 53 | + Tiny (5K) JQuery Bootstrap plugin turns any DIV into a WYSIWYG |
| 54 | + rich-content editor, inspired by <a href="http://premiumsoftware.net/cleditor/">CLEditor</a> and |
| 55 | + <a href="http://jhollingworth.github.com/bootstrap-wysihtml5/">bootstrap-wysihtml5</a>. |
| 56 | + Here are the key features: |
| 57 | + </p> |
| 58 | + <ul> |
| 59 | + <li>Bootstrap compatible and consistent with declarative data configuration</li> |
| 60 | + <li>Allows a custom built toolbar, no magic markup generators, enabling you to use all the goodness of bootstrap, FortAwesome and so on...</li> |
| 61 | + <li>Uses standard browser features, no magic non-standard code</li> |
| 62 | + <li>Automatically binds standard hotkeys, you can customise it</li> |
| 63 | + <li>Does not force any styling - it's all up to you</li> |
| 64 | + <li>(Optionally) cleans up trailing whitespace and empty divs and spans to prevent fake updates</li> |
| 65 | + <li>Does not create a separate frame, backup text areas etc - instead keeps it simple and runs everything inline in a DIV</li> |
| 66 | + <li>Requires a modern browser, and adjusts to browser capabilties</li> |
| 67 | + </ul> |
| 68 | + <h2>Why?</h2> |
| 69 | + <p> |
| 70 | + While building a content editor for <a href="http://www.mindmup.com">MindMup</a> we found plenty of good HTML5 WYSWYG editors online, but most were duplicating |
| 71 | + functionality that already exists in JQuery and Bootstrap, was meanwhile added to HTML5 and supported in major btowsers, or doing too much magic, inserting IFrames with separate |
| 72 | + document context and mirroring textareas. This is required to work around quirks in older browsers (which we didn't need) and |
| 73 | + caused focus problems on touch devices (which was an issue for us). Too much magic caused problems with |
| 74 | + bootstrap modals (a must for us). Most good editors also build their own toolbars which turn out to be much worse than standard bootstrap buttons. So |
| 75 | + we built this tiny tiny editor that does everything we need. |
| 76 | + </p> |
| 77 | + </div> |
| 78 | + <div class="span6" > |
| 79 | + <h2>Usage</h2> |
| 80 | + <pre class="prettyprint linenums">$('#editor').wyswyg();</pre> |
| 81 | +<p>Don't forget to style your editor div:</p> |
| 82 | +<pre class="prettyprint linenums"> |
| 83 | + #editor {overflow:scroll; max-height:300px} |
| 84 | +</pre> |
| 85 | + <p>Optionally, also create a toolbar:</p> |
| 86 | +<pre class="prettyprint linenums"> |
| 87 | +<div class="btn-toolbar" data-role="editor-toolbar" |
| 88 | + data-target="#editor"> |
| 89 | + <a data-edit="...">...</a> |
| 90 | + ... |
| 91 | +</div> |
| 92 | +</pre> |
| 93 | + |
| 94 | +<p>Use standard JQuery methods to access and set content and focus. You can also ask for cleaned up HTML content:</p> |
| 95 | +<pre class="prettyprint linenums"> |
| 96 | + $('#editor').cleanHtml() |
| 97 | +</pre> |
| 98 | + <p style="text-align:center; margin-top:20px"> |
41 | 99 | <a class="btn btn-large btn-primary jumbo" href="https://github.com/mindmup/bootstrap-wysiwyg/">View project on Github</a>
|
42 |
| - </p> |
| 100 | + </p> |
43 | 101 | </div>
|
44 | 102 | </div>
|
45 | 103 | </div>
|
| 104 | +<script> |
| 105 | + $(function(){ |
| 106 | + window.prettyPrint && prettyPrint(); |
| 107 | + $('#editor').wysiwyg(); |
| 108 | + }); |
| 109 | +</script> |
46 | 110 | </html>
|
0 commit comments