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.

51 lines
1.3 KiB

7 months ago
  1. <!doctype html>
  2. <title>CodeMirror: Autoresize 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/css/css.js"></script>
  8. <style>
  9. .CodeMirror {
  10. border: 1px solid #eee;
  11. height: auto;
  12. }
  13. </style>
  14. <div id=nav>
  15. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
  16. <ul>
  17. <li><a href="../index.html">Home</a>
  18. <li><a href="../doc/manual.html">Manual</a>
  19. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  20. </ul>
  21. <ul>
  22. <li><a class=active href="#">Autoresize</a>
  23. </ul>
  24. </div>
  25. <article>
  26. <h2>Autoresize Demo</h2>
  27. <form><textarea id="code" name="code">
  28. .CodeMirror {
  29. border: 1px solid #eee;
  30. height: auto;
  31. }
  32. </textarea></form>
  33. <p>By setting an editor's <code>height</code> style
  34. to <code>auto</code> and giving
  35. the <a href="../doc/manual.html#option_viewportMargin"><code>viewportMargin</code></a>
  36. a value of <code>Infinity</code>, CodeMirror can be made to
  37. automatically resize to fit its content.</p>
  38. <script>
  39. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  40. lineNumbers: true,
  41. viewportMargin: Infinity
  42. });
  43. </script>
  44. </article>