Skip to content

Commit

Permalink
Remove remaining uses of tabMode and enterMode in demos
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jan 28, 2014
1 parent 0141579 commit b538a4e
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 154 deletions.
3 changes: 1 addition & 2 deletions demo/changemode.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ <h2>Mode-Changing Demo</h2>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "scheme",
lineNumbers: true,
tabMode: "indent"
lineNumbers: true
});
var pending;
editor.on("change", function() {
Expand Down
105 changes: 29 additions & 76 deletions demo/fullscreen.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,85 +27,38 @@
<article>
<h2>Full Screen Editing</h2>
<form><textarea id="code" name="code" rows="5">
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
<dd>Whether, when indenting, the first N*8 spaces should be
replaced by N tabs. Default is false.</dd>
<dl>
<dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
<dd>Whether, when indenting, the first N*<code>tabSize</code>
spaces should be replaced by N tabs. Default is false.</dd>

<dt id="option_tabMode"><code>tabMode (string)</code></dt>
<dd>Determines what happens when the user presses the tab key.
Must be one of the following:
<dl>
<dt><code>"classic" (the default)</code></dt>
<dd>When nothing is selected, insert a tab. Otherwise,
behave like the <code>"shift"</code> mode. (When shift is
held, this behaves like the <code>"indent"</code> mode.)</dd>
<dt><code>"shift"</code></dt>
<dd>Indent all selected lines by
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
If shift was held while pressing tab, un-indent all selected
lines one unit.</dd>
<dt><code>"indent"</code></dt>
<dd>Indent the line the 'correctly', based on its syntactic
context. Only works if the
mode <a href="#indent">supports</a> it.</dd>
<dt><code>"default"</code></dt>
<dd>Do not capture tab presses, let the browser apply its
default behaviour (which usually means it skips to the next
control).</dd>
</dl></dd>
<dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
<dd>Configures whether the editor should re-indent the current
line when a character is typed that might change its proper
indentation (only works if the mode supports indentation).
Default is true.</dd>

<dt id="option_enterMode"><code>enterMode (string)</code></dt>
<dd>Determines whether and how new lines are indented when the
enter key is pressed. The following modes are supported:
<dl>
<dt><code>"indent" (the default)</code></dt>
<dd>Use the mode's indentation rules to give the new line
the correct indentation.</dd>
<dt><code>"keep"</code></dt>
<dd>Indent the line the same as the previous line.</dd>
<dt><code>"flat"</code></dt>
<dd>Do not indent the new line.</dd>
</dl></dd>

<dt id="option_enterMode"><code>enterMode (string)</code></dt>
<dd>Determines whether and how new lines are indented when the
enter key is pressed. The following modes are supported:
<dl>
<dt><code>"indent" (the default)</code></dt>
<dd>Use the mode's indentation rules to give the new line
the correct indentation.</dd>
<dt><code>"keep"</code></dt>
<dd>Indent the line the same as the previous line.</dd>
<dt><code>"flat"</code></dt>
<dd>Do not indent the new line.</dd>
</dl></dd>

<dt id="option_enterMode"><code>enterMode (string)</code></dt>
<dd>Determines whether and how new lines are indented when the
enter key is pressed. The following modes are supported:
<dl>
<dt><code>"indent" (the default)</code></dt>
<dd>Use the mode's indentation rules to give the new line
the correct indentation.</dd>
<dt><code>"keep"</code></dt>
<dd>Indent the line the same as the previous line.</dd>
<dt><code>"flat"</code></dt>
<dd>Do not indent the new line.</dd>
</dl></dd>

<dt id="option_enterMode"><code>enterMode (string)</code></dt>
<dd>Determines whether and how new lines are indented when the
enter key is pressed. The following modes are supported:
<dl>
<dt><code>"indent" (the default)</code></dt>
<dd>Use the mode's indentation rules to give the new line
the correct indentation.</dd>
<dt><code>"keep"</code></dt>
<dd>Indent the line the same as the previous line.</dd>
<dt><code>"flat"</code></dt>
<dd>Do not indent the new line.</dd>
</dl></dd>
<dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
<dd>A regular expression used to determine which characters
should be replaced by a
special <a href="#option_specialCharPlaceholder">placeholder</a>.
Mostly useful for non-printing special characters. The default
is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
<dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
<dd>A function that, given a special character identified by
the <a href="#option_specialChars"><code>specialChars</code></a>
option, produces a DOM node that is used to represent the
character. By default, a red dot (<span style="color: red"></span>)
is shown, with a title tooltip to indicate the character code.</dd>

<dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
<dd>Determines whether horizontal cursor movement through
right-to-left (Arabic, Hebrew) text is visual (pressing the left
arrow moves the cursor left) or logical (pressing the left arrow
moves to the next lower index in the string, which is visually
right in right-to-left text). The default is <code>false</code>
on Windows, and <code>true</code> on other platforms.</dd>
</dl>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
Expand Down
3 changes: 1 addition & 2 deletions demo/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ <h2>HTML5 preview</h2>
var delay;
// Initialize CodeMirror editor with a nice html5 canvas demo.
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
mode: 'text/html',
tabMode: 'indent'
mode: 'text/html'
});
editor.on("change", function() {
clearTimeout(delay);
Expand Down
67 changes: 30 additions & 37 deletions demo/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,38 @@
<article>
<h2>Search/Replace Demo</h2>
<form><textarea id="code" name="code">
<dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
<dd>Whether, when indenting, the first N*8 spaces should be
replaced by N tabs. Default is false.</dd>
<dl>
<dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
<dd>Whether, when indenting, the first N*<code>tabSize</code>
spaces should be replaced by N tabs. Default is false.</dd>

<dt id="option_tabMode"><code>tabMode (string)</code></dt>
<dd>Determines what happens when the user presses the tab key.
Must be one of the following:
<dl>
<dt><code>"classic" (the default)</code></dt>
<dd>When nothing is selected, insert a tab. Otherwise,
behave like the <code>"shift"</code> mode. (When shift is
held, this behaves like the <code>"indent"</code> mode.)</dd>
<dt><code>"shift"</code></dt>
<dd>Indent all selected lines by
one <a href="#option_indentUnit"><code>indentUnit</code></a>.
If shift was held while pressing tab, un-indent all selected
lines one unit.</dd>
<dt><code>"indent"</code></dt>
<dd>Indent the line the 'correctly', based on its syntactic
context. Only works if the
mode <a href="#indent">supports</a> it.</dd>
<dt><code>"default"</code></dt>
<dd>Do not capture tab presses, let the browser apply its
default behaviour (which usually means it skips to the next
control).</dd>
</dl></dd>
<dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
<dd>Configures whether the editor should re-indent the current
line when a character is typed that might change its proper
indentation (only works if the mode supports indentation).
Default is true.</dd>

<dt id="option_enterMode"><code>enterMode (string)</code></dt>
<dd>Determines whether and how new lines are indented when the
enter key is pressed. The following modes are supported:
<dl>
<dt><code>"indent" (the default)</code></dt>
<dd>Use the mode's indentation rules to give the new line
the correct indentation.</dd>
<dt><code>"keep"</code></dt>
<dd>Indent the line the same as the previous line.</dd>
<dt><code>"flat"</code></dt>
<dd>Do not indent the new line.</dd>
</dl></dd>
<dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
<dd>A regular expression used to determine which characters
should be replaced by a
special <a href="#option_specialCharPlaceholder">placeholder</a>.
Mostly useful for non-printing special characters. The default
is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
<dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
<dd>A function that, given a special character identified by
the <a href="#option_specialChars"><code>specialChars</code></a>
option, produces a DOM node that is used to represent the
character. By default, a red dot (<span style="color: red"></span>)
is shown, with a title tooltip to indicate the character code.</dd>

<dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
<dd>Determines whether horizontal cursor movement through
right-to-left (Arabic, Hebrew) text is visual (pressing the left
arrow moves the cursor left) or logical (pressing the left arrow
moves to the next lower index in the string, which is visually
right in right-to-left text). The default is <code>false</code>
on Windows, and <code>true</code> on other platforms.</dd>
</dl>
</textarea></form>

<script>
Expand Down
1 change: 0 additions & 1 deletion mode/eiffel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ <h2>Eiffel mode</h2>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-eiffel",
tabMode: "indent",
indentUnit: 4,
lineNumbers: true,
theme: "neat"
Expand Down
4 changes: 1 addition & 3 deletions mode/htmlembedded/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ <h2>Html Embedded Scripts mode</h2>
lineNumbers: true,
mode: "application/x-ejs",
indentUnit: 4,
indentWithTabs: true,
enterMode: "keep",
tabMode: "shift"
indentWithTabs: true
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion mode/htmlmixed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1>Mixed HTML Example</h1>
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode, tabMode: "indent"});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode});
</script>

