1
0

marker.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>CodeMirror 2: Breakpoint Demo</title>
  5. <link rel="stylesheet" href="../lib/codemirror.css">
  6. <script src="../lib/codemirror.js"></script>
  7. <link rel="stylesheet" href="../theme/default.css">
  8. <script src="../mode/javascript/javascript.js"></script>
  9. <link rel="stylesheet" href="../css/docs.css">
  10. <style type="text/css">
  11. .CodeMirror-gutter {
  12. width: 3em;
  13. background: white;
  14. }
  15. .CodeMirror {
  16. border: 1px solid #aaa;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <h1>CodeMirror 2: Breakpoint demo</h1>
  22. <form><textarea id="code" name="code">
  23. CodeMirror.fromTextArea(document.getElementById("code"), {
  24. lineNumbers: true,
  25. onGutterClick: function(cm, n) {
  26. var info = cm.lineInfo(n);
  27. if (info.markerText)
  28. cm.clearMarker(n);
  29. else
  30. cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
  31. }
  32. });
  33. </textarea></form>
  34. <p>Click the line-number gutter to add or remove 'breakpoints'.</p>
  35. <script>
  36. CodeMirror.fromTextArea(document.getElementById("code"), {
  37. lineNumbers: true,
  38. onGutterClick: function(cm, n) {
  39. var info = cm.lineInfo(n);
  40. if (info.markerText)
  41. cm.clearMarker(n);
  42. else
  43. cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
  44. }
  45. });
  46. </script>
  47. </body>
  48. </html>