formatblock-example.html 5.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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="format-pre" title="Preformatted text">pre</a>
  40. <a class="btn btn-default" data-edit="format-address" title="Address (Contact Information)">address</a>
  41. <a class="btn btn-default" data-edit="format-h1">h1</a>
  42. <a class="btn btn-default" data-edit="format-h2">h2</a>
  43. <a class="btn btn-default" data-edit="format-h3">h3</a>
  44. <a class="btn btn-default" data-edit="format-h4">h4</a>
  45. <a class="btn btn-default" data-edit="format-h5">h5</a>
  46. <a class="btn btn-default" data-edit="format-p" title="Paragraph"><i class="fa fa-paragraph"></i></a>
  47. <a class="btn btn-default" data-edit="format-blockquote">block</a>
  48. <a class="btn btn-default" data-edit="format-div">div</a>
  49. </div>
  50. <div class="btn-group">
  51. <a class="btn btn-default" data-edit="justifyleft" title="Align Left (Ctrl/Cmd+L)"><i class="fa fa-align-left"></i></a>
  52. <a class="btn btn-default" data-edit="justifycenter" title="Center (Ctrl/Cmd+E)"><i class="fa fa-align-center"></i></a>
  53. <a class="btn btn-default" data-edit="justifyright" title="Align Right (Ctrl/Cmd+R)"><i class="fa fa-align-right"></i></a>
  54. <a class="btn btn-default" data-edit="justifyfull" title="Justify (Ctrl/Cmd+J)"><i class="fa fa-align-justify"></i></a>
  55. </div>
  56. <div class="btn-group">
  57. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Hyperlink"><i class="fa fa-link"></i></a>
  58. <div class="dropdown-menu input-append">
  59. <input placeholder="URL" type="text" data-edit="createLink" />
  60. <button class="btn" type="button">Add</button>
  61. </div>
  62. </div>
  63. <div class="btn-group">
  64. <a class="btn btn-default" data-edit="unlink" title="Remove Hyperlink"><i class="fa fa-unlink"></i></a>
  65. <span class="btn btn-default" title="Insert picture (or just drag & drop)" id="pictureBtn"> <i class="fa fa-picture-o"></i>
  66. <input class="imgUpload" type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" />
  67. </span>
  68. </div>
  69. <div class="btn-group">
  70. <a class="btn btn-default" data-edit="undo" title="Undo (Ctrl/Cmd+Z)"><i class="fa fa-undo"></i></a>
  71. <a class="btn btn-default" data-edit="redo" title="Redo (Ctrl/Cmd+Y)"><i class="fa fa-repeat"></i></a>
  72. <a class="btn btn-default" data-edit="html" title="Clear Formatting"><i class='glyphicon glyphicon-pencil'></i></a>
  73. </div>
  74. </div>
  75. <div id="editor" class="lead" data-placeholder="This is a basic example with a simple toolbar."></div>
  76. <div id="editorPreview"></div>
  77. <p style="text-align: center;">
  78. <a class="btn btn-large btn-default jumbo" href="#!" onClick="$('#editorPreview').html($('#editor').html());">Submit</a>
  79. </p>
  80. </div>
  81. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  82. <script src="../bower_components/jquery.hotkeys/jquery.hotkeys.js"></script>
  83. <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  84. <script src="../bower_components/google-code-prettify/src/prettify.js"></script>
  85. <script src="../src/bootstrap-wysiwyg.js"></script>
  86. <script type='text/javascript'>
  87. $('#editor').wysiwyg();
  88. $(".dropdown-menu > input").click(function (e) {
  89. e.stopPropagation();
  90. });
  91. </script>
  92. </body>
  93. </html>