summaryrefslogtreecommitdiff
path: root/codemirror_ui/lib/CodeMirror-2.3/demo/marker.html
blob: 00a89cef01baa99d10ddce6e7234dd58db15e7c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!doctype html>
<html>
  <head>
    <title>CodeMirror: Breakpoint Demo</title>
    <link rel="stylesheet" href="../lib/codemirror.css">
    <script src="../lib/codemirror.js"></script>
    <script src="../mode/javascript/javascript.js"></script>
    <link rel="stylesheet" href="../doc/docs.css">

    <style type="text/css">
      .CodeMirror-gutter {
        width: 3em;
        background: white;
      }
      .CodeMirror {
        border: 1px solid #aaa;
      }
    </style>
  </head>
  <body>
    <h1>CodeMirror: Breakpoint demo</h1>

    <form><textarea id="code" name="code">
CodeMirror.fromTextArea(document.getElementById("code"), {
  lineNumbers: true,
  onGutterClick: function(cm, n) {
    var info = cm.lineInfo(n);
    if (info.markerText)
      cm.clearMarker(n);
    else
      cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
  }
});
</textarea></form>

<p>Click the line-number gutter to add or remove 'breakpoints'.</p>

    <script>
      CodeMirror.fromTextArea(document.getElementById("code"), {
        lineNumbers: true,
        onGutterClick: function(cm, n) {
          var info = cm.lineInfo(n);
          if (info.markerText)
            cm.clearMarker(n);
          else
            cm.setMarker(n, "<span style=\"color: #900\">●</span> %N%");
        }
      });
    </script>

  </body>
</html>