events.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>A tiny, opensource, Bootstrap WYSIWYG rich text editor</title>
  8. <link href="../bower_components/google-code-prettify/src/prettify.css" rel="stylesheet" />
  9. <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
  10. <link href="http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css" rel="stylesheet" />
  11. <link href="../css/style.css" rel="stylesheet" />
  12. </head>
  13. <body>
  14. <div class="container">
  15. <h1>Type something to see events</h1>
  16. <div class="btn-toolbar" data-role="editor-toolbar"
  17. data-target="#editor">
  18. <div class="btn-group">
  19. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Font Size"><i class="fa fa-text-height"></i>&nbsp;<b class="caret"></b></a>
  20. <ul class="dropdown-menu">
  21. <li><a data-edit="fontSize 5" class="fs-Five">Huge</a></li>
  22. <li><a data-edit="fontSize 3" class="fs-Three">Normal</a></li>
  23. <li><a data-edit="fontSize 1" class="fs-One">Small</a></li>
  24. </ul>
  25. </div>
  26. <div class="btn-group">
  27. <a class="btn btn-default" data-edit="bold" title="Bold (Ctrl/Cmd+B)"><i class="fa fa-bold"></i></a>
  28. <a class="btn btn-default" data-edit="italic" title="Italic (Ctrl/Cmd+I)"><i class="fa fa-italic"></i></a>
  29. <a class="btn btn-default" data-edit="strikethrough" title="Strikethrough"><i class="fa fa-strikethrough"></i></a>
  30. <a class="btn btn-default" data-edit="underline" title="Underline (Ctrl/Cmd+U)"><i class="fa fa-underline"></i></a>
  31. </div>
  32. <div class="btn-group">
  33. <a class="btn btn-default" data-edit="insertunorderedlist" title="Bullet list"><i class="fa fa-list-ul"></i></a>
  34. <a class="btn btn-default" data-edit="insertorderedlist" title="Number list"><i class="fa fa-list-ol"></i></a>
  35. <a class="btn btn-default" data-edit="outdent" title="Reduce indent (Shift+Tab)"><i class="fa fa-outdent"></i></a>
  36. <a class="btn btn-default" data-edit="indent" title="Indent (Tab)"><i class="fa fa-indent"></i></a>
  37. </div>
  38. <div class="btn-group">
  39. <a class="btn btn-default" data-edit="justifyleft" title="Align Left (Ctrl/Cmd+L)"><i class="fa fa-align-left"></i></a>
  40. <a class="btn btn-default" data-edit="justifycenter" title="Center (Ctrl/Cmd+E)"><i class="fa fa-align-center"></i></a>
  41. <a class="btn btn-default" data-edit="justifyright" title="Align Right (Ctrl/Cmd+R)"><i class="fa fa-align-right"></i></a>
  42. <a class="btn btn-default" data-edit="justifyfull" title="Justify (Ctrl/Cmd+J)"><i class="fa fa-align-justify"></i></a>
  43. </div>
  44. <div class="btn-group">
  45. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Hyperlink"><i class="fa fa-link"></i></a>
  46. <div class="dropdown-menu input-append">
  47. <input placeholder="URL" type="text" data-edit="createLink" />
  48. <button class="btn" type="button">Add</button>
  49. </div>
  50. </div>
  51. <div class="btn-group">
  52. <a class="btn btn-default" data-edit="unlink" title="Remove Hyperlink"><i class="fa fa-unlink"></i></a>
  53. <span class="btn btn-default" title="Insert picture (or just drag & drop)" id="pictureBtn"> <i class="fa fa-picture-o"></i>
  54. <input class="imgUpload" type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" />
  55. </span>
  56. </div>
  57. <div class="btn-group">
  58. <a class="btn btn-default" data-edit="undo" title="Undo (Ctrl/Cmd+Z)"><i class="fa fa-undo"></i></a>
  59. <a class="btn btn-default" data-edit="redo" title="Redo (Ctrl/Cmd+Y)"><i class="fa fa-repeat"></i></a>
  60. </div>
  61. </div>
  62. <div id="editor" class="lead" data-placeholder="This is a basic example with no toolbars."></div>
  63. <h2>Live Preview</h2>
  64. <div id="editorPreview"></div>
  65. <h2>Events fired:</h2>
  66. <p id="events_log"></p>
  67. </div>
  68. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  69. <script src="../bower_components/jquery.hotkeys/jquery.hotkeys.js"></script>
  70. <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  71. <script src="../bower_components/google-code-prettify/src/prettify.js"></script>
  72. <script src="../src/bootstrap-wysiwyg.js"></script>
  73. <script type='text/javascript'>
  74. $('#editor').wysiwyg().on('change', function()
  75. {
  76. $('#editorPreview').html($(this).cleanHtml());
  77. $('#events_log').append(' change');
  78. });
  79. $(".dropdown-menu > input").click(function (e) {
  80. e.stopPropagation();
  81. });
  82. </script>
  83. </body>
  84. </html>