<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
Expand Down
1 change: 0 additions & 1 deletion mode/julia/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ <h2>Julia mode</h2>
},
lineNumbers: true,
indentUnit: 4,
tabMode: "shift",
matchBrackets: true
});
</script>
Expand Down
1 change: 0 additions & 1 deletion mode/lua/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ <h2>Lua mode</h2>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
tabMode: "indent",
matchBrackets: true,
theme: "neat"
});
Expand Down
5 changes: 2 additions & 3 deletions mode/mirc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@ <h2>mIRC mode</h2>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
tabMode: "indent",
theme: "twilight",
theme: "twilight",
lineNumbers: true,
matchBrackets: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/mirc"
});
Expand Down
1 change: 0 additions & 1 deletion mode/octave/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ <h2>Octave mode</h2>
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
tabMode: "shift",
matchBrackets: true
});
</script>
Expand Down
4 changes: 1 addition & 3 deletions mode/php/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ <h2>PHP mode</h2>
matchBrackets: true,
mode: "application/x-httpd-php",
indentUnit: 4,
indentWithTabs: true,
enterMode: "keep",
tabMode: "shift"
indentWithTabs: true
});
</script>

Expand Down
2 changes: 0 additions & 2 deletions mode/python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ <h2>Cython mode</h2>
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
tabMode: "shift",
matchBrackets: true
});

