readonly.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Read only mode - 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>只读模式</h1>
  14. <p>Read only mode</p>
  15. </header>
  16. <div class="btns">
  17. <button id="watch-btn">Enable watch</button>
  18. <button id="unwatch-btn">Disable watch</button>
  19. </div>
  20. <div id="test-editormd" class="editormd-onlyread">
  21. <textarea style="display:none;">#### Setting
  22. ```javascript
  23. {
  24. readOnly : true,
  25. //styleActiveLine : false, // disable active line
  26. //watch : false, // disable watch
  27. //lineNumbers : false // hide line numbers
  28. }
  29. ```
  30. </textarea>
  31. </div>
  32. </div>
  33. <script src="js/jquery.min.js"></script>
  34. <script src="../editormd.js"></script>
  35. <script type="text/javascript">
  36. var testEditor;
  37. $(function() {
  38. testEditor = editormd("test-editormd", {
  39. width : "90%",
  40. height : 540,
  41. path : "../lib/",
  42. //watch : false, // disable watch
  43. readOnly : true,
  44. styleActiveLine : false, // disable active line
  45. //lineNumbers : false // hide line numbers
  46. });
  47. $("#watch-btn").click(function(){
  48. testEditor.watch();
  49. });
  50. $("#unwatch-btn").click(function(){
  51. testEditor.unwatch();
  52. });
  53. });
  54. </script>
  55. </body>
  56. </html>