4
<title>CodeMirror: Full Screen Editing</title>
5
<link rel="stylesheet" href="../lib/codemirror.css">
6
<script src="../lib/codemirror.js"></script>
7
<link rel="stylesheet" href="../theme/night.css">
8
<script src="../mode/xml/xml.js"></script>
9
<link rel="stylesheet" href="../doc/docs.css">
11
<style type="text/css">
12
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
13
.CodeMirror-fullscreen {
23
border: 0px solid #BBBBBB;
29
<h1>CodeMirror: Full Screen Editing</h1>
31
<form><textarea id="code" name="code" rows="5">
32
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
33
<dd>Whether, when indenting, the first N*8 spaces should be
34
replaced by N tabs. Default is false.</dd>
36
<dt id="option_tabMode"><code>tabMode (string)</code></dt>
37
<dd>Determines what happens when the user presses the tab key.
38
Must be one of the following:
40
<dt><code>"classic" (the default)</code></dt>
41
<dd>When nothing is selected, insert a tab. Otherwise,
42
behave like the <code>"shift"</code> mode. (When shift is
43
held, this behaves like the <code>"indent"</code> mode.)</dd>
44
<dt><code>"shift"</code></dt>
45
<dd>Indent all selected lines by
46
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
47
If shift was held while pressing tab, un-indent all selected
49
<dt><code>"indent"</code></dt>
50
<dd>Indent the line the 'correctly', based on its syntactic
51
context. Only works if the
52
mode <a href="#indent">supports</a> it.</dd>
53
<dt><code>"default"</code></dt>
54
<dd>Do not capture tab presses, let the browser apply its
55
default behaviour (which usually means it skips to the next
59
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
60
<dd>Determines whether and how new lines are indented when the
61
enter key is pressed. The following modes are supported:
63
<dt><code>"indent" (the default)</code></dt>
64
<dd>Use the mode's indentation rules to give the new line
65
the correct indentation.</dd>
66
<dt><code>"keep"</code></dt>
67
<dd>Indent the line the same as the previous line.</dd>
68
<dt><code>"flat"</code></dt>
69
<dd>Do not indent the new line.</dd>
72
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
73
<dd>Determines whether and how new lines are indented when the
74
enter key is pressed. The following modes are supported:
76
<dt><code>"indent" (the default)</code></dt>
77
<dd>Use the mode's indentation rules to give the new line
78
the correct indentation.</dd>
79
<dt><code>"keep"</code></dt>
80
<dd>Indent the line the same as the previous line.</dd>
81
<dt><code>"flat"</code></dt>
82
<dd>Do not indent the new line.</dd>
85
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
86
<dd>Determines whether and how new lines are indented when the
87
enter key is pressed. The following modes are supported:
89
<dt><code>"indent" (the default)</code></dt>
90
<dd>Use the mode's indentation rules to give the new line
91
the correct indentation.</dd>
92
<dt><code>"keep"</code></dt>
93
<dd>Indent the line the same as the previous line.</dd>
94
<dt><code>"flat"</code></dt>
95
<dd>Do not indent the new line.</dd>
98
<dt id="option_enterMode"><code>enterMode (string)</code></dt>
99
<dd>Determines whether and how new lines are indented when the
100
enter key is pressed. The following modes are supported:
102
<dt><code>"indent" (the default)</code></dt>
103
<dd>Use the mode's indentation rules to give the new line
104
the correct indentation.</dd>
105
<dt><code>"keep"</code></dt>
106
<dd>Indent the line the same as the previous line.</dd>
107
<dt><code>"flat"</code></dt>
108
<dd>Do not indent the new line.</dd>
113
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
118
var scroller = editor.getScrollerElement();
119
if (scroller.className.search(/\bCodeMirror-fullscreen\b/) === -1) {
120
scroller.className += " CodeMirror-fullscreen";
121
scroller.style.height = "100%";
122
scroller.style.width = "100%";
125
scroller.className = scroller.className.replace(" CodeMirror-fullscreen", "");
126
scroller.style.height = '';
127
scroller.style.width = '';
132
var scroller = editor.getScrollerElement();
133
if (scroller.className.search(/\bCodeMirror-fullscreen\b/) !== -1) {
134
scroller.className = scroller.className.replace(" CodeMirror-fullscreen", "");
135
scroller.style.height = '';
136
scroller.style.width = '';
145
<p>Press <strong>F11</strong> when cursor is in the editor to toggle full screen editing. <strong>Esc</strong> can also be used to <i>exit</i> full screen editing.</p>
147
<p><strong>Note:</strong> Does not currently work correctly in IE
148
6 and 7, where setting the height of something
149
to <code>100%</code> doesn't make it full screen.</p>