Expand All @@ -160,7 +159,6 @@ <h2>Cython mode</h2>
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
tabMode: "shift",
matchBrackets: true
});
</script>
Expand Down
3 changes: 1 addition & 2 deletions mode/rpm/changes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ <h2>RPM changes mode</h2>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: {name: "changes"},
lineNumbers: true,
indentUnit: 4,
tabMode: "shift"
indentUnit: 4
});
</script>

Expand Down
1 change: 0 additions & 1 deletion mode/ruby/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ <h2>Ruby mode</h2>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-ruby",
tabMode: "indent",
matchBrackets: true,
indentUnit: 4
});
Expand Down
3 changes: 1 addition & 2 deletions mode/rust/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ <h2>Rust mode</h2>

<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
tabMode: "indent"
lineNumbers: true
});
</script>

Expand Down
1 change: 0 additions & 1 deletion mode/sparql/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ <h2>SPARQL mode</h2>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "application/x-sparql-query",
tabMode: "indent",
matchBrackets: true
});
</script>
Expand Down
15 changes: 7 additions & 8 deletions mode/tcl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ <h2>Tcl mode</h2>
proc whois::311 {from key text} {
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
$nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
$nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
}
}
proc whois::multi {from key text} {
if {[regexp {\:(.*)$} $text match $key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
return 1
return 1
}
}
proc whois::312 {from key text} {
Expand All @@ -98,7 +98,7 @@ <h2>Tcl mode</h2>
proc whois::317 {from key text} {
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
[ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
[ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
}
}
proc whois::301 {from key text} {
Expand All @@ -108,7 +108,7 @@ <h2>Tcl mode</h2>
}
proc whois::318 {from key text} {
namespace eval whois {
variable channel ""
variable channel ""
}
variable whois::channel ""
}
Expand All @@ -118,8 +118,8 @@ <h2>Tcl mode</h2>
proc whois::list {nick host hand chan text} {
if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
namespace eval whois {
variable channel ""
}
variable channel ""
}
variable whois::channel $chan
putserv "WHOIS $text"
}
Expand All @@ -129,8 +129,7 @@ <h2>Tcl mode</h2>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
tabMode: "indent",
theme: "night",
theme: "night",
lineNumbers: true,
indentUnit: 2,
scrollPastEnd: true,
Expand Down
Loading

0 comments on commit b538a4e

Please sign in to comment.