3 <meta http-equiv="X-UA-Compatible" content="IE=Edge">
6 <title>wysihtml5 - Advanced Demo</title>
31 text-decoration: underline;
35 #toolbar [data-wysihtml5-action] {
43 -webkit-box-sizing: border-box;
44 -ms-box-sizing: border-box;
45 -moz-box-sizing: border-box;
46 box-sizing: border-box;
51 border: 2px solid green;
58 border: 2px solid black;
61 .wysihtml5-command-active {
65 [data-wysihtml5-dialog] {
68 border: 1px solid #666;
71 a[data-wysihtml5-command-value="red"] {
75 a[data-wysihtml5-command-value="green"] {
79 a[data-wysihtml5-command-value="blue"] {
84 <h1>wysihtml5 - Advanced Editor Example</h1>
86 <form class="ewrapper">
87 <div class="toolbar" style="display: none;">
88 <a data-wysihtml5-command="bold" title="CTRL+B">bold</a> |
89 <a data-wysihtml5-command="italic" title="CTRL+I">italic</a> |
90 <a data-wysihtml5-command="createLink">link</a> |
91 <a data-wysihtml5-command="removeLink"><s>link</s></a> |
92 <a data-wysihtml5-command="insertImage">insert image</a> |
93 <a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1">h1</a> |
94 <a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2">h2</a> |
95 <a data-wysihtml5-command="insertUnorderedList">insertUnorderedList</a> |
96 <a data-wysihtml5-command="insertOrderedList">insertOrderedList</a> |
97 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red">red</a> |
98 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green">green</a> |
99 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue">blue</a> |
100 <a data-wysihtml5-command="formatCode" data-wysihtml5-command-value="language-html">Code</a> |
101 <a data-wysihtml5-command="undo">undo</a> |
102 <a data-wysihtml5-command="redo">redo</a> |
103 <a data-wysihtml5-command="insertSpeech">speech</a>
104 <a data-wysihtml5-action="change_view">switch to html view</a>
106 <div data-wysihtml5-dialog="createLink" style="display: none;">
109 <input data-wysihtml5-dialog-field="href" value="http://">
111 <a data-wysihtml5-dialog-action="save">OK</a> <a data-wysihtml5-dialog-action="cancel">Cancel</a>
114 <div data-wysihtml5-dialog="insertImage" style="display: none;">
117 <input data-wysihtml5-dialog-field="src" value="http://">
121 <select data-wysihtml5-dialog-field="className">
122 <option value="">default</option>
123 <option value="wysiwyg-float-left">left</option>
124 <option value="wysiwyg-float-right">right</option>
127 <a data-wysihtml5-dialog-action="save">OK</a> <a data-wysihtml5-dialog-action="cancel">Cancel</a>
131 <textarea class="editable" placeholder="Enter text ..."></textarea>
132 <br><input type="reset" value="Reset form!">
135 <br/><br>asdasdasd:<br/>
136 <form class="ewrapper">
137 <div class="toolbar" style="display: none;">
138 <a data-wysihtml5-command="bold" title="CTRL+B">bold</a> |
139 <a data-wysihtml5-command="italic" title="CTRL+I">italic</a> |
140 <a data-wysihtml5-command="createLink">link</a> |
141 <a data-wysihtml5-command="removeLink"><s>link</s></a> |
142 <a data-wysihtml5-command="insertImage">insert image</a> |
143 <a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1">h1</a> |
144 <a data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2">h2</a> |
145 <a data-wysihtml5-command="insertUnorderedList">insertUnorderedList</a> |
146 <a data-wysihtml5-command="insertOrderedList">insertOrderedList</a> |
147 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red">red</a> |
148 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green">green</a> |
149 <a data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue">blue</a> |
150 <a data-wysihtml5-command="undo">undo</a> |
151 <a data-wysihtml5-command="redo">redo</a> |
152 <a data-wysihtml5-command="insertSpeech">speech</a>
153 <a data-wysihtml5-action="change_view">switch to html view</a>
155 <div data-wysihtml5-dialog="createLink" style="display: none;">
158 <input data-wysihtml5-dialog-field="href" value="http://">
160 <a data-wysihtml5-dialog-action="save">OK</a> <a data-wysihtml5-dialog-action="cancel">Cancel</a>
163 <div data-wysihtml5-dialog="insertImage" style="display: none;">
166 <input data-wysihtml5-dialog-field="src" value="http://">
170 <select data-wysihtml5-dialog-field="className">
171 <option value="">default</option>
172 <option value="wysiwyg-float-left">left</option>
173 <option value="wysiwyg-float-right">right</option>
176 <a data-wysihtml5-dialog-action="save">OK</a> <a data-wysihtml5-dialog-action="cancel">Cancel</a>
180 <textarea class="editable" placeholder="Enter text ..."></textarea>
181 <br><input type="reset" value="Reset form!">
187 <small>powered by <a href="https://github.com/xing/wysihtml5" target="_blank">wysihtml5</a>.</small>
189 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
191 <script src="../parser_rules/advanced_unwrap.js"></script>
192 <script src="../dist/wysihtml5x-toolbar.min.js"></script>
196 $('.ewrapper').each(function(idx, wrapper) {
197 var e = new wysihtml5.Editor($(wrapper).find('.editable').get(0), {
198 toolbar: $(wrapper).find('.toolbar').get(0),
199 parserRules: wysihtml5ParserRules,
200 stylesheets: "css/stylesheet.css"
201 //showToolbarAfterInit: false
208 var editor = new wysihtml5.Editor("textarea", {
210 stylesheets: "css/stylesheet.css",
211 parserRules: wysihtml5ParserRules
214 var log = document.getElementById("log");
217 .on("load", function() {
218 log.innerHTML += "<div>load</div>";
220 .on("focus", function() {
221 log.innerHTML += "<div>focus</div>";
223 .on("blur", function() {
224 log.innerHTML += "<div>blur</div>";
226 .on("change", function() {
227 log.innerHTML += "<div>change</div>";
229 .on("paste", function() {
230 log.innerHTML += "<div>paste</div>";
232 .on("newword:composer", function() {
233 log.innerHTML += "<div>newword:composer</div>";
235 .on("undo:composer", function() {
236 log.innerHTML += "<div>undo:composer</div>";
238 .on("redo:composer", function() {
239 log.innerHTML += "<div>redo:composer</div>";