1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <script src="http://cdn.ckeditor.com/4.5.9/standard/ckeditor.js"></script> |
---|
5 | </head> |
---|
6 | <body> |
---|
7 | <p> |
---|
8 | <textarea cols="80" id="editor1" name="editor1" rows="10"></textarea> |
---|
9 | </p> |
---|
10 | |
---|
11 | <p> |
---|
12 | Content typed above will populate in the below div via the "change" event. However copying and pasting content into CKEditor will cause the very first character to fail to appear. |
---|
13 | </p> |
---|
14 | |
---|
15 | <div id="target" style="border-width:5px; border-style:dashed; min-height: 200px; border-color: #CCC; padding: 25px;"></div> |
---|
16 | |
---|
17 | <script> |
---|
18 | var ck_instance = CKEDITOR.replace('editor1', {}); |
---|
19 | |
---|
20 | ck_instance.on('change', function() { |
---|
21 | console.log('fired'); |
---|
22 | document.getElementById('target').innerHTML = ck_instance.getData(); |
---|
23 | }); |
---|
24 | </script> |
---|
25 | </body> |
---|
26 | </html> |
---|