multiple-editors.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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>Multiple Editors with Toolbars</h1>
  16. <hr>
  17. <br />
  18. <h3>First Editor</h3>
  19. <div class="btn-toolbar" data-role="editor-toolbar" data-target="#first-editor">
  20. <div class="btn-group">
  21. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
  22. title="Font"><i class="fa fa-font"></i><b class="caret"></b>
  23. </a>
  24. <ul class="dropdown-menu">
  25. </ul>
  26. </div>
  27. <div class="btn-group">
  28. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
  29. title="Font Size"><i class="fa fa-text-height"></i>&nbsp;<b
  30. class="caret"></b>
  31. </a>
  32. <ul class="dropdown-menu">
  33. <li><a data-edit="fontSize 5" class="fs-Five">Huge</a></li>
  34. <li><a data-edit="fontSize 3" class="fs-Three">Normal</a></li>
  35. <li><a data-edit="fontSize 1" class="fs-One">Small</a></li>
  36. </ul>
  37. </div>
  38. <div class="btn-group">
  39. <a class="btn btn-default" data-edit="bold" title="Bold (Ctrl/Cmd+B)"><i class="fa fa-bold"></i></a>
  40. <a class="btn btn-default" data-edit="italic" title="Italic (Ctrl/Cmd+I)"><i class="fa fa-italic"></i></a>
  41. <a class="btn btn-default" data-edit="strikethrough" title="Strikethrough"><i class="fa fa-strikethrough"></i></a>
  42. <a class="btn btn-default" data-edit="underline" title="Underline (Ctrl/Cmd+U)"><i class="fa fa-underline"></i></a>
  43. </div>
  44. <div class="btn-group">
  45. <a class="btn btn-default" data-edit="insertunorderedlist" title="Bullet list"><i class="fa fa-list-ul"></i></a>
  46. <a class="btn btn-default" data-edit="insertorderedlist" title="Number list"><i class="fa fa-list-ol"></i></a>
  47. <a class="btn btn-default" data-edit="outdent" title="Reduce indent (Shift+Tab)"><i class="fa fa-outdent"></i></a>
  48. <a class="btn btn-default" data-edit="indent" title="Indent (Tab)"><i class="fa fa-indent"></i></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="picBtn"> <i class="fa fa-picture-o"></i>
  66. <input class="imgUpload" type="file" data-role="magic-overlay" data-target="#picBtn" 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. </div>
  73. <input class="pull-right voiceBtn" type="text" data-edit="inserttext" />
  74. </div>
  75. <div id="first-editor" class="lead" data-placeholder="This is a basic example with a simple toolbar."></div>
  76. <div class="editorPreview"></div>
  77. <br />
  78. <h3>Second Editor</h3>
  79. <div class="btn-toolbar" data-role="editor-toolbar" data-target="#second-editor">
  80. <div class="btn-group">
  81. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
  82. title="Font"><i class="fa fa-font"></i><b class="caret"></b>
  83. </a>
  84. <ul class="dropdown-menu">
  85. </ul>
  86. </div>
  87. <div class="btn-group">
  88. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
  89. title="Font Size"><i class="fa fa-text-height"></i>&nbsp;<b
  90. class="caret"></b>
  91. </a>
  92. <ul class="dropdown-menu">
  93. <li><a data-edit="fontSize 5" class="fs-Five">Huge</a></li>
  94. <li><a data-edit="fontSize 3" class="fs-Three">Normal</a></li>
  95. <li><a data-edit="fontSize 1" class="fs-One">Small</a></li>
  96. </ul>
  97. </div>
  98. <div class="btn-group">
  99. <a class="btn btn-default" data-edit="bold" title="Bold (Ctrl/Cmd+B)"><i class="fa fa-bold"></i></a>
  100. <a class="btn btn-default" data-edit="italic" title="Italic (Ctrl/Cmd+I)"><i class="fa fa-italic"></i></a>
  101. <a class="btn btn-default" data-edit="strikethrough" title="Strikethrough"><i class="fa fa-strikethrough"></i></a>
  102. <a class="btn btn-default" data-edit="underline" title="Underline (Ctrl/Cmd+U)"><i class="fa fa-underline"></i></a>
  103. </div>
  104. <div class="btn-group">
  105. <a class="btn btn-default" data-edit="insertunorderedlist" title="Bullet list"><i class="fa fa-list-ul"></i></a>
  106. <a class="btn btn-default" data-edit="insertorderedlist" title="Number list"><i class="fa fa-list-ol"></i></a>
  107. <a class="btn btn-default" data-edit="outdent" title="Reduce indent (Shift+Tab)"><i class="fa fa-outdent"></i></a>
  108. <a class="btn btn-default" data-edit="indent" title="Indent (Tab)"><i class="fa fa-indent"></i></a>
  109. </div>
  110. <div class="btn-group">
  111. <a class="btn btn-default" data-edit="justifyleft" title="Align Left (Ctrl/Cmd+L)"><i class="fa fa-align-left"></i></a>
  112. <a class="btn btn-default" data-edit="justifycenter" title="Center (Ctrl/Cmd+E)"><i class="fa fa-align-center"></i></a>
  113. <a class="btn btn-default" data-edit="justifyright" title="Align Right (Ctrl/Cmd+R)"><i class="fa fa-align-right"></i></a>
  114. <a class="btn btn-default" data-edit="justifyfull" title="Justify (Ctrl/Cmd+J)"><i class="fa fa-align-justify"></i></a>
  115. </div>
  116. <div class="btn-group">
  117. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Hyperlink"><i class="fa fa-link"></i></a>
  118. <div class="dropdown-menu input-append">
  119. <input placeholder="URL" type="text" data-edit="createLink" />
  120. <button class="btn" type="button">Add</button>
  121. </div>
  122. </div>
  123. <div class="btn-group">
  124. <a class="btn btn-default" data-edit="unlink" title="Remove Hyperlink"><i class="fa fa-unlink"></i></a>
  125. <span class="btn btn-default" title="Insert picture (or just drag & drop)" id="pictureBtn"> <i class="fa fa-picture-o"></i>
  126. <input class="imgUpload" type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" />
  127. </span>
  128. </div>
  129. <div class="btn-group">
  130. <a class="btn btn-default" data-edit="undo" title="Undo (Ctrl/Cmd+Z)"><i class="fa fa-undo"></i></a>
  131. <a class="btn btn-default" data-edit="redo" title="Redo (Ctrl/Cmd+Y)"><i class="fa fa-repeat"></i></a>
  132. </div>
  133. <input class="pull-right voiceBtn" type="text" data-edit="inserttext" />
  134. </div>
  135. <div id="second-editor" class="lead" data-placeholder="This is a basic example with a simple toolbar."></div>
  136. <div class="editorPreview"></div>
  137. </div>
  138. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  139. <script src="../bower_components/jquery.hotkeys/jquery.hotkeys.js"></script>
  140. <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  141. <script src="../bower_components/google-code-prettify/src/prettify.js"></script>
  142. <script src="../src/bootstrap-wysiwyg.js"></script>
  143. <script type='text/javascript'>
  144. $('#first-editor').wysiwyg();
  145. $('#second-editor').wysiwyg();
  146. $(".dropdown-menu > input").click(function (e) {
  147. e.stopPropagation();
  148. });
  149. </script>
  150. </body>
  151. </html>