Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  4. <meta charset="utf-8">
  5.  
  6. <title>wysihtml5 - Simple Demo</title>
  7.  
  8. <style>
  9. body {
  10. font-family: Verdana, serif;
  11. font-size: 11px;
  12. }
  13.  
  14. h2 {
  15. margin-bottom: 0;
  16. }
  17.  
  18. small {
  19. display: block;
  20. margin-top: 40px;
  21. font-size: 9px;
  22. }
  23.  
  24. small,
  25. small a {
  26. color: #666;
  27. }
  28.  
  29. a {
  30. color: #000;
  31. text-decoration: underline;
  32. cursor: pointer;
  33. }
  34.  
  35. #toolbar [data-wysihtml5-action] {
  36. float: right;
  37. margin-right: 10px;
  38. }
  39.  
  40. #toolbar,
  41. textarea {
  42. width: 600px;
  43. padding: 5px;
  44. }
  45.  
  46. textarea {
  47. height: 280px;
  48. border: 2px solid green;
  49. box-sizing: border-box;
  50. -webkit-box-sizing: border-box;
  51. -ms-box-sizing: border-box;
  52. -moz-box-sizing: border-box;
  53. font-family: Verdana, serif;
  54. font-size: 11px;
  55. }
  56.  
  57. textarea:focus {
  58. color: black;
  59. border: 2px solid black;
  60. }
  61.  
  62. </style>
  63.  
  64. <h1>wysihtml5 - Simple Editor Example</h1>
  65.  
  66. <p>
  67. Uses a custom rule set that allows the following elements: <em>strong, b, em, i, a, span</em><br>
  68. Links will automatically receive <i>target="_blank"</i> and <i>rel="nofollow"</i>. Check the source code of this page.
  69. </p>
  70.  
  71. <form>
  72. <div id="toolbar">
  73. <a data-wysihtml5-command="bold" title="CTRL+B">bold</a> |
  74. <a data-wysihtml5-command="italic" title="CTRL+I">italic</a>
  75. <a data-wysihtml5-action="change_view">switch to html view</a>
  76. </div>
  77. <textarea id="textarea" placeholder="Enter text ..."></textarea>
  78. <br><input type="reset" value="Reset form!">
  79. </form>
  80.  
  81. <h2>Events:</h2>
  82. <div id="log"></div>
  83.  
  84. <small>powered by <a href="https://github.com/xing/wysihtml5" target="_blank">wysihtml5</a>.</small>
  85.  
  86. <script src="../bower_components/wysihtml/dist/wysihtml.min.js"></script>
  87. <script src="../dist/wysihtml5-0.3.0.js"></script>
  88. <script src="../bower_components/wysihtml/dist/wysihtml-toolbar.js"></script>
  89. <script>
  90. var editor = new wysihtml5.Editor("textarea", {
  91. toolbar: "toolbar",
  92. parserRules: wysihtml5ParserRules
  93. });
  94.  
  95. var log = document.getElementById("log");
  96.  
  97. editor
  98. .on("load", function() {
  99. log.innerHTML += "<div>load</div>";
  100. })
  101. .on("focus", function() {
  102. log.innerHTML += "<div>focus</div>";
  103. })
  104. .on("blur", function() {
  105. log.innerHTML += "<div>blur</div>";
  106. })
  107. .on("change", function() {
  108. log.innerHTML += "<div>change</div>";
  109. })
  110. .on("paste", function() {
  111. log.innerHTML += "<div>paste</div>";
  112. })
  113. .on("newword:composer", function() {
  114. log.innerHTML += "<div>newword:composer</div>";
  115. })
  116. .on("undo:composer", function() {
  117. log.innerHTML += "<div>undo:composer</div>";
  118. })
  119. .on("redo:composer", function() {
  120. log.innerHTML += "<div>redo:composer</div>";
  121. });
  122. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement