| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: Active Line Demo</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../lib/codemirror.css"> |
| 8 |
<script src="../lib/codemirror.js"></script> |
| 9 |
<script src="../mode/xml/xml.js"></script> |
| 10 |
<script src="../addon/selection/active-line.js"></script> |
| 11 |
<style> |
| 12 |
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} |
| 13 |
</style> |
| 14 |
<div id=nav> |
| 15 |
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a> |
| 16 |
|
| 17 |
<ul> |
| 18 |
<li><a href="../index.html">Home</a> |
| 19 |
<li><a href="../doc/manual.html">Manual</a> |
| 20 |
<li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 21 |
</ul> |
| 22 |
<ul> |
| 23 |
<li><a class=active href="#">Active Line</a> |
| 24 |
</ul> |
| 25 |
</div> |
| 26 |
|
| 27 |
<article> |
| 28 |
<h2>Active Line Demo</h2> |
| 29 |
<form><textarea id="code" name="code"> |
| 30 |
<?xml version="1.0" encoding="UTF-8"?> |
| 31 |
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" |
| 32 |
xmlns:georss="http://www.georss.org/georss" |
| 33 |
xmlns:twitter="http://api.twitter.com"> |
| 34 |
<channel> |
| 35 |
<title>Twitter / codemirror</title> |
| 36 |
<link>http://twitter.com/codemirror</link> |
| 37 |
<atom:link type="application/rss+xml" |
| 38 |
href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/> |
| 39 |
<description>Twitter updates from CodeMirror / codemirror.</description> |
| 40 |
<language>en-us</language> |
| 41 |
<ttl>40</ttl> |
| 42 |
<item> |
| 43 |
<title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one |
| 44 |
uses CodeMirror as its editor.</title> |
| 45 |
<description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This |
| 46 |
one uses CodeMirror as its editor.</description> |
| 47 |
<pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate> |
| 48 |
<guid>http://twitter.com/codemirror/statuses/48527733722058752</guid> |
| 49 |
<link>http://twitter.com/codemirror/statuses/48527733722058752</link> |
| 50 |
<twitter:source>web</twitter:source> |
| 51 |
<twitter:place/> |
| 52 |
</item> |
| 53 |
<item> |
| 54 |
<title>codemirror: Posted a description of the CodeMirror 2 internals at |
| 55 |
https://codemirror.net/2/internals.html</title> |
| 56 |
<description>codemirror: Posted a description of the CodeMirror 2 internals at |
| 57 |
https://codemirror.net/2/internals.html</description> |
| 58 |
<pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate> |
| 59 |
<guid>http://twitter.com/codemirror/statuses/42920879788789760</guid> |
| 60 |
<link>http://twitter.com/codemirror/statuses/42920879788789760</link> |
| 61 |
<twitter:source>web</twitter:source> |
| 62 |
<twitter:place/> |
| 63 |
</item> |
| 64 |
</channel> |
| 65 |
</rss></textarea></form> |
| 66 |
|
| 67 |
<script> |
| 68 |
var nonEmpty = false; |
| 69 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 70 |
mode: "application/xml", |
| 71 |
styleActiveLine: true, |
| 72 |
lineNumbers: true, |
| 73 |
lineWrapping: true |
| 74 |
}); |
| 75 |
|
| 76 |
function toggleSelProp() { |
| 77 |
nonEmpty = !nonEmpty; |
| 78 |
editor.setOption("styleActiveLine", {nonEmpty: nonEmpty}); |
| 79 |
var label = nonEmpty ? 'Disable nonEmpty option' : 'Enable nonEmpty option'; |
| 80 |
document.getElementById('toggleButton').innerText = label; |
| 81 |
} |
| 82 |
</script> |
| 83 |
|
| 84 |
<p>Styling the current cursor line.</p> |
| 85 |
|
| 86 |
<button onclick="toggleSelProp()" id="toggleButton">Enable <code>nonEmpty</code> option</button> |
| 87 |
|
| 88 |
</article> |