|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>CodeMirror 2: Active Line Demo</title> |
| 5 | + <link rel="stylesheet" href="../lib/codemirror.css"> |
| 6 | + <script src="../lib/codemirror.js"></script> |
| 7 | + <link rel="stylesheet" href="../mode/xml/xml.css"> |
| 8 | + <script src="../mode/xml/xml.js"></script> |
| 9 | + <link rel="stylesheet" href="../css/docs.css"> |
| 10 | + |
| 11 | + <style type="text/css"> |
| 12 | + .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} |
| 13 | + .activeline {background: #f0fcff !important;} |
| 14 | + </style> |
| 15 | + </head> |
| 16 | + <body> |
| 17 | + <h1>CodeMirror 2: Active Line Demo</h1> |
| 18 | + |
| 19 | + <form><textarea id="code" name="code"> |
| 20 | +<?xml version="1.0" encoding="UTF-8"?> |
| 21 | +<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" |
| 22 | + xmlns:georss="http://www.georss.org/georss" |
| 23 | + xmlns:twitter="http://api.twitter.com"> |
| 24 | + <channel> |
| 25 | + <title>Twitter / codemirror</title> |
| 26 | + <link>http://twitter.com/codemirror</link> |
| 27 | + <atom:link type="application/rss+xml" |
| 28 | + href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/> |
| 29 | + <description>Twitter updates from CodeMirror / codemirror.</description> |
| 30 | + <language>en-us</language> |
| 31 | + <ttl>40</ttl> |
| 32 | + <item> |
| 33 | + <title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one |
| 34 | + uses CodeMirror as its editor.</title> |
| 35 | + <description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This |
| 36 | + one uses CodeMirror as its editor.</description> |
| 37 | + <pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate> |
| 38 | + <guid>http://twitter.com/codemirror/statuses/48527733722058752</guid> |
| 39 | + <link>http://twitter.com/codemirror/statuses/48527733722058752</link> |
| 40 | + <twitter:source>web</twitter:source> |
| 41 | + <twitter:place/> |
| 42 | + </item> |
| 43 | + <item> |
| 44 | + <title>codemirror: Posted a description of the CodeMirror 2 internals at |
| 45 | + http://codemirror.net/2/internals.html</title> |
| 46 | + <description>codemirror: Posted a description of the CodeMirror 2 internals at |
| 47 | + http://codemirror.net/2/internals.html</description> |
| 48 | + <pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate> |
| 49 | + <guid>http://twitter.com/codemirror/statuses/42920879788789760</guid> |
| 50 | + <link>http://twitter.com/codemirror/statuses/42920879788789760</link> |
| 51 | + <twitter:source>web</twitter:source> |
| 52 | + <twitter:place/> |
| 53 | + </item> |
| 54 | +</feed></textarea></form> |
| 55 | + |
| 56 | + <script> |
| 57 | +var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 58 | + mode: "application/xml", |
| 59 | + lineNumbers: true, |
| 60 | + onCursorActivity: function() { |
| 61 | + editor.setLineClass(hlLine, null); |
| 62 | + hlLine = editor.setLineClass(editor.getCursor().line, "activeline"); |
| 63 | + } |
| 64 | +}); |
| 65 | +var hlLine = editor.setLineClass(0, "activeline"); |
| 66 | +</script> |
| 67 | + |
| 68 | + <p>Styling the current cursor line.</p> |
| 69 | + |
| 70 | + </body> |
| 71 | +</html> |
0 commit comments