html-editor.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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>Simple HTML Editor</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. <a class="btn btn-default" data-edit="html" title="Clear Formatting"><i class='glyphicon glyphicon-pencil'></i></a>
  61. </div>
  62. </div>
  63. <div id="editor" class="lead" data-placeholder="This is a basic example with a simple toolbar."></div>
  64. <div id="editorPreview"></div>
  65. <p style="text-align: center;">
  66. <a class="btn btn-large btn-default jumbo" href="#!" onClick="$('#editorPreview').html($('#editor').cleanHtml());">Submit</a>
  67. </p>
  68. </div>
  69. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  70. <script src="../bower_components/jquery.hotkeys/jquery.hotkeys.js"></script>
  71. <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  72. <script src="../bower_components/google-code-prettify/src/prettify.js"></script>
  73. <script src="../src/bootstrap-wysiwyg.js"></script>
  74. <script type='text/javascript'>
  75. $('#editor').wysiwyg();
  76. $(".dropdown-menu > input").click(function (e) {
  77. e.stopPropagation();
  78. });
  79. </script>
  80. </body>
  81. </html>