You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.1 KiB

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