summaryrefslogtreecommitdiff
path: root/codemirror_ui/lib/CodeMirror-2.3/demo/activeline.html
blob: a5b3c2ccc0679102bffb733f71fcda9453dc63c7 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!doctype html>
<html>
  <head>
    <title>CodeMirror: Active Line Demo</title>
    <link rel="stylesheet" href="../lib/codemirror.css">
    <script src="../lib/codemirror.js"></script>
    <script src="../mode/xml/xml.js"></script>
    <link rel="stylesheet" href="../doc/docs.css">

    <style type="text/css">
      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
      .activeline {background: #e8f2ff !important;}
    </style>
  </head>
  <body>
    <h1>CodeMirror: Active Line Demo</h1>

    <form><textarea id="code" name="code">
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
     xmlns:georss="http://www.georss.org/georss"
     xmlns:twitter="http://api.twitter.com">
  <channel>
    <title>Twitter / codemirror</title>
    <link>http://twitter.com/codemirror</link>
    <atom:link type="application/rss+xml"
               href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/>
    <description>Twitter updates from CodeMirror / codemirror.</description>
    <language>en-us</language>
    <ttl>40</ttl>
  <item>
    <title>codemirror: http://cloud-ide.com &#8212; they're springing up like mushrooms. This one
      uses CodeMirror as its editor.</title>
    <description>codemirror: http://cloud-ide.com &#8212; they're springing up like mushrooms. This
      one uses CodeMirror as its editor.</description>
    <pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate>
    <guid>http://twitter.com/codemirror/statuses/48527733722058752</guid>
    <link>http://twitter.com/codemirror/statuses/48527733722058752</link>
    <twitter:source>web</twitter:source>
    <twitter:place/>
  </item>
  <item>
    <title>codemirror: Posted a description of the CodeMirror 2 internals at
      http://codemirror.net/2/internals.html</title>
    <description>codemirror: Posted a description of the CodeMirror 2 internals at
      http://codemirror.net/2/internals.html</description>
    <pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate>
    <guid>http://twitter.com/codemirror/statuses/42920879788789760</guid>
    <link>http://twitter.com/codemirror/statuses/42920879788789760</link>
    <twitter:source>web</twitter:source>
    <twitter:place/>
  </item>
  </channel>
</rss></textarea></form>

    <script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  mode: "application/xml",
  lineNumbers: true,
  lineWrapping: true,
  onCursorActivity: function() {
    editor.setLineClass(hlLine, null, null);
    hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");
  }
});
var hlLine = editor.setLineClass(0, "activeline");
</script>

    <p>Styling the current cursor line.</p>

  </body>
</html>