onpreviewing-onpreviewed.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Onpreviewing / Onpreviewed - 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. <style>
  10. .editormd-preview-active {width: 80%;margin: 0 auto;}
  11. </style>
  12. </head>
  13. <body>
  14. <div id="layout">
  15. <header>
  16. <h1>Onpreviewing / Onpreviewed event handle</h1>
  17. <p>Plaese press F12, open the develop tools.</p>
  18. </header>
  19. <div id="test-editormd">
  20. <textarea style="display:none;">#### Settings
  21. ```javascript
  22. {
  23. onpreviewing : function() {
  24. // console.log("onpreviewing =>", this, this.id, this.settings);
  25. // on previewing you can custom css .editormd-preview-active
  26. },
  27. onpreviewed : function() {
  28. // console.log("onpreviewed =>", this, this.id, this.settings);
  29. }
  30. }
  31. ```
  32. </textarea>
  33. </div>
  34. </div>
  35. <script src="js/jquery.min.js"></script>
  36. <script src="../editormd.js"></script>
  37. <script type="text/javascript">
  38. $(function() {
  39. var testEditor = editormd("test-editormd", {
  40. width : "90%",
  41. height : 720,
  42. path : '../lib/',
  43. onpreviewing : function() {
  44. console.log("onpreviewing =>", this, this.id, this.settings);
  45. },
  46. onpreviewed : function() {
  47. console.log("onpreviewed =>", this, this.id, this.settings);
  48. }
  49. });
  50. });
  51. </script>
  52. </body>
  53. </html>