onwatch-onunwatch.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Onwatch / Onunwatch - Editor.md examples</title>
  6. <link rel="stylesheet" href="css/style.css" />
  7. <link rel="stylesheet" href="../css/editormd.css" />
  8. <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
  9. </head>
  10. <body>
  11. <div id="layout">
  12. <header>
  13. <h1>Onwatch / Onunwatch event handle</h1>
  14. <p>Plaese press F12, open the develop tools.</p>
  15. </header>
  16. <div id="test-editormd">
  17. <textarea style="display:none;">#### Settings
  18. ```javascript
  19. {
  20. onwatch : function() {
  21. // console.log("onwatch =>", this, this.id, this.settings);
  22. },
  23. onunwatch : function() {
  24. // console.log("onunwatch =>", this, this.id, this.settings);
  25. }
  26. }
  27. ```
  28. </textarea>
  29. </div>
  30. </div>
  31. <script src="js/jquery.min.js"></script>
  32. <script src="../editormd.js"></script>
  33. <script type="text/javascript">
  34. $(function() {
  35. var testEditor = editormd("test-editormd", {
  36. width : "90%",
  37. height : 720,
  38. path : '../lib/',
  39. onwatch : function() {
  40. console.log("onwatch =>", this, this.id, this.settings);
  41. },
  42. onunwatch : function() {
  43. console.log("onunwatch =>", this, this.id, this.settings);
  44. }
  45. });
  46. });
  47. </script>
  48. </body>
  49. </html>