Signed-off-by: alan <547533434@qq.com>

This commit is contained in:
alan 2014-11-13 11:09:47 +08:00
parent e7545b1cd9
commit 879433a9b8
137 changed files with 27895 additions and 27895 deletions

View File

@ -1,112 +1,112 @@
/* Extra for the CKEditor CodeMirror Plugin */ /* Extra for the CKEditor CodeMirror Plugin */
.CodeMirror {font:13px/1.4em monospace;} .CodeMirror {font:13px/1.4em monospace;}
.CodeMirror .activeline { background: #e8f2ff; } .CodeMirror .activeline { background: #e8f2ff; }
.CodeMirror .CodeMirror-foldmarker { .CodeMirror .CodeMirror-foldmarker {
color: blue; color: blue;
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
font-family: arial; font-family: arial;
line-height: .3; line-height: .3;
cursor: pointer; cursor: pointer;
} }
/* Fixes for themes */ /* Fixes for themes */
.cm-s-cobalt .CodeMirror-selected { background: #b36539 !important; } .cm-s-cobalt .CodeMirror-selected { background: #b36539 !important; }
.cm-s-erlang-dark .CodeMirror-selected { background: #b36539 !important; } .cm-s-erlang-dark .CodeMirror-selected { background: #b36539 !important; }
.cm-s-lesser-dark .CodeMirror-selected {background: #45443B !important;} .cm-s-lesser-dark .CodeMirror-selected {background: #45443B !important;}
.cm-s-monokai .CodeMirror-selected {background: #49483E !important;} .cm-s-monokai .CodeMirror-selected {background: #49483E !important;}
.cm-s-night .CodeMirror-selected { background: #447 !important; } .cm-s-night .CodeMirror-selected { background: #447 !important; }
.cm-s-rubyblue .CodeMirror-selected { background: #38566F !important; } .cm-s-rubyblue .CodeMirror-selected { background: #38566F !important; }
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } .cm-s-twilight .CodeMirror-selected { background: #323232 !important; }
.cm-s-xq-dark .CodeMirror-selected { background: #a8f !important; } .cm-s-xq-dark .CodeMirror-selected { background: #a8f !important; }
.cm-s-blackboard .activeline, .cm-s-blackboard .activeline,
.cm-s-cobalt .activeline, .cm-s-cobalt .activeline,
.cm-s-erlang-dark .activeline, .cm-s-erlang-dark .activeline,
.cm-s-lesser-dark .activeline, .cm-s-lesser-dark .activeline,
.cm-s-monokai .activeline, .cm-s-monokai .activeline,
.cm-s-night .activeline, .cm-s-night .activeline,
.cm-s-rubyblue .activeline, .cm-s-rubyblue .activeline,
.cm-s-vibrant-ink .activeline, .cm-s-vibrant-ink .activeline,
.cm-s-xq-dark .activeline { background: #757575; } .cm-s-xq-dark .activeline { background: #757575; }
.cm-s-twilight .activeline { background:#494949; } .cm-s-twilight .activeline { background:#494949; }
.CodeMirror-focused .cm-matchhighlight { .CodeMirror-focused .cm-matchhighlight {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
background-position: bottom; background-position: bottom;
background-repeat: repeat-x; background-repeat: repeat-x;
} }
/* Dialog Addon */ /* Dialog Addon */
.CodeMirror-dialog { .CodeMirror-dialog {
position: absolute; position: absolute;
left: 0; right: 0; left: 0; right: 0;
background: white; background: white;
z-index: 15; z-index: 15;
padding: .1em .8em; padding: .1em .8em;
overflow: hidden; overflow: hidden;
color: #333; color: #333;
} }
.CodeMirror-dialog-top { .CodeMirror-dialog-top {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
top: 0; top: 0;
} }
.CodeMirror-dialog-bottom { .CodeMirror-dialog-bottom {
border-top: 1px solid #eee; border-top: 1px solid #eee;
bottom: 0; bottom: 0;
} }
.CodeMirror-dialog input { .CodeMirror-dialog input {
border: none; border: none;
outline: none; outline: none;
background: transparent; background: transparent;
width: 20em; width: 20em;
color: inherit; color: inherit;
font-family: monospace; font-family: monospace;
} }
.CodeMirror-dialog button { .CodeMirror-dialog button {
font-size: 70%; font-size: 70%;
} }
.CodeMirror-hints { .CodeMirror-hints {
position: absolute; position: absolute;
z-index: 10; z-index: 10;
overflow: hidden; overflow: hidden;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 2px; padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2); box-shadow: 2px 3px 5px rgba(0,0,0,.2);
border-radius: 3px; border-radius: 3px;
border: 1px solid silver; border: 1px solid silver;
background: white; background: white;
font-size: 90%; font-size: 90%;
font-family: monospace; font-family: monospace;
max-height: 20em; max-height: 20em;
overflow-y: auto; overflow-y: auto;
} }
.CodeMirror-hint { .CodeMirror-hint {
margin: 0; margin: 0;
padding: 0 4px; padding: 0 4px;
border-radius: 2px; border-radius: 2px;
max-width: 19em; max-width: 19em;
overflow: hidden; overflow: hidden;
white-space: pre; white-space: pre;
color: black; color: black;
cursor: pointer; cursor: pointer;
} }
.CodeMirror-hint-active { .CodeMirror-hint-active {
background: #08f; background: #08f;
color: white; color: white;
} }

View File

@ -1,246 +1,246 @@
/* BASICS */ /* BASICS */
.CodeMirror { .CodeMirror {
/* Set height, width, borders, and global font properties here */ /* Set height, width, borders, and global font properties here */
font-family: monospace; font-family: monospace;
height: 300px; height: 300px;
} }
.CodeMirror-scroll { .CodeMirror-scroll {
/* Set scrolling behaviour here */ /* Set scrolling behaviour here */
overflow: auto; overflow: auto;
} }
/* PADDING */ /* PADDING */
.CodeMirror-lines { .CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */ padding: 4px 0; /* Vertical padding around content */
} }
.CodeMirror pre { .CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */ padding: 0 4px; /* Horizontal padding of content */
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler {
background-color: white; /* The little square between H and V scrollbars */ background-color: white; /* The little square between H and V scrollbars */
} }
/* GUTTER */ /* GUTTER */
.CodeMirror-gutters { .CodeMirror-gutters {
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
background-color: #f7f7f7; background-color: #f7f7f7;
} }
.CodeMirror-linenumbers {} .CodeMirror-linenumbers {}
.CodeMirror-linenumber { .CodeMirror-linenumber {
padding: 0 3px 0 5px; padding: 0 3px 0 5px;
min-width: 20px; min-width: 20px;
text-align: right; text-align: right;
color: #999; color: #999;
} }
/* CURSOR */ /* CURSOR */
.CodeMirror div.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black; border-left: 1px solid black;
z-index: 3; z-index: 3;
} }
/* Shown when moving in bi-directional text */ /* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor { .CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver; border-left: 1px solid silver;
} }
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor { .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto; width: auto;
border: 0; border: 0;
background: #7e7; background: #7e7;
z-index: 1; z-index: 1;
} }
/* Can style cursor different in overwrite (non-insert) mode */ /* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {} .CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
.cm-tab { display: inline-block; } .cm-tab { display: inline-block; }
/* DEFAULT THEME */ /* DEFAULT THEME */
.cm-s-default .cm-keyword {color: #708;} .cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;} .cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;} .cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;} .cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable {color: black;} .cm-s-default .cm-variable {color: black;}
.cm-s-default .cm-variable-2 {color: #05a;} .cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3 {color: #085;} .cm-s-default .cm-variable-3 {color: #085;}
.cm-s-default .cm-property {color: black;} .cm-s-default .cm-property {color: black;}
.cm-s-default .cm-operator {color: black;} .cm-s-default .cm-operator {color: black;}
.cm-s-default .cm-comment {color: #a50;} .cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;} .cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;} .cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;} .cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-error {color: #f00;} .cm-s-default .cm-error {color: #f00;}
.cm-s-default .cm-qualifier {color: #555;} .cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;} .cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;} .cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;} .cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;} .cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-header {color: blue;} .cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;} .cm-s-default .cm-quote {color: #090;}
.cm-s-default .cm-hr {color: #999;} .cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;} .cm-s-default .cm-link {color: #00c;}
.cm-negative {color: #d44;} .cm-negative {color: #d44;}
.cm-positive {color: #292;} .cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;} .cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;} .cm-em {font-style: italic;}
.cm-link {text-decoration: underline;} .cm-link {text-decoration: underline;}
.cm-invalidchar {color: #f00;} .cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* STOP */ /* STOP */
/* The rest of this file contains styles related to the mechanics of /* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */ the editor. You probably shouldn't touch them. */
.CodeMirror { .CodeMirror {
line-height: 1; line-height: 1;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background: white; background: white;
color: black; color: black;
} }
.CodeMirror-scroll { .CodeMirror-scroll {
/* 30px is the magic margin used to hide the element's real scrollbars */ /* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */ /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
margin-bottom: -30px; margin-right: -30px; margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-right: 30px; padding-bottom: 30px; padding-right: 30px;
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;
} }
/* The fake, visible scrollbars. Used to force redraw during scrolling /* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */ flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler { .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
position: absolute; position: absolute;
z-index: 6; z-index: 6;
display: none; display: none;
} }
.CodeMirror-vscrollbar { .CodeMirror-vscrollbar {
right: 0; top: 0; right: 0; top: 0;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }
.CodeMirror-hscrollbar { .CodeMirror-hscrollbar {
bottom: 0; left: 0; bottom: 0; left: 0;
overflow-y: hidden; overflow-y: hidden;
overflow-x: scroll; overflow-x: scroll;
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler {
right: 0; bottom: 0; right: 0; bottom: 0;
z-index: 6; z-index: 6;
} }
.CodeMirror-gutters { .CodeMirror-gutters {
position: absolute; left: 0; top: 0; position: absolute; left: 0; top: 0;
height: 100%; height: 100%;
padding-bottom: 30px; padding-bottom: 30px;
z-index: 3; z-index: 3;
} }
.CodeMirror-gutter { .CodeMirror-gutter {
height: 100%; height: 100%;
padding-bottom: 30px; padding-bottom: 30px;
margin-bottom: -32px; margin-bottom: -32px;
display: inline-block; display: inline-block;
/* Hack to make IE7 behave */ /* Hack to make IE7 behave */
*zoom:1; *zoom:1;
*display:inline; *display:inline;
} }
.CodeMirror-gutter-elt { .CodeMirror-gutter-elt {
position: absolute; position: absolute;
cursor: default; cursor: default;
z-index: 4; z-index: 4;
} }
.CodeMirror-lines { .CodeMirror-lines {
cursor: text; cursor: text;
} }
.CodeMirror pre { .CodeMirror pre {
/* Reset some styles that the rest of the page might have set */ /* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0; border-width: 0;
background: transparent; background: transparent;
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
margin: 0; margin: 0;
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
line-height: inherit; line-height: inherit;
color: inherit; color: inherit;
z-index: 2; z-index: 2;
position: relative; position: relative;
overflow: visible; overflow: visible;
} }
.CodeMirror-wrap pre { .CodeMirror-wrap pre {
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;
word-break: normal; word-break: normal;
} }
.CodeMirror-linebackground { .CodeMirror-linebackground {
position: absolute; position: absolute;
left: 0; right: 0; top: 0; bottom: 0; left: 0; right: 0; top: 0; bottom: 0;
z-index: 0; z-index: 0;
} }
.CodeMirror-linewidget { .CodeMirror-linewidget {
position: relative; position: relative;
z-index: 2; z-index: 2;
overflow: auto; overflow: auto;
} }
.CodeMirror-widget { .CodeMirror-widget {
display: inline-block; display: inline-block;
} }
.CodeMirror-wrap .CodeMirror-scroll { .CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden; overflow-x: hidden;
} }
.CodeMirror-measure { .CodeMirror-measure {
position: absolute; position: absolute;
width: 100%; height: 0px; width: 100%; height: 0px;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
} }
.CodeMirror-measure pre { position: static; } .CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
position: absolute; position: absolute;
visibility: hidden; visibility: hidden;
border-right: none; border-right: none;
width: 0; width: 0;
} }
.CodeMirror-focused div.CodeMirror-cursor { .CodeMirror-focused div.CodeMirror-cursor {
visibility: visible; visibility: visible;
} }
.CodeMirror-selected { background: #d9d9d9; } .CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.cm-searching { .cm-searching {
background: #ffa; background: #ffa;
background: rgba(255, 255, 0, .4); background: rgba(255, 255, 0, .4);
} }
/* IE7 hack to prevent it from returning funny offsetTops on the spans */ /* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; } .CodeMirror span { *vertical-align: text-bottom; }
@media print { @media print {
/* Hide the cursor when printing */ /* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursor { .CodeMirror div.CodeMirror-cursor {
visibility: hidden; visibility: hidden;
} }
} }

View File

@ -1,81 +1,81 @@
// Open simple dialogs on top of an editor. Relies on dialog.css. // Open simple dialogs on top of an editor. Relies on dialog.css.
(function() { (function() {
function dialogDiv(cm, template, bottom) { function dialogDiv(cm, template, bottom) {
var wrap = cm.getWrapperElement(); var wrap = cm.getWrapperElement();
var dialog; var dialog;
dialog = wrap.appendChild(document.createElement("div")); dialog = wrap.appendChild(document.createElement("div"));
if (bottom) { if (bottom) {
dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
} else { } else {
dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
} }
dialog.innerHTML = template; dialog.innerHTML = template;
return dialog; return dialog;
} }
CodeMirror.defineExtension("openDialog", function(template, callback, options) { CodeMirror.defineExtension("openDialog", function(template, callback, options) {
var dialog = dialogDiv(this, template, options && options.bottom); var dialog = dialogDiv(this, template, options && options.bottom);
var closed = false, me = this; var closed = false, me = this;
function close() { function close() {
if (closed) return; if (closed) return;
closed = true; closed = true;
dialog.parentNode.removeChild(dialog); dialog.parentNode.removeChild(dialog);
} }
var inp = dialog.getElementsByTagName("input")[0], button; var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) { if (inp) {
CodeMirror.on(inp, "keydown", function(e) { CodeMirror.on(inp, "keydown", function(e) {
if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
if (e.keyCode == 13 || e.keyCode == 27) { if (e.keyCode == 13 || e.keyCode == 27) {
CodeMirror.e_stop(e); CodeMirror.e_stop(e);
close(); close();
me.focus(); me.focus();
if (e.keyCode == 13) callback(inp.value); if (e.keyCode == 13) callback(inp.value);
} }
}); });
if (options && options.onKeyUp) { if (options && options.onKeyUp) {
CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
} }
if (options && options.value) inp.value = options.value; if (options && options.value) inp.value = options.value;
inp.focus(); inp.focus();
CodeMirror.on(inp, "blur", close); CodeMirror.on(inp, "blur", close);
} else if (button = dialog.getElementsByTagName("button")[0]) { } else if (button = dialog.getElementsByTagName("button")[0]) {
CodeMirror.on(button, "click", function() { CodeMirror.on(button, "click", function() {
close(); close();
me.focus(); me.focus();
}); });
button.focus(); button.focus();
CodeMirror.on(button, "blur", close); CodeMirror.on(button, "blur", close);
} }
return close; return close;
}); });
CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
var dialog = dialogDiv(this, template, options && options.bottom); var dialog = dialogDiv(this, template, options && options.bottom);
var buttons = dialog.getElementsByTagName("button"); var buttons = dialog.getElementsByTagName("button");
var closed = false, me = this, blurring = 1; var closed = false, me = this, blurring = 1;
function close() { function close() {
if (closed) return; if (closed) return;
closed = true; closed = true;
dialog.parentNode.removeChild(dialog); dialog.parentNode.removeChild(dialog);
me.focus(); me.focus();
} }
buttons[0].focus(); buttons[0].focus();
for (var i = 0; i < buttons.length; ++i) { for (var i = 0; i < buttons.length; ++i) {
var b = buttons[i]; var b = buttons[i];
(function(callback) { (function(callback) {
CodeMirror.on(b, "click", function(e) { CodeMirror.on(b, "click", function(e) {
CodeMirror.e_preventDefault(e); CodeMirror.e_preventDefault(e);
close(); close();
if (callback) callback(me); if (callback) callback(me);
}); });
})(callbacks[i]); })(callbacks[i]);
CodeMirror.on(b, "blur", function() { CodeMirror.on(b, "blur", function() {
--blurring; --blurring;
setTimeout(function() { if (blurring <= 0) close(); }, 200); setTimeout(function() { if (blurring <= 0) close(); }, 200);
}); });
CodeMirror.on(b, "focus", function() { ++blurring; }); CodeMirror.on(b, "focus", function() { ++blurring; });
} }
}); });
})(); })();

View File

@ -1,52 +1,52 @@
(function() { (function() {
var DEFAULT_BRACKETS = "()[]{}''\"\""; var DEFAULT_BRACKETS = "()[]{}''\"\"";
var SPACE_CHAR_REGEX = /\s/; var SPACE_CHAR_REGEX = /\s/;
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
var wasOn = old && old != CodeMirror.Init; var wasOn = old && old != CodeMirror.Init;
if (val && !wasOn) if (val && !wasOn)
cm.addKeyMap(buildKeymap(typeof val == "string" ? val : DEFAULT_BRACKETS)); cm.addKeyMap(buildKeymap(typeof val == "string" ? val : DEFAULT_BRACKETS));
else if (!val && wasOn) else if (!val && wasOn)
cm.removeKeyMap("autoCloseBrackets"); cm.removeKeyMap("autoCloseBrackets");
}); });
function buildKeymap(pairs) { function buildKeymap(pairs) {
var map = { var map = {
name : "autoCloseBrackets", name : "autoCloseBrackets",
Backspace: function(cm) { Backspace: function(cm) {
if (cm.somethingSelected()) return CodeMirror.Pass; if (cm.somethingSelected()) return CodeMirror.Pass;
var cur = cm.getCursor(), line = cm.getLine(cur.line); var cur = cm.getCursor(), line = cm.getLine(cur.line);
if (cur.ch && cur.ch < line.length && if (cur.ch && cur.ch < line.length &&
pairs.indexOf(line.slice(cur.ch - 1, cur.ch + 1)) % 2 == 0) pairs.indexOf(line.slice(cur.ch - 1, cur.ch + 1)) % 2 == 0)
cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1)); cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1));
else else
return CodeMirror.Pass; return CodeMirror.Pass;
} }
}; };
var closingBrackets = []; var closingBrackets = [];
for (var i = 0; i < pairs.length; i += 2) (function(left, right) { for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
if (left != right) closingBrackets.push(right); if (left != right) closingBrackets.push(right);
function surround(cm) { function surround(cm) {
var selection = cm.getSelection(); var selection = cm.getSelection();
cm.replaceSelection(left + selection + right); cm.replaceSelection(left + selection + right);
} }
function maybeOverwrite(cm) { function maybeOverwrite(cm) {
var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1)); var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass; if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass;
else cm.execCommand("goCharRight"); else cm.execCommand("goCharRight");
} }
map["'" + left + "'"] = function(cm) { map["'" + left + "'"] = function(cm) {
if (cm.somethingSelected()) return surround(cm); if (cm.somethingSelected()) return surround(cm);
if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return; if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1); var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch); var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch);
if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar)) if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar))
cm.replaceSelection(left + right, {head: ahead, anchor: ahead}); cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
else else
return CodeMirror.Pass; return CodeMirror.Pass;
}; };
if (left != right) map["'" + right + "'"] = maybeOverwrite; if (left != right) map["'" + right + "'"] = maybeOverwrite;
})(pairs.charAt(i), pairs.charAt(i + 1)); })(pairs.charAt(i), pairs.charAt(i + 1));
return map; return map;
} }
})(); })();

View File

@ -1,85 +1,85 @@
/** /**
* Tag-closer extension for CodeMirror. * Tag-closer extension for CodeMirror.
* *
* This extension adds an "autoCloseTags" option that can be set to * This extension adds an "autoCloseTags" option that can be set to
* either true to get the default behavior, or an object to further * either true to get the default behavior, or an object to further
* configure its behavior. * configure its behavior.
* *
* These are supported options: * These are supported options:
* *
* `whenClosing` (default true) * `whenClosing` (default true)
* Whether to autoclose when the '/' of a closing tag is typed. * Whether to autoclose when the '/' of a closing tag is typed.
* `whenOpening` (default true) * `whenOpening` (default true)
* Whether to autoclose the tag when the final '>' of an opening * Whether to autoclose the tag when the final '>' of an opening
* tag is typed. * tag is typed.
* `dontCloseTags` (default is empty tags for HTML, none for XML) * `dontCloseTags` (default is empty tags for HTML, none for XML)
* An array of tag names that should not be autoclosed. * An array of tag names that should not be autoclosed.
* `indentTags` (default is block tags for HTML, none for XML) * `indentTags` (default is block tags for HTML, none for XML)
* An array of tag names that should, when opened, cause a * An array of tag names that should, when opened, cause a
* blank line to be added inside the tag, and the blank line and * blank line to be added inside the tag, and the blank line and
* closing line to be indented. * closing line to be indented.
* *
* See demos/closetag.html for a usage example. * See demos/closetag.html for a usage example.
*/ */
(function() { (function() {
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
if (val && (old == CodeMirror.Init || !old)) { if (val && (old == CodeMirror.Init || !old)) {
var map = {name: "autoCloseTags"}; var map = {name: "autoCloseTags"};
if (typeof val != "object" || val.whenClosing) if (typeof val != "object" || val.whenClosing)
map["'/'"] = function(cm) { return autoCloseTag(cm, '/'); }; map["'/'"] = function(cm) { return autoCloseTag(cm, '/'); };
if (typeof val != "object" || val.whenOpening) if (typeof val != "object" || val.whenOpening)
map["'>'"] = function(cm) { return autoCloseTag(cm, '>'); }; map["'>'"] = function(cm) { return autoCloseTag(cm, '>'); };
cm.addKeyMap(map); cm.addKeyMap(map);
} else if (!val && (old != CodeMirror.Init && old)) { } else if (!val && (old != CodeMirror.Init && old)) {
cm.removeKeyMap("autoCloseTags"); cm.removeKeyMap("autoCloseTags");
} }
}); });
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
"source", "track", "wbr"]; "source", "track", "wbr"];
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4", var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"]; "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
function autoCloseTag(cm, ch) { function autoCloseTag(cm, ch) {
var pos = cm.getCursor(), tok = cm.getTokenAt(pos); var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (inner.mode.name != "xml") return CodeMirror.Pass; if (inner.mode.name != "xml") return CodeMirror.Pass;
var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
if (ch == ">" && state.tagName) { if (ch == ">" && state.tagName) {
var tagName = state.tagName; var tagName = state.tagName;
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
var lowerTagName = tagName.toLowerCase(); var lowerTagName = tagName.toLowerCase();
// Don't process the '>' at the end of an end-tag or self-closing tag // Don't process the '>' at the end of an end-tag or self-closing tag
if (tok.type == "tag" && state.type == "closeTag" || tok.string.indexOf("/") > -1 || if (tok.type == "tag" && state.type == "closeTag" || tok.string.indexOf("/") > -1 ||
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1) dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
return CodeMirror.Pass; return CodeMirror.Pass;
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1; var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1); var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1);
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">", cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
{head: curPos, anchor: curPos}); {head: curPos, anchor: curPos});
if (doIndent) { if (doIndent) {
cm.indentLine(pos.line + 1); cm.indentLine(pos.line + 1);
cm.indentLine(pos.line + 2); cm.indentLine(pos.line + 2);
} }
return; return;
} else if (ch == "/" && tok.string == "<") { } else if (ch == "/" && tok.string == "<") {
var tagName = state.context && state.context.tagName; var tagName = state.context && state.context.tagName;
if (tagName) cm.replaceSelection("/" + tagName + ">", "end"); if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
return; return;
} }
return CodeMirror.Pass; return CodeMirror.Pass;
} }
function indexOf(collection, elt) { function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt); if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i) for (var i = 0, e = collection.length; i < e; ++i)
if (collection[i] == elt) return i; if (collection[i] == elt) return i;
return -1; return -1;
} }
})(); })();

View File

@ -1,44 +1,44 @@
(function() { (function() {
var modes = ["clike", "css", "javascript"]; var modes = ["clike", "css", "javascript"];
for (var i = 0; i < modes.length; ++i) for (var i = 0; i < modes.length; ++i)
CodeMirror.extendMode(modes[i], {blockCommentStart: "/*", CodeMirror.extendMode(modes[i], {blockCommentStart: "/*",
blockCommentEnd: "*/", blockCommentEnd: "*/",
blockCommentContinue: " * "}); blockCommentContinue: " * "});
function continueComment(cm) { function continueComment(cm) {
var pos = cm.getCursor(), token = cm.getTokenAt(pos); var pos = cm.getCursor(), token = cm.getTokenAt(pos);
var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode; var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode;
var space; var space;
if (token.type == "comment" && mode.blockCommentStart) { if (token.type == "comment" && mode.blockCommentStart) {
var end = token.string.indexOf(mode.blockCommentEnd); var end = token.string.indexOf(mode.blockCommentEnd);
var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found; var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) { if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) {
// Comment ended, don't continue it // Comment ended, don't continue it
} else if (token.string.indexOf(mode.blockCommentStart) == 0) { } else if (token.string.indexOf(mode.blockCommentStart) == 0) {
space = full.slice(0, token.start); space = full.slice(0, token.start);
if (!/^\s*$/.test(space)) { if (!/^\s*$/.test(space)) {
space = ""; space = "";
for (var i = 0; i < token.start; ++i) space += " "; for (var i = 0; i < token.start; ++i) space += " ";
} }
} else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 && } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
found + mode.blockCommentContinue.length > token.start && found + mode.blockCommentContinue.length > token.start &&
/^\s*$/.test(full.slice(0, found))) { /^\s*$/.test(full.slice(0, found))) {
space = full.slice(0, found); space = full.slice(0, found);
} }
} }
if (space != null) if (space != null)
cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end"); cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end");
else else
return CodeMirror.Pass; return CodeMirror.Pass;
} }
CodeMirror.defineOption("continueComments", null, function(cm, val, prev) { CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
if (prev && prev != CodeMirror.Init) if (prev && prev != CodeMirror.Init)
cm.removeKeyMap("continueComment"); cm.removeKeyMap("continueComment");
var map = {name: "continueComment"}; var map = {name: "continueComment"};
map[typeof val == "string" ? val : "Enter"] = continueComment; map[typeof val == "string" ? val : "Enter"] = continueComment;
cm.addKeyMap(map); cm.addKeyMap(map);
}); });
})(); })();

View File

@ -1,25 +1,25 @@
(function() { (function() {
'use strict'; 'use strict';
var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/, var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/,
unorderedBullets = '*+-'; unorderedBullets = '*+-';
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
var pos = cm.getCursor(), var pos = cm.getCursor(),
inList = cm.getStateAfter(pos.line).list, inList = cm.getStateAfter(pos.line).list,
match; match;
if (!inList || !(match = cm.getLine(pos.line).match(listRE))) { if (!inList || !(match = cm.getLine(pos.line).match(listRE))) {
cm.execCommand('newlineAndIndent'); cm.execCommand('newlineAndIndent');
return; return;
} }
var indent = match[1], after = match[4]; var indent = match[1], after = match[4];
var bullet = unorderedBullets.indexOf(match[2]) >= 0 var bullet = unorderedBullets.indexOf(match[2]) >= 0
? match[2] ? match[2]
: (parseInt(match[3], 10) + 1) + '.'; : (parseInt(match[3], 10) + 1) + '.';
cm.replaceSelection('\n' + indent + bullet + after, 'end'); cm.replaceSelection('\n' + indent + bullet + after, 'end');
}; };
}()); }());

View File

@ -1,74 +1,74 @@
(function() { (function() {
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
(document.documentMode == null || document.documentMode < 8); (document.documentMode == null || document.documentMode < 8);
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
// Disable brace matching in long lines, since it'll cause hugely slow updates // Disable brace matching in long lines, since it'll cause hugely slow updates
var maxLineLen = 1000; var maxLineLen = 1000;
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
function findMatchingBracket(cm) { function findMatchingBracket(cm) {
var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1; var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
if (!match) return null; if (!match) return null;
var forward = match.charAt(1) == ">", d = forward ? 1 : -1; var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
var style = cm.getTokenAt(Pos(cur.line, pos + 1)).type; var style = cm.getTokenAt(Pos(cur.line, pos + 1)).type;
var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
function scan(line, lineNo, start) { function scan(line, lineNo, start) {
if (!line.text) return; if (!line.text) return;
var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1; var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
if (start != null) pos = start + d; if (start != null) pos = start + d;
for (; pos != end; pos += d) { for (; pos != end; pos += d) {
var ch = line.text.charAt(pos); var ch = line.text.charAt(pos);
if (re.test(ch) && cm.getTokenAt(Pos(lineNo, pos + 1)).type == style) { if (re.test(ch) && cm.getTokenAt(Pos(lineNo, pos + 1)).type == style) {
var match = matching[ch]; var match = matching[ch];
if (match.charAt(1) == ">" == forward) stack.push(ch); if (match.charAt(1) == ">" == forward) stack.push(ch);
else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
else if (!stack.length) return {pos: pos, match: true}; else if (!stack.length) return {pos: pos, match: true};
} }
} }
} }
for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) { for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
if (i == cur.line) found = scan(line, i, pos); if (i == cur.line) found = scan(line, i, pos);
else found = scan(cm.getLineHandle(i), i); else found = scan(cm.getLineHandle(i), i);
if (found) break; if (found) break;
} }
return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos), match: found && found.match}; return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos), match: found && found.match};
} }
function matchBrackets(cm, autoclear) { function matchBrackets(cm, autoclear) {
var found = findMatchingBracket(cm); var found = findMatchingBracket(cm);
if (!found || cm.getLine(found.from.line).length > maxLineLen || if (!found || cm.getLine(found.from.line).length > maxLineLen ||
found.to && cm.getLine(found.to.line).length > maxLineLen) found.to && cm.getLine(found.to.line).length > maxLineLen)
return; return;
var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style}); var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style}); var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
// Kludge to work around the IE bug from issue #1193, where text // Kludge to work around the IE bug from issue #1193, where text
// input stops going to the textare whever this fires. // input stops going to the textare whever this fires.
if (ie_lt8 && cm.state.focused) cm.display.input.focus(); if (ie_lt8 && cm.state.focused) cm.display.input.focus();
var clear = function() { var clear = function() {
cm.operation(function() { one.clear(); two && two.clear(); }); cm.operation(function() { one.clear(); two && two.clear(); });
}; };
if (autoclear) setTimeout(clear, 800); if (autoclear) setTimeout(clear, 800);
else return clear; else return clear;
} }
var currentlyHighlighted = null; var currentlyHighlighted = null;
function doMatchBrackets(cm) { function doMatchBrackets(cm) {
cm.operation(function() { cm.operation(function() {
if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false); if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
}); });
} }
CodeMirror.defineOption("matchBrackets", false, function(cm, val) { CodeMirror.defineOption("matchBrackets", false, function(cm, val) {
if (val) cm.on("cursorActivity", doMatchBrackets); if (val) cm.on("cursorActivity", doMatchBrackets);
else cm.off("cursorActivity", doMatchBrackets); else cm.off("cursorActivity", doMatchBrackets);
}); });
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);}); CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);});
})(); })();

View File

@ -1,31 +1,31 @@
CodeMirror.braceRangeFinder = function(cm, start) { CodeMirror.braceRangeFinder = function(cm, start) {
var line = start.line, lineText = cm.getLine(line); var line = start.line, lineText = cm.getLine(line);
var at = lineText.length, startChar, tokenType; var at = lineText.length, startChar, tokenType;
for (;;) { for (;;) {
var found = lineText.lastIndexOf("{", at); var found = lineText.lastIndexOf("{", at);
if (found < start.ch) break; if (found < start.ch) break;
tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type; tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type;
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; } if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
at = found - 1; at = found - 1;
} }
if (startChar == null || lineText.lastIndexOf("}") > startChar) return; if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
var count = 1, lastLine = cm.lineCount(), end, endCh; var count = 1, lastLine = cm.lineCount(), end, endCh;
outer: for (var i = line + 1; i < lastLine; ++i) { outer: for (var i = line + 1; i < lastLine; ++i) {
var text = cm.getLine(i), pos = 0; var text = cm.getLine(i), pos = 0;
for (;;) { for (;;) {
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos); var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
if (nextOpen < 0) nextOpen = text.length; if (nextOpen < 0) nextOpen = text.length;
if (nextClose < 0) nextClose = text.length; if (nextClose < 0) nextClose = text.length;
pos = Math.min(nextOpen, nextClose); pos = Math.min(nextOpen, nextClose);
if (pos == text.length) break; if (pos == text.length) break;
if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) { if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) {
if (pos == nextOpen) ++count; if (pos == nextOpen) ++count;
else if (!--count) { end = i; endCh = pos; break outer; } else if (!--count) { end = i; endCh = pos; break outer; }
} }
++pos; ++pos;
} }
} }
if (end == null || end == line + 1) return; if (end == null || end == line + 1) return;
return {from: CodeMirror.Pos(line, startChar + 1), return {from: CodeMirror.Pos(line, startChar + 1),
to: CodeMirror.Pos(end, endCh)}; to: CodeMirror.Pos(end, endCh)};
}; };

View File

@ -1,32 +1,32 @@
CodeMirror.newFoldFunction = function(rangeFinder, widget) { CodeMirror.newFoldFunction = function(rangeFinder, widget) {
if (widget == null) widget = "\u2194"; if (widget == null) widget = "\u2194";
if (typeof widget == "string") { if (typeof widget == "string") {
var text = document.createTextNode(widget); var text = document.createTextNode(widget);
widget = document.createElement("span"); widget = document.createElement("span");
widget.appendChild(text); widget.appendChild(text);
widget.className = "CodeMirror-foldmarker"; widget.className = "CodeMirror-foldmarker";
} }
return function(cm, pos) { return function(cm, pos) {
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
var range = rangeFinder(cm, pos); var range = rangeFinder(cm, pos);
if (!range) return; if (!range) return;
var present = cm.findMarksAt(range.from), cleared = 0; var present = cm.findMarksAt(range.from), cleared = 0;
for (var i = 0; i < present.length; ++i) { for (var i = 0; i < present.length; ++i) {
if (present[i].__isFold) { if (present[i].__isFold) {
++cleared; ++cleared;
present[i].clear(); present[i].clear();
} }
} }
if (cleared) return; if (cleared) return;
var myWidget = widget.cloneNode(true); var myWidget = widget.cloneNode(true);
CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();}); CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();});
var myRange = cm.markText(range.from, range.to, { var myRange = cm.markText(range.from, range.to, {
replacedWith: myWidget, replacedWith: myWidget,
clearOnEnter: true, clearOnEnter: true,
__isFold: true __isFold: true
}); });
}; };
}; };

View File

@ -1,64 +1,64 @@
CodeMirror.tagRangeFinder = (function() { CodeMirror.tagRangeFinder = (function() {
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
return function(cm, start) { return function(cm, start) {
var line = start.line, ch = start.ch, lineText = cm.getLine(line); var line = start.line, ch = start.ch, lineText = cm.getLine(line);
function nextLine() { function nextLine() {
if (line >= cm.lastLine()) return; if (line >= cm.lastLine()) return;
ch = 0; ch = 0;
lineText = cm.getLine(++line); lineText = cm.getLine(++line);
return true; return true;
} }
function toTagEnd() { function toTagEnd() {
for (;;) { for (;;) {
var gt = lineText.indexOf(">", ch); var gt = lineText.indexOf(">", ch);
if (gt == -1) { if (nextLine()) continue; else return; } if (gt == -1) { if (nextLine()) continue; else return; }
var lastSlash = lineText.lastIndexOf("/", gt); var lastSlash = lineText.lastIndexOf("/", gt);
var selfClose = lastSlash > -1 && /^\s*$/.test(lineText.slice(lastSlash + 1, gt)); var selfClose = lastSlash > -1 && /^\s*$/.test(lineText.slice(lastSlash + 1, gt));
ch = gt + 1; ch = gt + 1;
return selfClose ? "selfClose" : "regular"; return selfClose ? "selfClose" : "regular";
} }
} }
function toNextTag() { function toNextTag() {
for (;;) { for (;;) {
xmlTagStart.lastIndex = ch; xmlTagStart.lastIndex = ch;
var found = xmlTagStart.exec(lineText); var found = xmlTagStart.exec(lineText);
if (!found) { if (nextLine()) continue; else return; } if (!found) { if (nextLine()) continue; else return; }
ch = found.index + found[0].length; ch = found.index + found[0].length;
return found; return found;
} }
} }
var stack = [], startCh; var stack = [], startCh;
for (;;) { for (;;) {
var openTag = toNextTag(), end; var openTag = toNextTag(), end;
if (!openTag || line != start.line || !(end = toTagEnd())) return; if (!openTag || line != start.line || !(end = toTagEnd())) return;
if (!openTag[1] && end != "selfClose") { if (!openTag[1] && end != "selfClose") {
stack.push(openTag[2]); stack.push(openTag[2]);
startCh = ch; startCh = ch;
break; break;
} }
} }
for (;;) { for (;;) {
var next = toNextTag(), end, tagLine = line, tagCh = ch - (next ? next[0].length : 0); var next = toNextTag(), end, tagLine = line, tagCh = ch - (next ? next[0].length : 0);
if (!next || !(end = toTagEnd())) return; if (!next || !(end = toTagEnd())) return;
if (end == "selfClose") continue; if (end == "selfClose") continue;
if (next[1]) { // closing tag if (next[1]) { // closing tag
for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
stack.length = i; stack.length = i;
break; break;
} }
if (!stack.length) return { if (!stack.length) return {
from: CodeMirror.Pos(start.line, startCh), from: CodeMirror.Pos(start.line, startCh),
to: CodeMirror.Pos(tagLine, tagCh) to: CodeMirror.Pos(tagLine, tagCh)
}; };
} else { // opening tag } else { // opening tag
stack.push(next[2]); stack.push(next[2]);
} }
} }
}; };
})(); })();

View File

@ -1,43 +1,43 @@
(function() { (function() {
// Applies automatic formatting to the specified range // Applies automatic formatting to the specified range
CodeMirror.defineExtension("autoFormatAll", function (from, to) { CodeMirror.defineExtension("autoFormatAll", function (from, to) {
var cm = this; var cm = this;
var outer = cm.getMode(), text = cm.getRange(from, to).split("\n"); var outer = cm.getMode(), text = cm.getRange(from, to).split("\n");
var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state); var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);
var tabSize = cm.getOption("tabSize"); var tabSize = cm.getOption("tabSize");
var out = "", lines = 0, atSol = from.ch == 0; var out = "", lines = 0, atSol = from.ch == 0;
function newline() { function newline() {
out += "\n"; out += "\n";
atSol = true; atSol = true;
++lines; ++lines;
} }
for (var i = 0; i < text.length; ++i) { for (var i = 0; i < text.length; ++i) {
var stream = new CodeMirror.StringStream(text[i], tabSize); var stream = new CodeMirror.StringStream(text[i], tabSize);
while (!stream.eol()) { while (!stream.eol()) {
var inner = CodeMirror.innerMode(outer, state); var inner = CodeMirror.innerMode(outer, state);
var style = outer.token(stream, state), cur = stream.current(); var style = outer.token(stream, state), cur = stream.current();
stream.start = stream.pos; stream.start = stream.pos;
if (!atSol || /\S/.test(cur)) { if (!atSol || /\S/.test(cur)) {
out += cur; out += cur;
atSol = false; atSol = false;
} }
if (!atSol && inner.mode.newlineAfterToken && if (!atSol && inner.mode.newlineAfterToken &&
inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state)) inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state))
newline(); newline();
} }
if (!stream.pos && outer.blankLine) outer.blankLine(state); if (!stream.pos && outer.blankLine) outer.blankLine(state);
if (!atSol && i < text.length - 1) newline(); if (!atSol && i < text.length - 1) newline();
} }
cm.operation(function () { cm.operation(function () {
cm.replaceRange(out, from, to); cm.replaceRange(out, from, to);
for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur) for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)
cm.indentLine(cur, "smart"); cm.indentLine(cur, "smart");
cm.setCursor({ line:0, ch:0 }); cm.setCursor({ line:0, ch:0 });
}); });
}); });
})(); })();

View File

@ -1,114 +1,114 @@
(function() { (function() {
CodeMirror.extendMode("css", { CodeMirror.extendMode("css", {
commentStart: "/*", commentStart: "/*",
commentEnd: "*/", commentEnd: "*/",
newlineAfterToken: function(_type, content) { newlineAfterToken: function(_type, content) {
return /^[;{}]$/.test(content); return /^[;{}]$/.test(content);
} }
}); });
CodeMirror.extendMode("javascript", { CodeMirror.extendMode("javascript", {
commentStart: "/*", commentStart: "/*",
commentEnd: "*/", commentEnd: "*/",
// FIXME semicolons inside of for // FIXME semicolons inside of for
newlineAfterToken: function(_type, content, textAfter, state) { newlineAfterToken: function(_type, content, textAfter, state) {
if (this.jsonMode) { if (this.jsonMode) {
return /^[\[,{]$/.test(content) || /^}/.test(textAfter); return /^[\[,{]$/.test(content) || /^}/.test(textAfter);
} else { } else {
if (content == ";" && state.lexical && state.lexical.type == ")") return false; if (content == ";" && state.lexical && state.lexical.type == ")") return false;
return /^[;{}]$/.test(content) && !/^;/.test(textAfter); return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
} }
} }
}); });
var inlineElements = /^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/; var inlineElements = /^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;
CodeMirror.extendMode("xml", { CodeMirror.extendMode("xml", {
commentStart: "<!--", commentStart: "<!--",
commentEnd: "-->", commentEnd: "-->",
newlineAfterToken: function(type, content, textAfter, state) { newlineAfterToken: function(type, content, textAfter, state) {
var inline = false; var inline = false;
if (this.configuration == "html") if (this.configuration == "html")
inline = state.context ? inlineElements.test(state.context.tagName) : false; inline = state.context ? inlineElements.test(state.context.tagName) : false;
return !inline && ((type == "tag" && />$/.test(content) && state.context) || return !inline && ((type == "tag" && />$/.test(content) && state.context) ||
/^</.test(textAfter)); /^</.test(textAfter));
} }
}); });
// Comment/uncomment the specified range // Comment/uncomment the specified range
CodeMirror.defineExtension("commentRange", function (isComment, from, to) { CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode; var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;
cm.operation(function() { cm.operation(function() {
if (isComment) { // Comment range if (isComment) { // Comment range
cm.replaceRange(curMode.commentEnd, to); cm.replaceRange(curMode.commentEnd, to);
cm.replaceRange(curMode.commentStart, from); cm.replaceRange(curMode.commentStart, from);
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
cm.setCursor(from.line, from.ch + curMode.commentStart.length); cm.setCursor(from.line, from.ch + curMode.commentStart.length);
} else { // Uncomment range } else { // Uncomment range
var selText = cm.getRange(from, to); var selText = cm.getRange(from, to);
var startIndex = selText.indexOf(curMode.commentStart); var startIndex = selText.indexOf(curMode.commentStart);
var endIndex = selText.lastIndexOf(curMode.commentEnd); var endIndex = selText.lastIndexOf(curMode.commentEnd);
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) { if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
// Take string till comment start // Take string till comment start
selText = selText.substr(0, startIndex) selText = selText.substr(0, startIndex)
// From comment start till comment end // From comment start till comment end
+ selText.substring(startIndex + curMode.commentStart.length, endIndex) + selText.substring(startIndex + curMode.commentStart.length, endIndex)
// From comment end till string end // From comment end till string end
+ selText.substr(endIndex + curMode.commentEnd.length); + selText.substr(endIndex + curMode.commentEnd.length);
} }
cm.replaceRange(selText, from, to); cm.replaceRange(selText, from, to);
} }
}); });
}); });
// Applies automatic mode-aware indentation to the specified range // Applies automatic mode-aware indentation to the specified range
CodeMirror.defineExtension("autoIndentRange", function (from, to) { CodeMirror.defineExtension("autoIndentRange", function (from, to) {
var cmInstance = this; var cmInstance = this;
this.operation(function () { this.operation(function () {
for (var i = from.line; i <= to.line; i++) { for (var i = from.line; i <= to.line; i++) {
cmInstance.indentLine(i, "smart"); cmInstance.indentLine(i, "smart");
} }
}); });
}); });
// Applies automatic formatting to the specified range // Applies automatic formatting to the specified range
CodeMirror.defineExtension("autoFormatRange", function (from, to) { CodeMirror.defineExtension("autoFormatRange", function (from, to) {
var cm = this; var cm = this;
var outer = cm.getMode(), text = cm.getRange(from, to).split("\n"); var outer = cm.getMode(), text = cm.getRange(from, to).split("\n");
var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state); var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);
var tabSize = cm.getOption("tabSize"); var tabSize = cm.getOption("tabSize");
var out = "", lines = 0, atSol = from.ch == 0; var out = "", lines = 0, atSol = from.ch == 0;
function newline() { function newline() {
out += "\n"; out += "\n";
atSol = true; atSol = true;
++lines; ++lines;
} }
for (var i = 0; i < text.length; ++i) { for (var i = 0; i < text.length; ++i) {
var stream = new CodeMirror.StringStream(text[i], tabSize); var stream = new CodeMirror.StringStream(text[i], tabSize);
while (!stream.eol()) { while (!stream.eol()) {
var inner = CodeMirror.innerMode(outer, state); var inner = CodeMirror.innerMode(outer, state);
var style = outer.token(stream, state), cur = stream.current(); var style = outer.token(stream, state), cur = stream.current();
stream.start = stream.pos; stream.start = stream.pos;
if (!atSol || /\S/.test(cur)) { if (!atSol || /\S/.test(cur)) {
out += cur; out += cur;
atSol = false; atSol = false;
} }
if (!atSol && inner.mode.newlineAfterToken && if (!atSol && inner.mode.newlineAfterToken &&
inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state)) inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state))
newline(); newline();
} }
if (!stream.pos && outer.blankLine) outer.blankLine(state); if (!stream.pos && outer.blankLine) outer.blankLine(state);
if (!atSol && i < text.length - 1) newline(); if (!atSol && i < text.length - 1) newline();
} }
cm.operation(function () { cm.operation(function () {
cm.replaceRange(out, from, to); cm.replaceRange(out, from, to);
for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur) for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)
cm.indentLine(cur, "smart"); cm.indentLine(cur, "smart");
cm.setSelection(from, cm.getCursor(false)); cm.setSelection(from, cm.getCursor(false));
}); });
}); });
})(); })();

View File

@ -1,60 +1,60 @@
// Highlighting text that matches the selection // Highlighting text that matches the selection
// //
// Defines an option highlightSelectionMatches, which, when enabled, // Defines an option highlightSelectionMatches, which, when enabled,
// will style strings that match the selection throughout the // will style strings that match the selection throughout the
// document. // document.
// //
// The option can be set to true to simply enable it, or to a // The option can be set to true to simply enable it, or to a
// {minChars, style} object to explicitly configure it. minChars is // {minChars, style} object to explicitly configure it. minChars is
// the minimum amount of characters that should be selected for the // the minimum amount of characters that should be selected for the
// behavior to occur, and style is the token style to apply to the // behavior to occur, and style is the token style to apply to the
// matches. This will be prefixed by "cm-" to create an actual CSS // matches. This will be prefixed by "cm-" to create an actual CSS
// class name. // class name.
(function() { (function() {
var DEFAULT_MIN_CHARS = 2; var DEFAULT_MIN_CHARS = 2;
var DEFAULT_TOKEN_STYLE = "matchhighlight"; var DEFAULT_TOKEN_STYLE = "matchhighlight";
function State(options) { function State(options) {
this.minChars = typeof options == "object" && options.minChars || DEFAULT_MIN_CHARS; this.minChars = typeof options == "object" && options.minChars || DEFAULT_MIN_CHARS;
this.style = typeof options == "object" && options.style || DEFAULT_TOKEN_STYLE; this.style = typeof options == "object" && options.style || DEFAULT_TOKEN_STYLE;
this.overlay = null; this.overlay = null;
} }
CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) { CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
var prev = old && old != CodeMirror.Init; var prev = old && old != CodeMirror.Init;
if (val && !prev) { if (val && !prev) {
cm._matchHighlightState = new State(val); cm._matchHighlightState = new State(val);
cm.on("cursorActivity", highlightMatches); cm.on("cursorActivity", highlightMatches);
} else if (!val && prev) { } else if (!val && prev) {
var over = cm._matchHighlightState.overlay; var over = cm._matchHighlightState.overlay;
if (over) cm.removeOverlay(over); if (over) cm.removeOverlay(over);
cm._matchHighlightState = null; cm._matchHighlightState = null;
cm.off("cursorActivity", highlightMatches); cm.off("cursorActivity", highlightMatches);
} }
}); });
function highlightMatches(cm) { function highlightMatches(cm) {
cm.operation(function() { cm.operation(function() {
var state = cm._matchHighlightState; var state = cm._matchHighlightState;
if (state.overlay) { if (state.overlay) {
cm.removeOverlay(state.overlay); cm.removeOverlay(state.overlay);
state.overlay = null; state.overlay = null;
} }
if (!cm.somethingSelected()) return; if (!cm.somethingSelected()) return;
var selection = cm.getSelection().replace(/^\s+|\s+$/g, ""); var selection = cm.getSelection().replace(/^\s+|\s+$/g, "");
if (selection.length < state.minChars) return; if (selection.length < state.minChars) return;
cm.addOverlay(state.overlay = makeOverlay(selection, state.style)); cm.addOverlay(state.overlay = makeOverlay(selection, state.style));
}); });
} }
function makeOverlay(query, style) { function makeOverlay(query, style) {
return {token: function(stream) { return {token: function(stream) {
if (stream.match(query)) return style; if (stream.match(query)) return style;
stream.next(); stream.next();
stream.skipTo(query.charAt(0)) || stream.skipToEnd(); stream.skipTo(query.charAt(0)) || stream.skipToEnd();
}}; }};
} }
})(); })();

View File

@ -1,131 +1,131 @@
// Define search commands. Depends on dialog.js or another // Define search commands. Depends on dialog.js or another
// implementation of the openDialog method. // implementation of the openDialog method.
// Replace works a little oddly -- it will do the replace on the next // Replace works a little oddly -- it will do the replace on the next
// Ctrl-G (or whatever is bound to findNext) press. You prevent a // Ctrl-G (or whatever is bound to findNext) press. You prevent a
// replace by making sure the match is no longer selected when hitting // replace by making sure the match is no longer selected when hitting
// Ctrl-G. // Ctrl-G.
(function() { (function() {
function searchOverlay(query) { function searchOverlay(query) {
if (typeof query == "string") return {token: function(stream) { if (typeof query == "string") return {token: function(stream) {
if (stream.match(query)) return "searching"; if (stream.match(query)) return "searching";
stream.next(); stream.next();
stream.skipTo(query.charAt(0)) || stream.skipToEnd(); stream.skipTo(query.charAt(0)) || stream.skipToEnd();
}}; }};
return {token: function(stream) { return {token: function(stream) {
if (stream.match(query)) return "searching"; if (stream.match(query)) return "searching";
while (!stream.eol()) { while (!stream.eol()) {
stream.next(); stream.next();
if (stream.match(query, false)) break; if (stream.match(query, false)) break;
} }
}}; }};
} }
function SearchState() { function SearchState() {
this.posFrom = this.posTo = this.query = null; this.posFrom = this.posTo = this.query = null;
this.overlay = null; this.overlay = null;
} }
function getSearchState(cm) { function getSearchState(cm) {
return cm._searchState || (cm._searchState = new SearchState()); return cm._searchState || (cm._searchState = new SearchState());
} }
function getSearchCursor(cm, query, pos) { function getSearchCursor(cm, query, pos) {
// Heuristic: if the query string is all lowercase, do a case insensitive search. // Heuristic: if the query string is all lowercase, do a case insensitive search.
return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase()); return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
} }
function dialog(cm, text, shortText, f) { function dialog(cm, text, shortText, f) {
if (cm.openDialog) cm.openDialog(text, f); if (cm.openDialog) cm.openDialog(text, f);
else f(prompt(shortText, "")); else f(prompt(shortText, ""));
} }
function confirmDialog(cm, text, shortText, fs) { function confirmDialog(cm, text, shortText, fs) {
if (cm.openConfirm) cm.openConfirm(text, fs); if (cm.openConfirm) cm.openConfirm(text, fs);
else if (confirm(shortText)) fs[0](); else if (confirm(shortText)) fs[0]();
} }
function parseQuery(query) { function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/); var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query; return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
} }
var queryDialog = var queryDialog =
'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>'; 'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
function doSearch(cm, rev) { function doSearch(cm, rev) {
var state = getSearchState(cm); var state = getSearchState(cm);
if (state.query) return findNext(cm, rev); if (state.query) return findNext(cm, rev);
dialog(cm, queryDialog, "Search for:", function(query) { dialog(cm, queryDialog, "Search for:", function(query) {
cm.operation(function() { cm.operation(function() {
if (!query || state.query) return; if (!query || state.query) return;
state.query = parseQuery(query); state.query = parseQuery(query);
cm.removeOverlay(state.overlay); cm.removeOverlay(state.overlay);
state.overlay = searchOverlay(query); state.overlay = searchOverlay(query);
cm.addOverlay(state.overlay); cm.addOverlay(state.overlay);
state.posFrom = state.posTo = cm.getCursor(); state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev); findNext(cm, rev);
}); });
}); });
} }
function findNext(cm, rev) {cm.operation(function() { function findNext(cm, rev) {cm.operation(function() {
var state = getSearchState(cm); var state = getSearchState(cm);
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
if (!cursor.find(rev)) { if (!cursor.find(rev)) {
cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0)); cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
if (!cursor.find(rev)) return; if (!cursor.find(rev)) return;
} }
cm.setSelection(cursor.from(), cursor.to()); cm.setSelection(cursor.from(), cursor.to());
state.posFrom = cursor.from(); state.posTo = cursor.to(); state.posFrom = cursor.from(); state.posTo = cursor.to();
});} });}
function clearSearch(cm) {cm.operation(function() { function clearSearch(cm) {cm.operation(function() {
var state = getSearchState(cm); var state = getSearchState(cm);
if (!state.query) return; if (!state.query) return;
state.query = null; state.query = null;
cm.removeOverlay(state.overlay); cm.removeOverlay(state.overlay);
});} });}
var replaceQueryDialog = var replaceQueryDialog =
'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>'; 'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>'; var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>"; var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
function replace(cm, all) { function replace(cm, all) {
dialog(cm, replaceQueryDialog, "Replace:", function(query) { dialog(cm, replaceQueryDialog, "Replace:", function(query) {
if (!query) return; if (!query) return;
query = parseQuery(query); query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Replace with:", function(text) { dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
if (all) { if (all) {
cm.operation(function() { cm.operation(function() {
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
if (typeof query != "string") { if (typeof query != "string") {
var match = cm.getRange(cursor.from(), cursor.to()).match(query); var match = cm.getRange(cursor.from(), cursor.to()).match(query);
cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];})); cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];}));
} else cursor.replace(text); } else cursor.replace(text);
} }
}); });
} else { } else {
clearSearch(cm); clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor()); var cursor = getSearchCursor(cm, query, cm.getCursor());
var advance = function() { var advance = function() {
var start = cursor.from(), match; var start = cursor.from(), match;
if (!(match = cursor.findNext())) { if (!(match = cursor.findNext())) {
cursor = getSearchCursor(cm, query); cursor = getSearchCursor(cm, query);
if (!(match = cursor.findNext()) || if (!(match = cursor.findNext()) ||
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
} }
cm.setSelection(cursor.from(), cursor.to()); cm.setSelection(cursor.from(), cursor.to());
confirmDialog(cm, doReplaceConfirm, "Replace?", confirmDialog(cm, doReplaceConfirm, "Replace?",
[function() {doReplace(match);}, advance]); [function() {doReplace(match);}, advance]);
}; };
var doReplace = function(match) { var doReplace = function(match) {
cursor.replace(typeof query == "string" ? text : cursor.replace(typeof query == "string" ? text :
text.replace(/\$(\d)/, function(_, i) {return match[i];})); text.replace(/\$(\d)/, function(_, i) {return match[i];}));
advance(); advance();
}; };
advance(); advance();
} }
}); });
}); });
} }
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
CodeMirror.commands.findNext = doSearch; CodeMirror.commands.findNext = doSearch;
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
CodeMirror.commands.clearSearch = clearSearch; CodeMirror.commands.clearSearch = clearSearch;
CodeMirror.commands.replace = replace; CodeMirror.commands.replace = replace;
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
})(); })();

View File

@ -1,130 +1,130 @@
(function(){ (function(){
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
function SearchCursor(cm, query, pos, caseFold) { function SearchCursor(cm, query, pos, caseFold) {
this.atOccurrence = false; this.cm = cm; this.atOccurrence = false; this.cm = cm;
if (caseFold == null && typeof query == "string") caseFold = false; if (caseFold == null && typeof query == "string") caseFold = false;
pos = pos ? cm.clipPos(pos) : Pos(0, 0); pos = pos ? cm.clipPos(pos) : Pos(0, 0);
this.pos = {from: pos, to: pos}; this.pos = {from: pos, to: pos};
// The matches method is filled in based on the type of query. // The matches method is filled in based on the type of query.
// It takes a position and a direction, and returns an object // It takes a position and a direction, and returns an object
// describing the next occurrence of the query, or null if no // describing the next occurrence of the query, or null if no
// more matches were found. // more matches were found.
if (typeof query != "string") { // Regexp match if (typeof query != "string") { // Regexp match
if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g"); if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g");
this.matches = function(reverse, pos) { this.matches = function(reverse, pos) {
if (reverse) { if (reverse) {
query.lastIndex = 0; query.lastIndex = 0;
var line = cm.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start; var line = cm.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start;
for (;;) { for (;;) {
query.lastIndex = cutOff; query.lastIndex = cutOff;
var newMatch = query.exec(line); var newMatch = query.exec(line);
if (!newMatch) break; if (!newMatch) break;
match = newMatch; match = newMatch;
start = match.index; start = match.index;
cutOff = match.index + 1; cutOff = match.index + 1;
} }
} else { } else {
query.lastIndex = pos.ch; query.lastIndex = pos.ch;
var line = cm.getLine(pos.line), match = query.exec(line), var line = cm.getLine(pos.line), match = query.exec(line),
start = match && match.index; start = match && match.index;
} }
if (match && match[0]) if (match && match[0])
return {from: Pos(pos.line, start), return {from: Pos(pos.line, start),
to: Pos(pos.line, start + match[0].length), to: Pos(pos.line, start + match[0].length),
match: match}; match: match};
}; };
} else { // String query } else { // String query
if (caseFold) query = query.toLowerCase(); if (caseFold) query = query.toLowerCase();
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
var target = query.split("\n"); var target = query.split("\n");
// Different methods for single-line and multi-line queries // Different methods for single-line and multi-line queries
if (target.length == 1) { if (target.length == 1) {
if (!query.length) { if (!query.length) {
// Empty string would match anything and never progress, so // Empty string would match anything and never progress, so
// we define it to match nothing instead. // we define it to match nothing instead.
this.matches = function() {}; this.matches = function() {};
} else { } else {
this.matches = function(reverse, pos) { this.matches = function(reverse, pos) {
var line = fold(cm.getLine(pos.line)), len = query.length, match; var line = fold(cm.getLine(pos.line)), len = query.length, match;
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1) if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
: (match = line.indexOf(query, pos.ch)) != -1) : (match = line.indexOf(query, pos.ch)) != -1)
return {from: Pos(pos.line, match), return {from: Pos(pos.line, match),
to: Pos(pos.line, match + len)}; to: Pos(pos.line, match + len)};
}; };
} }
} else { } else {
this.matches = function(reverse, pos) { this.matches = function(reverse, pos) {
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln)); var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match)); var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= pos.ch || offsetA != match.length if (reverse ? offsetA >= pos.ch || offsetA != match.length
: offsetA <= pos.ch || offsetA != line.length - match.length) : offsetA <= pos.ch || offsetA != line.length - match.length)
return; return;
for (;;) { for (;;) {
if (reverse ? !ln : ln == cm.lineCount() - 1) return; if (reverse ? !ln : ln == cm.lineCount() - 1) return;
line = fold(cm.getLine(ln += reverse ? -1 : 1)); line = fold(cm.getLine(ln += reverse ? -1 : 1));
match = target[reverse ? --idx : ++idx]; match = target[reverse ? --idx : ++idx];
if (idx > 0 && idx < target.length - 1) { if (idx > 0 && idx < target.length - 1) {
if (line != match) return; if (line != match) return;
else continue; else continue;
} }
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length); var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
if (reverse ? offsetB != line.length - match.length : offsetB != match.length) if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
return; return;
var start = Pos(pos.line, offsetA), end = Pos(ln, offsetB); var start = Pos(pos.line, offsetA), end = Pos(ln, offsetB);
return {from: reverse ? end : start, to: reverse ? start : end}; return {from: reverse ? end : start, to: reverse ? start : end};
} }
}; };
} }
} }
} }
SearchCursor.prototype = { SearchCursor.prototype = {
findNext: function() {return this.find(false);}, findNext: function() {return this.find(false);},
findPrevious: function() {return this.find(true);}, findPrevious: function() {return this.find(true);},
find: function(reverse) { find: function(reverse) {
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to); var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
function savePosAndFail(line) { function savePosAndFail(line) {
var pos = Pos(line, 0); var pos = Pos(line, 0);
self.pos = {from: pos, to: pos}; self.pos = {from: pos, to: pos};
self.atOccurrence = false; self.atOccurrence = false;
return false; return false;
} }
for (;;) { for (;;) {
if (this.pos = this.matches(reverse, pos)) { if (this.pos = this.matches(reverse, pos)) {
if (!this.pos.from || !this.pos.to) { console.log(this.matches, this.pos); } if (!this.pos.from || !this.pos.to) { console.log(this.matches, this.pos); }
this.atOccurrence = true; this.atOccurrence = true;
return this.pos.match || true; return this.pos.match || true;
} }
if (reverse) { if (reverse) {
if (!pos.line) return savePosAndFail(0); if (!pos.line) return savePosAndFail(0);
pos = Pos(pos.line-1, this.cm.getLine(pos.line-1).length); pos = Pos(pos.line-1, this.cm.getLine(pos.line-1).length);
} }
else { else {
var maxLine = this.cm.lineCount(); var maxLine = this.cm.lineCount();
if (pos.line == maxLine - 1) return savePosAndFail(maxLine); if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
pos = Pos(pos.line + 1, 0); pos = Pos(pos.line + 1, 0);
} }
} }
}, },
from: function() {if (this.atOccurrence) return this.pos.from;}, from: function() {if (this.atOccurrence) return this.pos.from;},
to: function() {if (this.atOccurrence) return this.pos.to;}, to: function() {if (this.atOccurrence) return this.pos.to;},
replace: function(newText) { replace: function(newText) {
if (!this.atOccurrence) return; if (!this.atOccurrence) return;
var lines = CodeMirror.splitLines(newText); var lines = CodeMirror.splitLines(newText);
this.cm.replaceRange(lines, this.pos.from, this.pos.to); this.cm.replaceRange(lines, this.pos.from, this.pos.to);
this.pos.to = Pos(this.pos.from.line + lines.length - 1, this.pos.to = Pos(this.pos.from.line + lines.length - 1,
lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0)); lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0));
} }
}; };
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
return new SearchCursor(this, query, pos, caseFold); return new SearchCursor(this, query, pos, caseFold);
}); });
})(); })();

View File

@ -1,104 +1,104 @@
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
var cssMode = CodeMirror.getMode(config, "css"); var cssMode = CodeMirror.getMode(config, "css");
var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes; var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i, scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
mode: CodeMirror.getMode(config, "javascript")}); mode: CodeMirror.getMode(config, "javascript")});
if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) { if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
var conf = scriptTypesConf[i]; var conf = scriptTypesConf[i];
scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)}); scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
} }
scriptTypes.push({matches: /./, scriptTypes.push({matches: /./,
mode: CodeMirror.getMode(config, "text/plain")}); mode: CodeMirror.getMode(config, "text/plain")});
function html(stream, state) { function html(stream, state) {
var tagName = state.htmlState.tagName; var tagName = state.htmlState.tagName;
var style = htmlMode.token(stream, state.htmlState); var style = htmlMode.token(stream, state.htmlState);
if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") { if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
// Script block: mode to change to depends on type attribute // Script block: mode to change to depends on type attribute
var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i); var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
scriptType = scriptType ? scriptType[1] : ""; scriptType = scriptType ? scriptType[1] : "";
if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1); if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
for (var i = 0; i < scriptTypes.length; ++i) { for (var i = 0; i < scriptTypes.length; ++i) {
var tp = scriptTypes[i]; var tp = scriptTypes[i];
if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) { if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
if (tp.mode) { if (tp.mode) {
state.token = script; state.token = script;
state.localMode = tp.mode; state.localMode = tp.mode;
state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, "")); state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
} }
break; break;
} }
} }
} else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") { } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
state.token = css; state.token = css;
state.localMode = cssMode; state.localMode = cssMode;
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
} }
return style; return style;
} }
function maybeBackup(stream, pat, style) { function maybeBackup(stream, pat, style) {
var cur = stream.current(); var cur = stream.current();
var close = cur.search(pat), m; var close = cur.search(pat), m;
if (close > -1) stream.backUp(cur.length - close); if (close > -1) stream.backUp(cur.length - close);
else if (m = cur.match(/<\/?$/)) { else if (m = cur.match(/<\/?$/)) {
stream.backUp(cur.length); stream.backUp(cur.length);
if (!stream.match(pat, false)) stream.match(cur[0]); if (!stream.match(pat, false)) stream.match(cur[0]);
} }
return style; return style;
} }
function script(stream, state) { function script(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) { if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html; state.token = html;
state.localState = state.localMode = null; state.localState = state.localMode = null;
return html(stream, state); return html(stream, state);
} }
return maybeBackup(stream, /<\/\s*script\s*>/, return maybeBackup(stream, /<\/\s*script\s*>/,
state.localMode.token(stream, state.localState)); state.localMode.token(stream, state.localState));
} }
function css(stream, state) { function css(stream, state) {
if (stream.match(/^<\/\s*style\s*>/i, false)) { if (stream.match(/^<\/\s*style\s*>/i, false)) {
state.token = html; state.token = html;
state.localState = state.localMode = null; state.localState = state.localMode = null;
return html(stream, state); return html(stream, state);
} }
return maybeBackup(stream, /<\/\s*style\s*>/, return maybeBackup(stream, /<\/\s*style\s*>/,
cssMode.token(stream, state.localState)); cssMode.token(stream, state.localState));
} }
return { return {
startState: function() { startState: function() {
var state = htmlMode.startState(); var state = htmlMode.startState();
return {token: html, localMode: null, localState: null, htmlState: state}; return {token: html, localMode: null, localState: null, htmlState: state};
}, },
copyState: function(state) { copyState: function(state) {
if (state.localState) if (state.localState)
var local = CodeMirror.copyState(state.localMode, state.localState); var local = CodeMirror.copyState(state.localMode, state.localState);
return {token: state.token, localMode: state.localMode, localState: local, return {token: state.token, localMode: state.localMode, localState: local,
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
}, },
token: function(stream, state) { token: function(stream, state) {
return state.token(stream, state); return state.token(stream, state);
}, },
indent: function(state, textAfter) { indent: function(state, textAfter) {
if (!state.localMode || /^\s*<\//.test(textAfter)) if (!state.localMode || /^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState, textAfter); return htmlMode.indent(state.htmlState, textAfter);
else if (state.localMode.indent) else if (state.localMode.indent)
return state.localMode.indent(state.localState, textAfter); return state.localMode.indent(state.localState, textAfter);
else else
return CodeMirror.Pass; return CodeMirror.Pass;
}, },
electricChars: "/{}:", electricChars: "/{}:",
innerMode: function(state) { innerMode: function(state) {
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode}; return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
} }
}; };
}, "xml", "javascript", "css"); }, "xml", "javascript", "css");
CodeMirror.defineMIME("text/html", "htmlmixed"); CodeMirror.defineMIME("text/html", "htmlmixed");

View File

@ -1,437 +1,437 @@
// TODO actually recognize syntax of TypeScript constructs // TODO actually recognize syntax of TypeScript constructs
CodeMirror.defineMode("javascript", function(config, parserConfig) { CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit; var indentUnit = config.indentUnit;
var jsonMode = parserConfig.json; var jsonMode = parserConfig.json;
var isTS = parserConfig.typescript; var isTS = parserConfig.typescript;
// Tokenizer // Tokenizer
var keywords = function(){ var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};} function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"}; var operator = kw("operator"), atom = {type: "atom", style: "atom"};
var jsKeywords = { var jsKeywords = {
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
"var": kw("var"), "const": kw("var"), "let": kw("var"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
"function": kw("function"), "catch": kw("catch"), "function": kw("function"), "catch": kw("catch"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "typeof": operator, "instanceof": operator, "in": operator, "typeof": operator, "instanceof": operator,
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
"this": kw("this") "this": kw("this")
}; };
// Extend the 'normal' keywords with the TypeScript language extensions // Extend the 'normal' keywords with the TypeScript language extensions
if (isTS) { if (isTS) {
var type = {type: "variable", style: "variable-3"}; var type = {type: "variable", style: "variable-3"};
var tsKeywords = { var tsKeywords = {
// object-like things // object-like things
"interface": kw("interface"), "interface": kw("interface"),
"class": kw("class"), "class": kw("class"),
"extends": kw("extends"), "extends": kw("extends"),
"constructor": kw("constructor"), "constructor": kw("constructor"),
// scope modifiers // scope modifiers
"public": kw("public"), "public": kw("public"),
"private": kw("private"), "private": kw("private"),
"protected": kw("protected"), "protected": kw("protected"),
"static": kw("static"), "static": kw("static"),
"super": kw("super"), "super": kw("super"),
// types // types
"string": type, "number": type, "bool": type, "any": type "string": type, "number": type, "bool": type, "any": type
}; };
for (var attr in tsKeywords) { for (var attr in tsKeywords) {
jsKeywords[attr] = tsKeywords[attr]; jsKeywords[attr] = tsKeywords[attr];
} }
} }
return jsKeywords; return jsKeywords;
}(); }();
var isOperatorChar = /[+\-*&%=<>!?|~^]/; var isOperatorChar = /[+\-*&%=<>!?|~^]/;
function chain(stream, state, f) { function chain(stream, state, f) {
state.tokenize = f; state.tokenize = f;
return f(stream, state); return f(stream, state);
} }
function nextUntilUnescaped(stream, end) { function nextUntilUnescaped(stream, end) {
var escaped = false, next; var escaped = false, next;
while ((next = stream.next()) != null) { while ((next = stream.next()) != null) {
if (next == end && !escaped) if (next == end && !escaped)
return false; return false;
escaped = !escaped && next == "\\"; escaped = !escaped && next == "\\";
} }
return escaped; return escaped;
} }
// Used as scratch variables to communicate multiple values without // Used as scratch variables to communicate multiple values without
// consing up tons of objects. // consing up tons of objects.
var type, content; var type, content;
function ret(tp, style, cont) { function ret(tp, style, cont) {
type = tp; content = cont; type = tp; content = cont;
return style; return style;
} }
function jsTokenBase(stream, state) { function jsTokenBase(stream, state) {
var ch = stream.next(); var ch = stream.next();
if (ch == '"' || ch == "'") if (ch == '"' || ch == "'")
return chain(stream, state, jsTokenString(ch)); return chain(stream, state, jsTokenString(ch));
else if (/[\[\]{}\(\),;\:\.]/.test(ch)) else if (/[\[\]{}\(\),;\:\.]/.test(ch))
return ret(ch); return ret(ch);
else if (ch == "0" && stream.eat(/x/i)) { else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i); stream.eatWhile(/[\da-f]/i);
return ret("number", "number"); return ret("number", "number");
} }
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) { else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
return ret("number", "number"); return ret("number", "number");
} }
else if (ch == "/") { else if (ch == "/") {
if (stream.eat("*")) { if (stream.eat("*")) {
return chain(stream, state, jsTokenComment); return chain(stream, state, jsTokenComment);
} }
else if (stream.eat("/")) { else if (stream.eat("/")) {
stream.skipToEnd(); stream.skipToEnd();
return ret("comment", "comment"); return ret("comment", "comment");
} }
else if (state.lastType == "operator" || state.lastType == "keyword c" || else if (state.lastType == "operator" || state.lastType == "keyword c" ||
/^[\[{}\(,;:]$/.test(state.lastType)) { /^[\[{}\(,;:]$/.test(state.lastType)) {
nextUntilUnescaped(stream, "/"); nextUntilUnescaped(stream, "/");
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
return ret("regexp", "string-2"); return ret("regexp", "string-2");
} }
else { else {
stream.eatWhile(isOperatorChar); stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current()); return ret("operator", null, stream.current());
} }
} }
else if (ch == "#") { else if (ch == "#") {
stream.skipToEnd(); stream.skipToEnd();
return ret("error", "error"); return ret("error", "error");
} }
else if (isOperatorChar.test(ch)) { else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar); stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current()); return ret("operator", null, stream.current());
} }
else { else {
stream.eatWhile(/[\w\$_]/); stream.eatWhile(/[\w\$_]/);
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.lastType != ".") ? ret(known.type, known.style, word) : return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
ret("variable", "variable", word); ret("variable", "variable", word);
} }
} }
function jsTokenString(quote) { function jsTokenString(quote) {
return function(stream, state) { return function(stream, state) {
if (!nextUntilUnescaped(stream, quote)) if (!nextUntilUnescaped(stream, quote))
state.tokenize = jsTokenBase; state.tokenize = jsTokenBase;
return ret("string", "string"); return ret("string", "string");
}; };
} }
function jsTokenComment(stream, state) { function jsTokenComment(stream, state) {
var maybeEnd = false, ch; var maybeEnd = false, ch;
while (ch = stream.next()) { while (ch = stream.next()) {
if (ch == "/" && maybeEnd) { if (ch == "/" && maybeEnd) {
state.tokenize = jsTokenBase; state.tokenize = jsTokenBase;
break; break;
} }
maybeEnd = (ch == "*"); maybeEnd = (ch == "*");
} }
return ret("comment", "comment"); return ret("comment", "comment");
} }
// Parser // Parser
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true}; var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true};
function JSLexical(indented, column, type, align, prev, info) { function JSLexical(indented, column, type, align, prev, info) {
this.indented = indented; this.indented = indented;
this.column = column; this.column = column;
this.type = type; this.type = type;
this.prev = prev; this.prev = prev;
this.info = info; this.info = info;
if (align != null) this.align = align; if (align != null) this.align = align;
} }
function inScope(state, varname) { function inScope(state, varname) {
for (var v = state.localVars; v; v = v.next) for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return true; if (v.name == varname) return true;
} }
function parseJS(state, style, type, content, stream) { function parseJS(state, style, type, content, stream) {
var cc = state.cc; var cc = state.cc;
// Communicate our context to the combinators. // Communicate our context to the combinators.
// (Less wasteful than consing up a hundred closures on every call.) // (Less wasteful than consing up a hundred closures on every call.)
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
if (!state.lexical.hasOwnProperty("align")) if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = true; state.lexical.align = true;
while(true) { while(true) {
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
if (combinator(type, content)) { if (combinator(type, content)) {
while(cc.length && cc[cc.length - 1].lex) while(cc.length && cc[cc.length - 1].lex)
cc.pop()(); cc.pop()();
if (cx.marked) return cx.marked; if (cx.marked) return cx.marked;
if (type == "variable" && inScope(state, content)) return "variable-2"; if (type == "variable" && inScope(state, content)) return "variable-2";
return style; return style;
} }
} }
} }
// Combinator utils // Combinator utils
var cx = {state: null, column: null, marked: null, cc: null}; var cx = {state: null, column: null, marked: null, cc: null};
function pass() { function pass() {
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
} }
function cont() { function cont() {
pass.apply(null, arguments); pass.apply(null, arguments);
return true; return true;
} }
function register(varname) { function register(varname) {
function inList(list) { function inList(list) {
for (var v = list; v; v = v.next) for (var v = list; v; v = v.next)
if (v.name == varname) return true; if (v.name == varname) return true;
return false; return false;
} }
var state = cx.state; var state = cx.state;
if (state.context) { if (state.context) {
cx.marked = "def"; cx.marked = "def";
if (inList(state.localVars)) return; if (inList(state.localVars)) return;
state.localVars = {name: varname, next: state.localVars}; state.localVars = {name: varname, next: state.localVars};
} else { } else {
if (inList(state.globalVars)) return; if (inList(state.globalVars)) return;
state.globalVars = {name: varname, next: state.globalVars}; state.globalVars = {name: varname, next: state.globalVars};
} }
} }
// Combinators // Combinators
var defaultVars = {name: "this", next: {name: "arguments"}}; var defaultVars = {name: "this", next: {name: "arguments"}};
function pushcontext() { function pushcontext() {
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
cx.state.localVars = defaultVars; cx.state.localVars = defaultVars;
} }
function popcontext() { function popcontext() {
cx.state.localVars = cx.state.context.vars; cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev; cx.state.context = cx.state.context.prev;
} }
function pushlex(type, info) { function pushlex(type, info) {
var result = function() { var result = function() {
var state = cx.state; var state = cx.state;
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info); state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
}; };
result.lex = true; result.lex = true;
return result; return result;
} }
function poplex() { function poplex() {
var state = cx.state; var state = cx.state;
if (state.lexical.prev) { if (state.lexical.prev) {
if (state.lexical.type == ")") if (state.lexical.type == ")")
state.indented = state.lexical.indented; state.indented = state.lexical.indented;
state.lexical = state.lexical.prev; state.lexical = state.lexical.prev;
} }
} }
poplex.lex = true; poplex.lex = true;
function expect(wanted) { function expect(wanted) {
return function(type) { return function(type) {
if (type == wanted) return cont(); if (type == wanted) return cont();
else if (wanted == ";") return pass(); else if (wanted == ";") return pass();
else return cont(arguments.callee); else return cont(arguments.callee);
}; };
} }
function statement(type) { function statement(type) {
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex); if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex); if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
if (type == "{") return cont(pushlex("}"), block, poplex); if (type == "{") return cont(pushlex("}"), block, poplex);
if (type == ";") return cont(); if (type == ";") return cont();
if (type == "function") return cont(functiondef); if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
poplex, statement, poplex); poplex, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel); if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
block, poplex, poplex); block, poplex, poplex);
if (type == "case") return cont(expression, expect(":")); if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":")); if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext); statement, poplex, popcontext);
return pass(pushlex("stat"), expression, expect(";"), poplex); return pass(pushlex("stat"), expression, expect(";"), poplex);
} }
function expression(type) { function expression(type) {
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
if (type == "function") return cont(functiondef); if (type == "function") return cont(functiondef);
if (type == "keyword c") return cont(maybeexpression); if (type == "keyword c") return cont(maybeexpression);
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
if (type == "operator") return cont(expression); if (type == "operator") return cont(expression);
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
return cont(); return cont();
} }
function maybeexpression(type) { function maybeexpression(type) {
if (type.match(/[;\}\)\],]/)) return pass(); if (type.match(/[;\}\)\],]/)) return pass();
return pass(expression); return pass(expression);
} }
function maybeoperator(type, value) { function maybeoperator(type, value) {
if (type == "operator") { if (type == "operator") {
if (/\+\+|--/.test(value)) return cont(maybeoperator); if (/\+\+|--/.test(value)) return cont(maybeoperator);
if (value == "?") return cont(expression, expect(":"), expression); if (value == "?") return cont(expression, expect(":"), expression);
return cont(expression); return cont(expression);
} }
if (type == ";") return; if (type == ";") return;
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
if (type == ".") return cont(property, maybeoperator); if (type == ".") return cont(property, maybeoperator);
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator); if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
} }
function maybelabel(type) { function maybelabel(type) {
if (type == ":") return cont(poplex, statement); if (type == ":") return cont(poplex, statement);
return pass(maybeoperator, expect(";"), poplex); return pass(maybeoperator, expect(";"), poplex);
} }
function property(type) { function property(type) {
if (type == "variable") {cx.marked = "property"; return cont();} if (type == "variable") {cx.marked = "property"; return cont();}
} }
function objprop(type, value) { function objprop(type, value) {
if (type == "variable") { if (type == "variable") {
cx.marked = "property"; cx.marked = "property";
if (value == "get" || value == "set") return cont(getterSetter); if (value == "get" || value == "set") return cont(getterSetter);
} else if (type == "number" || type == "string") { } else if (type == "number" || type == "string") {
cx.marked = type + " property"; cx.marked = type + " property";
} }
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression); if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
} }
function getterSetter(type) { function getterSetter(type) {
if (type == ":") return cont(expression); if (type == ":") return cont(expression);
if (type != "variable") return cont(expect(":"), expression); if (type != "variable") return cont(expect(":"), expression);
cx.marked = "property"; cx.marked = "property";
return cont(functiondef); return cont(functiondef);
} }
function commasep(what, end) { function commasep(what, end) {
function proceed(type) { function proceed(type) {
if (type == ",") return cont(what, proceed); if (type == ",") return cont(what, proceed);
if (type == end) return cont(); if (type == end) return cont();
return cont(expect(end)); return cont(expect(end));
} }
return function(type) { return function(type) {
if (type == end) return cont(); if (type == end) return cont();
else return pass(what, proceed); else return pass(what, proceed);
}; };
} }
function block(type) { function block(type) {
if (type == "}") return cont(); if (type == "}") return cont();
return pass(statement, block); return pass(statement, block);
} }
function maybetype(type) { function maybetype(type) {
if (type == ":") return cont(typedef); if (type == ":") return cont(typedef);
return pass(); return pass();
} }
function typedef(type) { function typedef(type) {
if (type == "variable"){cx.marked = "variable-3"; return cont();} if (type == "variable"){cx.marked = "variable-3"; return cont();}
return pass(); return pass();
} }
function vardef1(type, value) { function vardef1(type, value) {
if (type == "variable") { if (type == "variable") {
register(value); register(value);
return isTS ? cont(maybetype, vardef2) : cont(vardef2); return isTS ? cont(maybetype, vardef2) : cont(vardef2);
} }
return pass(); return pass();
} }
function vardef2(type, value) { function vardef2(type, value) {
if (value == "=") return cont(expression, vardef2); if (value == "=") return cont(expression, vardef2);
if (type == ",") return cont(vardef1); if (type == ",") return cont(vardef1);
} }
function forspec1(type) { function forspec1(type) {
if (type == "var") return cont(vardef1, expect(";"), forspec2); if (type == "var") return cont(vardef1, expect(";"), forspec2);
if (type == ";") return cont(forspec2); if (type == ";") return cont(forspec2);
if (type == "variable") return cont(formaybein); if (type == "variable") return cont(formaybein);
return cont(forspec2); return cont(forspec2);
} }
function formaybein(_type, value) { function formaybein(_type, value) {
if (value == "in") return cont(expression); if (value == "in") return cont(expression);
return cont(maybeoperator, forspec2); return cont(maybeoperator, forspec2);
} }
function forspec2(type, value) { function forspec2(type, value) {
if (type == ";") return cont(forspec3); if (type == ";") return cont(forspec3);
if (value == "in") return cont(expression); if (value == "in") return cont(expression);
return cont(expression, expect(";"), forspec3); return cont(expression, expect(";"), forspec3);
} }
function forspec3(type) { function forspec3(type) {
if (type != ")") cont(expression); if (type != ")") cont(expression);
} }
function functiondef(type, value) { function functiondef(type, value) {
if (type == "variable") {register(value); return cont(functiondef);} if (type == "variable") {register(value); return cont(functiondef);}
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext); if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
} }
function funarg(type, value) { function funarg(type, value) {
if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();} if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();}
} }
// Interface // Interface
return { return {
startState: function(basecolumn) { startState: function(basecolumn) {
return { return {
tokenize: jsTokenBase, tokenize: jsTokenBase,
lastType: null, lastType: null,
cc: [], cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars, localVars: parserConfig.localVars,
globalVars: parserConfig.globalVars, globalVars: parserConfig.globalVars,
context: parserConfig.localVars && {vars: parserConfig.localVars}, context: parserConfig.localVars && {vars: parserConfig.localVars},
indented: 0 indented: 0
}; };
}, },
token: function(stream, state) { token: function(stream, state) {
if (stream.sol()) { if (stream.sol()) {
if (!state.lexical.hasOwnProperty("align")) if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = false; state.lexical.align = false;
state.indented = stream.indentation(); state.indented = stream.indentation();
} }
if (stream.eatSpace()) return null; if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state); var style = state.tokenize(stream, state);
if (type == "comment") return style; if (type == "comment") return style;
state.lastType = type; state.lastType = type;
return parseJS(state, style, type, content, stream); return parseJS(state, style, type, content, stream);
}, },
indent: function(state, textAfter) { indent: function(state, textAfter) {
if (state.tokenize == jsTokenComment) return CodeMirror.Pass; if (state.tokenize == jsTokenComment) return CodeMirror.Pass;
if (state.tokenize != jsTokenBase) return 0; if (state.tokenize != jsTokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
var type = lexical.type, closing = firstChar == type; var type = lexical.type, closing = firstChar == type;
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0); if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0);
else if (type == "form" && firstChar == "{") return lexical.indented; else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit; else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat") else if (type == "stat")
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? indentUnit : 0); return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? indentUnit : 0);
else if (lexical.info == "switch" && !closing) else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1); else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit); else return lexical.indented + (closing ? 0 : indentUnit);
}, },
electricChars: ":{}", electricChars: ":{}",
jsonMode: jsonMode jsonMode: jsonMode
}; };
}); });
CodeMirror.defineMIME("text/javascript", "javascript"); CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript"); CodeMirror.defineMIME("text/ecmascript", "javascript");
CodeMirror.defineMIME("application/javascript", "javascript"); CodeMirror.defineMIME("application/javascript", "javascript");
CodeMirror.defineMIME("application/ecmascript", "javascript"); CodeMirror.defineMIME("application/ecmascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });

View File

@ -1,328 +1,328 @@
CodeMirror.defineMode("xml", function(config, parserConfig) { CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit; var indentUnit = config.indentUnit;
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1; var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
var Kludges = parserConfig.htmlMode ? { var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
'track': true, 'wbr': true}, 'track': true, 'wbr': true},
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
'th': true, 'tr': true}, 'th': true, 'tr': true},
contextGrabbers: { contextGrabbers: {
'dd': {'dd': true, 'dt': true}, 'dd': {'dd': true, 'dt': true},
'dt': {'dd': true, 'dt': true}, 'dt': {'dd': true, 'dt': true},
'li': {'li': true}, 'li': {'li': true},
'option': {'option': true, 'optgroup': true}, 'option': {'option': true, 'optgroup': true},
'optgroup': {'optgroup': true}, 'optgroup': {'optgroup': true},
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
'rp': {'rp': true, 'rt': true}, 'rp': {'rp': true, 'rt': true},
'rt': {'rp': true, 'rt': true}, 'rt': {'rp': true, 'rt': true},
'tbody': {'tbody': true, 'tfoot': true}, 'tbody': {'tbody': true, 'tfoot': true},
'td': {'td': true, 'th': true}, 'td': {'td': true, 'th': true},
'tfoot': {'tbody': true}, 'tfoot': {'tbody': true},
'th': {'td': true, 'th': true}, 'th': {'td': true, 'th': true},
'thead': {'tbody': true, 'tfoot': true}, 'thead': {'tbody': true, 'tfoot': true},
'tr': {'tr': true} 'tr': {'tr': true}
}, },
doNotIndent: {"pre": true}, doNotIndent: {"pre": true},
allowUnquoted: true, allowUnquoted: true,
allowMissing: true allowMissing: true
} : { } : {
autoSelfClosers: {}, autoSelfClosers: {},
implicitlyClosed: {}, implicitlyClosed: {},
contextGrabbers: {}, contextGrabbers: {},
doNotIndent: {}, doNotIndent: {},
allowUnquoted: false, allowUnquoted: false,
allowMissing: false allowMissing: false
}; };
var alignCDATA = parserConfig.alignCDATA; var alignCDATA = parserConfig.alignCDATA;
// Return variables for tokenizers // Return variables for tokenizers
var tagName, type; var tagName, type;
function inText(stream, state) { function inText(stream, state) {
function chain(parser) { function chain(parser) {
state.tokenize = parser; state.tokenize = parser;
return parser(stream, state); return parser(stream, state);
} }
var ch = stream.next(); var ch = stream.next();
if (ch == "<") { if (ch == "<") {
if (stream.eat("!")) { if (stream.eat("!")) {
if (stream.eat("[")) { if (stream.eat("[")) {
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
else return null; else return null;
} }
else if (stream.match("--")) return chain(inBlock("comment", "-->")); else if (stream.match("--")) return chain(inBlock("comment", "-->"));
else if (stream.match("DOCTYPE", true, true)) { else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/); stream.eatWhile(/[\w\._\-]/);
return chain(doctype(1)); return chain(doctype(1));
} }
else return null; else return null;
} }
else if (stream.eat("?")) { else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/); stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>"); state.tokenize = inBlock("meta", "?>");
return "meta"; return "meta";
} }
else { else {
var isClose = stream.eat("/"); var isClose = stream.eat("/");
tagName = ""; tagName = "";
var c; var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
if (!tagName) return "error"; if (!tagName) return "error";
type = isClose ? "closeTag" : "openTag"; type = isClose ? "closeTag" : "openTag";
state.tokenize = inTag; state.tokenize = inTag;
return "tag"; return "tag";
} }
} }
else if (ch == "&") { else if (ch == "&") {
var ok; var ok;
if (stream.eat("#")) { if (stream.eat("#")) {
if (stream.eat("x")) { if (stream.eat("x")) {
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
} else { } else {
ok = stream.eatWhile(/[\d]/) && stream.eat(";"); ok = stream.eatWhile(/[\d]/) && stream.eat(";");
} }
} else { } else {
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
} }
return ok ? "atom" : "error"; return ok ? "atom" : "error";
} }
else { else {
stream.eatWhile(/[^&<]/); stream.eatWhile(/[^&<]/);
return null; return null;
} }
} }
function inTag(stream, state) { function inTag(stream, state) {
var ch = stream.next(); var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) { if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText; state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag"; type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag"; return "tag";
} }
else if (ch == "=") { else if (ch == "=") {
type = "equals"; type = "equals";
return null; return null;
} }
else if (/[\'\"]/.test(ch)) { else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch); state.tokenize = inAttribute(ch);
return state.tokenize(stream, state); return state.tokenize(stream, state);
} }
else { else {
stream.eatWhile(/[^\s\u00a0=<>\"\']/); stream.eatWhile(/[^\s\u00a0=<>\"\']/);
return "word"; return "word";
} }
} }
function inAttribute(quote) { function inAttribute(quote) {
return function(stream, state) { return function(stream, state) {
while (!stream.eol()) { while (!stream.eol()) {
if (stream.next() == quote) { if (stream.next() == quote) {
state.tokenize = inTag; state.tokenize = inTag;
break; break;
} }
} }
return "string"; return "string";
}; };
} }
function inBlock(style, terminator) { function inBlock(style, terminator) {
return function(stream, state) { return function(stream, state) {
while (!stream.eol()) { while (!stream.eol()) {
if (stream.match(terminator)) { if (stream.match(terminator)) {
state.tokenize = inText; state.tokenize = inText;
break; break;
} }
stream.next(); stream.next();
} }
return style; return style;
}; };
} }
function doctype(depth) { function doctype(depth) {
return function(stream, state) { return function(stream, state) {
var ch; var ch;
while ((ch = stream.next()) != null) { while ((ch = stream.next()) != null) {
if (ch == "<") { if (ch == "<") {
state.tokenize = doctype(depth + 1); state.tokenize = doctype(depth + 1);
return state.tokenize(stream, state); return state.tokenize(stream, state);
} else if (ch == ">") { } else if (ch == ">") {
if (depth == 1) { if (depth == 1) {
state.tokenize = inText; state.tokenize = inText;
break; break;
} else { } else {
state.tokenize = doctype(depth - 1); state.tokenize = doctype(depth - 1);
return state.tokenize(stream, state); return state.tokenize(stream, state);
} }
} }
} }
return "meta"; return "meta";
}; };
} }
var curState, curStream, setStyle; var curState, curStream, setStyle;
function pass() { function pass() {
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
} }
function cont() { function cont() {
pass.apply(null, arguments); pass.apply(null, arguments);
return true; return true;
} }
function pushContext(tagName, startOfLine) { function pushContext(tagName, startOfLine) {
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent); var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
curState.context = { curState.context = {
prev: curState.context, prev: curState.context,
tagName: tagName, tagName: tagName,
indent: curState.indented, indent: curState.indented,
startOfLine: startOfLine, startOfLine: startOfLine,
noIndent: noIndent noIndent: noIndent
}; };
} }
function popContext() { function popContext() {
if (curState.context) curState.context = curState.context.prev; if (curState.context) curState.context = curState.context.prev;
} }
function element(type) { function element(type) {
if (type == "openTag") { if (type == "openTag") {
curState.tagName = tagName; curState.tagName = tagName;
curState.tagStart = curStream.column(); curState.tagStart = curStream.column();
return cont(attributes, endtag(curState.startOfLine)); return cont(attributes, endtag(curState.startOfLine));
} else if (type == "closeTag") { } else if (type == "closeTag") {
var err = false; var err = false;
if (curState.context) { if (curState.context) {
if (curState.context.tagName != tagName) { if (curState.context.tagName != tagName) {
if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) { if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
popContext(); popContext();
} }
err = !curState.context || curState.context.tagName != tagName; err = !curState.context || curState.context.tagName != tagName;
} }
} else { } else {
err = true; err = true;
} }
if (err) setStyle = "error"; if (err) setStyle = "error";
return cont(endclosetag(err)); return cont(endclosetag(err));
} }
return cont(); return cont();
} }
function endtag(startOfLine) { function endtag(startOfLine) {
return function(type) { return function(type) {
var tagName = curState.tagName; var tagName = curState.tagName;
curState.tagName = curState.tagStart = null; curState.tagName = curState.tagStart = null;
if (type == "selfcloseTag" || if (type == "selfcloseTag" ||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) { (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
maybePopContext(tagName.toLowerCase()); maybePopContext(tagName.toLowerCase());
return cont(); return cont();
} }
if (type == "endTag") { if (type == "endTag") {
maybePopContext(tagName.toLowerCase()); maybePopContext(tagName.toLowerCase());
pushContext(tagName, startOfLine); pushContext(tagName, startOfLine);
return cont(); return cont();
} }
return cont(); return cont();
}; };
} }
function endclosetag(err) { function endclosetag(err) {
return function(type) { return function(type) {
if (err) setStyle = "error"; if (err) setStyle = "error";
if (type == "endTag") { popContext(); return cont(); } if (type == "endTag") { popContext(); return cont(); }
setStyle = "error"; setStyle = "error";
return cont(arguments.callee); return cont(arguments.callee);
}; };
} }
function maybePopContext(nextTagName) { function maybePopContext(nextTagName) {
var parentTagName; var parentTagName;
while (true) { while (true) {
if (!curState.context) { if (!curState.context) {
return; return;
} }
parentTagName = curState.context.tagName.toLowerCase(); parentTagName = curState.context.tagName.toLowerCase();
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
return; return;
} }
popContext(); popContext();
} }
} }
function attributes(type) { function attributes(type) {
if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);} if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
if (type == "endTag" || type == "selfcloseTag") return pass(); if (type == "endTag" || type == "selfcloseTag") return pass();
setStyle = "error"; setStyle = "error";
return cont(attributes); return cont(attributes);
} }
function attribute(type) { function attribute(type) {
if (type == "equals") return cont(attvalue, attributes); if (type == "equals") return cont(attvalue, attributes);
if (!Kludges.allowMissing) setStyle = "error"; if (!Kludges.allowMissing) setStyle = "error";
else if (type == "word") setStyle = "attribute"; else if (type == "word") setStyle = "attribute";
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont(); return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
} }
function attvalue(type) { function attvalue(type) {
if (type == "string") return cont(attvaluemaybe); if (type == "string") return cont(attvaluemaybe);
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();} if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
setStyle = "error"; setStyle = "error";
return (type == "endTag" || type == "selfCloseTag") ? pass() : cont(); return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
} }
function attvaluemaybe(type) { function attvaluemaybe(type) {
if (type == "string") return cont(attvaluemaybe); if (type == "string") return cont(attvaluemaybe);
else return pass(); else return pass();
} }
return { return {
startState: function() { startState: function() {
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, tagStart: null, context: null}; return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, tagStart: null, context: null};
}, },
token: function(stream, state) { token: function(stream, state) {
if (!state.tagName && stream.sol()) { if (!state.tagName && stream.sol()) {
state.startOfLine = true; state.startOfLine = true;
state.indented = stream.indentation(); state.indented = stream.indentation();
} }
if (stream.eatSpace()) return null; if (stream.eatSpace()) return null;
setStyle = type = tagName = null; setStyle = type = tagName = null;
var style = state.tokenize(stream, state); var style = state.tokenize(stream, state);
state.type = type; state.type = type;
if ((style || type) && style != "comment") { if ((style || type) && style != "comment") {
curState = state; curStream = stream; curState = state; curStream = stream;
while (true) { while (true) {
var comb = state.cc.pop() || element; var comb = state.cc.pop() || element;
if (comb(type || style)) break; if (comb(type || style)) break;
} }
} }
state.startOfLine = false; state.startOfLine = false;
return setStyle || style; return setStyle || style;
}, },
indent: function(state, textAfter, fullLine) { indent: function(state, textAfter, fullLine) {
var context = state.context; var context = state.context;
if ((state.tokenize != inTag && state.tokenize != inText) || if ((state.tokenize != inTag && state.tokenize != inText) ||
context && context.noIndent) context && context.noIndent)
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
if (state.tagName) return state.tagStart + indentUnit * multilineTagIndentFactor; if (state.tagName) return state.tagStart + indentUnit * multilineTagIndentFactor;
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0; if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter)) if (context && /^<\//.test(textAfter))
context = context.prev; context = context.prev;
while (context && !context.startOfLine) while (context && !context.startOfLine)
context = context.prev; context = context.prev;
if (context) return context.indent + indentUnit; if (context) return context.indent + indentUnit;
else return 0; else return 0;
}, },
electricChars: "/", electricChars: "/",
configuration: parserConfig.htmlMode ? "html" : "xml" configuration: parserConfig.htmlMode ? "html" : "xml"
}; };
}); });
CodeMirror.defineMIME("text/xml", "xml"); CodeMirror.defineMIME("text/xml", "xml");
CodeMirror.defineMIME("application/xml", "xml"); CodeMirror.defineMIME("application/xml", "xml");
if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'af', { CKEDITOR.plugins.setLang( 'codemirror', 'af', {
toolbar: 'Bron', toolbar: 'Bron',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ar', { CKEDITOR.plugins.setLang( 'codemirror', 'ar', {
toolbar: 'المصدر', toolbar: 'المصدر',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'bg', { CKEDITOR.plugins.setLang( 'codemirror', 'bg', {
toolbar: 'Източник', toolbar: 'Източник',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'bn', { CKEDITOR.plugins.setLang( 'codemirror', 'bn', {
toolbar: 'সোর্স', toolbar: 'সোর্স',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'bs', { CKEDITOR.plugins.setLang( 'codemirror', 'bs', {
toolbar: 'HTML kôd', toolbar: 'HTML kôd',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ca', { CKEDITOR.plugins.setLang( 'codemirror', 'ca', {
toolbar: 'Codi font', toolbar: 'Codi font',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'cs', { CKEDITOR.plugins.setLang( 'codemirror', 'cs', {
toolbar: 'Zdroj', toolbar: 'Zdroj',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'cy', { CKEDITOR.plugins.setLang( 'codemirror', 'cy', {
toolbar: 'HTML', toolbar: 'HTML',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'da', { CKEDITOR.plugins.setLang( 'codemirror', 'da', {
toolbar: 'Kilde', toolbar: 'Kilde',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,12 +1,12 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'de', { CKEDITOR.plugins.setLang( 'codemirror', 'de', {
toolbar: 'Quellcode', toolbar: 'Quellcode',
searchCode: 'Quellcode durchsuchen', searchCode: 'Quellcode durchsuchen',
autoFormat: 'Auswahl formatieren', autoFormat: 'Auswahl formatieren',
commentSelectedRange: 'Auswahl auskommentieren', commentSelectedRange: 'Auswahl auskommentieren',
uncommentSelectedRange: 'Auskommentierung entferen', uncommentSelectedRange: 'Auskommentierung entferen',
autoCompleteToggle: 'HTML Tag Autvervollständigen de-/aktivieren' autoCompleteToggle: 'HTML Tag Autvervollständigen de-/aktivieren'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'el', { CKEDITOR.plugins.setLang( 'codemirror', 'el', {
toolbar: 'HTML κώδικας', toolbar: 'HTML κώδικας',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'en-au', { CKEDITOR.plugins.setLang( 'codemirror', 'en-au', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'en-ca', { CKEDITOR.plugins.setLang( 'codemirror', 'en-ca', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'en-gb', { CKEDITOR.plugins.setLang( 'codemirror', 'en-gb', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,12 +1,12 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'en', { CKEDITOR.plugins.setLang( 'codemirror', 'en', {
toolbar: 'Source', toolbar: 'Source',
searchCode: 'Search Source', searchCode: 'Search Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection', uncommentSelectedRange: 'Uncomment Selection',
autoCompleteToggle: 'Enable/Disable HTML Tag Autocomplete' autoCompleteToggle: 'Enable/Disable HTML Tag Autocomplete'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'eo', { CKEDITOR.plugins.setLang( 'codemirror', 'eo', {
toolbar: 'Fonto', toolbar: 'Fonto',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'es', { CKEDITOR.plugins.setLang( 'codemirror', 'es', {
toolbar: 'Fuente HTML', toolbar: 'Fuente HTML',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'et', { CKEDITOR.plugins.setLang( 'codemirror', 'et', {
toolbar: 'Lähtekood', toolbar: 'Lähtekood',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'eu', { CKEDITOR.plugins.setLang( 'codemirror', 'eu', {
toolbar: 'HTML Iturburua', toolbar: 'HTML Iturburua',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'fa', { CKEDITOR.plugins.setLang( 'codemirror', 'fa', {
toolbar: 'منبع', toolbar: 'منبع',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'fi', { CKEDITOR.plugins.setLang( 'codemirror', 'fi', {
toolbar: 'Koodi', toolbar: 'Koodi',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'fo', { CKEDITOR.plugins.setLang( 'codemirror', 'fo', {
toolbar: 'Kelda', toolbar: 'Kelda',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'fr-ca', { CKEDITOR.plugins.setLang( 'codemirror', 'fr-ca', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'fr', { CKEDITOR.plugins.setLang( 'codemirror', 'fr', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'gl', { CKEDITOR.plugins.setLang( 'codemirror', 'gl', {
toolbar: 'Código Fonte', toolbar: 'Código Fonte',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'gu', { CKEDITOR.plugins.setLang( 'codemirror', 'gu', {
toolbar: 'મૂળ કે પ્રાથમિક દસ્તાવેજ', toolbar: 'મૂળ કે પ્રાથમિક દસ્તાવેજ',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'he', { CKEDITOR.plugins.setLang( 'codemirror', 'he', {
toolbar: 'מקור', toolbar: 'מקור',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'hi', { CKEDITOR.plugins.setLang( 'codemirror', 'hi', {
toolbar: 'सोर्स', toolbar: 'सोर्स',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'hr', { CKEDITOR.plugins.setLang( 'codemirror', 'hr', {
toolbar: 'Kôd', toolbar: 'Kôd',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'hu', { CKEDITOR.plugins.setLang( 'codemirror', 'hu', {
toolbar: 'Forráskód', toolbar: 'Forráskód',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'is', { CKEDITOR.plugins.setLang( 'codemirror', 'is', {
toolbar: 'Kóði', toolbar: 'Kóði',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'it', { CKEDITOR.plugins.setLang( 'codemirror', 'it', {
toolbar: 'Codice Sorgente', toolbar: 'Codice Sorgente',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ja', { CKEDITOR.plugins.setLang( 'codemirror', 'ja', {
toolbar: 'ソース', toolbar: 'ソース',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ka', { CKEDITOR.plugins.setLang( 'codemirror', 'ka', {
toolbar: 'კოდები', toolbar: 'კოდები',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'km', { CKEDITOR.plugins.setLang( 'codemirror', 'km', {
toolbar: 'កូត', toolbar: 'កូត',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ko', { CKEDITOR.plugins.setLang( 'codemirror', 'ko', {
toolbar: '소스', toolbar: '소스',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ku', { CKEDITOR.plugins.setLang( 'codemirror', 'ku', {
toolbar: 'سەرچاوە', toolbar: 'سەرچاوە',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'lt', { CKEDITOR.plugins.setLang( 'codemirror', 'lt', {
toolbar: 'Šaltinis', toolbar: 'Šaltinis',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'lv', { CKEDITOR.plugins.setLang( 'codemirror', 'lv', {
toolbar: 'HTML kods', toolbar: 'HTML kods',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'mk', { CKEDITOR.plugins.setLang( 'codemirror', 'mk', {
toolbar: 'Source', toolbar: 'Source',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'mn', { CKEDITOR.plugins.setLang( 'codemirror', 'mn', {
toolbar: 'Код', toolbar: 'Код',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ms', { CKEDITOR.plugins.setLang( 'codemirror', 'ms', {
toolbar: 'Sumber', toolbar: 'Sumber',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'nb', { CKEDITOR.plugins.setLang( 'codemirror', 'nb', {
toolbar: 'Kilde', toolbar: 'Kilde',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'nl', { CKEDITOR.plugins.setLang( 'codemirror', 'nl', {
toolbar: 'Code', toolbar: 'Code',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'no', { CKEDITOR.plugins.setLang( 'codemirror', 'no', {
toolbar: 'Kilde', toolbar: 'Kilde',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'pl', { CKEDITOR.plugins.setLang( 'codemirror', 'pl', {
toolbar: 'Źródło dokumentu', toolbar: 'Źródło dokumentu',
autoFormat: 'Sformatuj zaznaczenie', autoFormat: 'Sformatuj zaznaczenie',
commentSelectedRange: 'Zakomentuj zaznaczenie', commentSelectedRange: 'Zakomentuj zaznaczenie',
uncommentSelectedRange: 'Odkomentuj zaznaczenie' uncommentSelectedRange: 'Odkomentuj zaznaczenie'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'pt-br', { CKEDITOR.plugins.setLang( 'codemirror', 'pt-br', {
toolbar: 'Código-Fonte', toolbar: 'Código-Fonte',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'pt', { CKEDITOR.plugins.setLang( 'codemirror', 'pt', {
toolbar: 'Fonte', toolbar: 'Fonte',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ro', { CKEDITOR.plugins.setLang( 'codemirror', 'ro', {
toolbar: 'Sursa', toolbar: 'Sursa',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ru', { CKEDITOR.plugins.setLang( 'codemirror', 'ru', {
toolbar: 'Источник', toolbar: 'Источник',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'sk', { CKEDITOR.plugins.setLang( 'codemirror', 'sk', {
toolbar: 'Zdroj', toolbar: 'Zdroj',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'sl', { CKEDITOR.plugins.setLang( 'codemirror', 'sl', {
toolbar: 'Izvorna koda', toolbar: 'Izvorna koda',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'sr-latn', { CKEDITOR.plugins.setLang( 'codemirror', 'sr-latn', {
toolbar: 'Kôd', toolbar: 'Kôd',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'sr', { CKEDITOR.plugins.setLang( 'codemirror', 'sr', {
toolbar: 'Kôд', toolbar: 'Kôд',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'sv', { CKEDITOR.plugins.setLang( 'codemirror', 'sv', {
toolbar: 'Källa', toolbar: 'Källa',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'th', { CKEDITOR.plugins.setLang( 'codemirror', 'th', {
toolbar: 'ดูรหัส HTML', toolbar: 'ดูรหัส HTML',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'tr', { CKEDITOR.plugins.setLang( 'codemirror', 'tr', {
toolbar: 'Kaynak', toolbar: 'Kaynak',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'ug', { CKEDITOR.plugins.setLang( 'codemirror', 'ug', {
toolbar: 'مەنبە', toolbar: 'مەنبە',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'uk', { CKEDITOR.plugins.setLang( 'codemirror', 'uk', {
toolbar: 'Джерело', toolbar: 'Джерело',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'vi', { CKEDITOR.plugins.setLang( 'codemirror', 'vi', {
toolbar: 'Mã HTML', toolbar: 'Mã HTML',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'zh-cn', { CKEDITOR.plugins.setLang( 'codemirror', 'zh-cn', {
toolbar: '原始碼', toolbar: '原始碼',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,10 +1,10 @@
/* /*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license For licensing, see LICENSE.html or http://ckeditor.com/license
*/ */
CKEDITOR.plugins.setLang( 'codemirror', 'zh', { CKEDITOR.plugins.setLang( 'codemirror', 'zh', {
toolbar: '源码', toolbar: '源码',
autoFormat: 'Format Selection', autoFormat: 'Format Selection',
commentSelectedRange: 'Comment Selection', commentSelectedRange: 'Comment Selection',
uncommentSelectedRange: 'Uncomment Selection' uncommentSelectedRange: 'Uncomment Selection'
}); });

View File

@ -1,447 +1,447 @@
/* /*
* The "codemirror" plugin. It's indented to enhance the * The "codemirror" plugin. It's indented to enhance the
* "sourcearea" editing mode, which displays the xhtml source code with * "sourcearea" editing mode, which displays the xhtml source code with
* syntax highlight and line numbers. * syntax highlight and line numbers.
* Licensed under the MIT license * Licensed under the MIT license
* CodeMirror Plugin: http://codemirror.net/ (MIT License) * CodeMirror Plugin: http://codemirror.net/ (MIT License)
*/ */
(function() { (function() {
CKEDITOR.plugins.add('codemirror', { CKEDITOR.plugins.add('codemirror', {
icons: 'SearchCode,AutoFormat,CommentSelectedRange,UncommentSelectedRange,AutoComplete', icons: 'SearchCode,AutoFormat,CommentSelectedRange,UncommentSelectedRange,AutoComplete',
lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh', lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh',
init: function(editor) { init: function(editor) {
var rootPath = this.path; var rootPath = this.path;
// Default Config // Default Config
var defaultConfig = { var defaultConfig = {
theme: 'default', theme: 'default',
matchBrackets: true, matchBrackets: true,
lineNumbers: true, lineNumbers: true,
lineWrapping: true, lineWrapping: true,
autoCloseTags: true, autoCloseTags: true,
autoCloseBrackets: true, autoCloseBrackets: true,
continueComments: true, continueComments: true,
enableSearchTools: true, enableSearchTools: true,
enableCodeFolding: true, enableCodeFolding: true,
enableCodeFormatting: true, enableCodeFormatting: true,
autoFormatOnStart: false, autoFormatOnStart: false,
autoFormatOnModeChange: true, autoFormatOnModeChange: true,
autoFormatOnUncomment: true, autoFormatOnUncomment: true,
highlightActiveLine: true, highlightActiveLine: true,
highlightMatches: true, highlightMatches: true,
showFormatButton: true, showFormatButton: true,
showCommentButton: true, showCommentButton: true,
showSearchButton: true, showSearchButton: true,
showUncommentButton: true, showUncommentButton: true,
showAutoCompleteButton: true showAutoCompleteButton: true
}; };
// Get Config & Lang // Get Config & Lang
var config = CKEDITOR.tools.extend(defaultConfig, editor.config.codemirror || {}, true); var config = CKEDITOR.tools.extend(defaultConfig, editor.config.codemirror || {}, true);
var lang = editor.lang.codemirror; var lang = editor.lang.codemirror;
// check for old config settings for legacy support // check for old config settings for legacy support
if (editor.config.codemirror_theme) { if (editor.config.codemirror_theme) {
config.theme = editor.config.codemirror_theme; config.theme = editor.config.codemirror_theme;
} }
if (editor.config.codemirror_autoFormatOnStart) { if (editor.config.codemirror_autoFormatOnStart) {
config.autoFormatOnStart = editor.config.codemirror_autoFormatOnStart; config.autoFormatOnStart = editor.config.codemirror_autoFormatOnStart;
} }
// Source mode isn't available in inline mode yet. // Source mode isn't available in inline mode yet.
if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE) { if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE) {
return; return;
} }
var sourcearea = CKEDITOR.plugins.sourcearea; var sourcearea = CKEDITOR.plugins.sourcearea;
editor.addMode('source', function(callback) { editor.addMode('source', function(callback) {
if (typeof (CodeMirror) == 'undefined') { if (typeof (CodeMirror) == 'undefined') {
CKEDITOR.document.appendStyleSheet(rootPath + 'css/codemirror.min.css'); CKEDITOR.document.appendStyleSheet(rootPath + 'css/codemirror.min.css');
if (config.theme.length && config.theme != 'default') { if (config.theme.length && config.theme != 'default') {
CKEDITOR.document.appendStyleSheet(rootPath + 'theme/' + config.theme + '.css'); CKEDITOR.document.appendStyleSheet(rootPath + 'theme/' + config.theme + '.css');
} }
CKEDITOR.scriptLoader.load(rootPath + 'js/codemirror.js', function() { CKEDITOR.scriptLoader.load(rootPath + 'js/codemirror.js', function() {
CKEDITOR.scriptLoader.load(getCodeMirrorScripts(), function() { CKEDITOR.scriptLoader.load(getCodeMirrorScripts(), function() {
loadCodeMirror(editor); loadCodeMirror(editor);
callback(); callback();
}); });
}); });
} else { } else {
loadCodeMirror(editor); loadCodeMirror(editor);
callback(); callback();
} }
}); });
function getCodeMirrorScripts() { function getCodeMirrorScripts() {
var scriptFiles = [rootPath + 'js/codemirror.modes.min.js', rootPath + 'js/codemirror.addons.min.js']; var scriptFiles = [rootPath + 'js/codemirror.modes.min.js', rootPath + 'js/codemirror.addons.min.js'];
if (config.enableSearchTools) { if (config.enableSearchTools) {
scriptFiles.push(rootPath + 'js/codemirror.search-addons.min.js'); scriptFiles.push(rootPath + 'js/codemirror.search-addons.min.js');
} }
return scriptFiles; return scriptFiles;
} }
function loadCodeMirror(editor) { function loadCodeMirror(editor) {
var contentsSpace = editor.ui.space('contents'), var contentsSpace = editor.ui.space('contents'),
textarea = contentsSpace.getDocument().createElement('textarea'); textarea = contentsSpace.getDocument().createElement('textarea');
textarea.setStyles( textarea.setStyles(
CKEDITOR.tools.extend({ CKEDITOR.tools.extend({
// IE7 has overflow the <textarea> from wrapping table cell. // IE7 has overflow the <textarea> from wrapping table cell.
width: CKEDITOR.env.ie7Compat ? '99%' : '100%', width: CKEDITOR.env.ie7Compat ? '99%' : '100%',
height: '100%', height: '100%',
resize: 'none', resize: 'none',
outline: 'none', outline: 'none',
'text-align': 'left' 'text-align': 'left'
}, },
CKEDITOR.tools.cssVendorPrefix('tab-size', editor.config.sourceAreaTabSize || 4))); CKEDITOR.tools.cssVendorPrefix('tab-size', editor.config.sourceAreaTabSize || 4)));
var ariaLabel = [editor.lang.editor, editor.name].join(','); var ariaLabel = [editor.lang.editor, editor.name].join(',');
textarea.setAttributes({ textarea.setAttributes({
dir: 'ltr', dir: 'ltr',
tabIndex: CKEDITOR.env.webkit ? -1 : editor.tabIndex, tabIndex: CKEDITOR.env.webkit ? -1 : editor.tabIndex,
'role': 'textbox', 'role': 'textbox',
'aria-label': ariaLabel 'aria-label': ariaLabel
}); });
textarea.addClass('cke_source cke_reset cke_enable_context_menu'); textarea.addClass('cke_source cke_reset cke_enable_context_menu');
editor.ui.space('contents').append(textarea); editor.ui.space('contents').append(textarea);
window["editable_" + editor.id] = editor.editable(new sourceEditable(editor, textarea)); window["editable_" + editor.id] = editor.editable(new sourceEditable(editor, textarea));
// Fill the textarea with the current editor data. // Fill the textarea with the current editor data.
window["editable_" + editor.id].setData(editor.getData(1)); window["editable_" + editor.id].setData(editor.getData(1));
window["editable_" + editor.id].editorID = editor.id; window["editable_" + editor.id].editorID = editor.id;
editor.fire('ariaWidget', this); editor.fire('ariaWidget', this);
var delay; var delay;
var sourceAreaElement = window["editable_" + editor.id], var sourceAreaElement = window["editable_" + editor.id],
holderElement = sourceAreaElement.getParent(); holderElement = sourceAreaElement.getParent();
codemirror = editor.id; codemirror = editor.id;
/*CodeMirror.commands.autocomplete = function(cm) { /*CodeMirror.commands.autocomplete = function(cm) {
CodeMirror.showHint(cm, CodeMirror.htmlHint); CodeMirror.showHint(cm, CodeMirror.htmlHint);
};*/ };*/
// Enable Code Folding (Requires 'lineNumbers' to be set to 'true') // Enable Code Folding (Requires 'lineNumbers' to be set to 'true')
if (config.lineNumbers && config.enableCodeFolding) { if (config.lineNumbers && config.enableCodeFolding) {
window["foldFunc_" + editor.id] = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder); window["foldFunc_" + editor.id] = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder);
} }
window["codemirror_" + editor.id] = CodeMirror.fromTextArea(sourceAreaElement.$, { window["codemirror_" + editor.id] = CodeMirror.fromTextArea(sourceAreaElement.$, {
mode: 'text/html', mode: 'text/html',
matchBrackets: config.matchBrackets, matchBrackets: config.matchBrackets,
workDelay: 300, workDelay: 300,
workTime: 35, workTime: 35,
lineNumbers: config.lineNumbers, lineNumbers: config.lineNumbers,
lineWrapping: config.lineWrapping, lineWrapping: config.lineWrapping,
autoCloseTags: config.autoCloseTags, autoCloseTags: config.autoCloseTags,
autoCloseBrackets: config.autoCloseBrackets, autoCloseBrackets: config.autoCloseBrackets,
highlightSelectionMatches: config.highlightMatches, highlightSelectionMatches: config.highlightMatches,
continueComments: config.continueComments, continueComments: config.continueComments,
theme: config.theme, theme: config.theme,
//extraKeys: {"Ctrl-Space": "autocomplete"}, //extraKeys: {"Ctrl-Space": "autocomplete"},
extraKeys: { "Ctrl-Q": function(codeMirror_Editor) { window["foldFunc_" + editor.id](codeMirror_Editor, codeMirror_Editor.getCursor().line); } }, extraKeys: { "Ctrl-Q": function(codeMirror_Editor) { window["foldFunc_" + editor.id](codeMirror_Editor, codeMirror_Editor.getCursor().line); } },
onKeyEvent: function(codeMirror_Editor, evt) { onKeyEvent: function(codeMirror_Editor, evt) {
if (config.enableCodeFormatting) { if (config.enableCodeFormatting) {
var range = getSelectedRange(); var range = getSelectedRange();
if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && !evt.altKey) { if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && !evt.altKey) {
window["codemirror_" + editor.id].commentRange(true, range.from, range.to); window["codemirror_" + editor.id].commentRange(true, range.from, range.to);
} else if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && evt.shiftKey && !evt.altKey) { } else if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && evt.shiftKey && !evt.altKey) {
window["codemirror_" + editor.id].commentRange(false, range.from, range.to); window["codemirror_" + editor.id].commentRange(false, range.from, range.to);
if (config.autoFormatOnUncomment) { if (config.autoFormatOnUncomment) {
window["codemirror_" + editor.id].autoFormatRange(range.from, range.to); window["codemirror_" + editor.id].autoFormatRange(range.from, range.to);
} }
} else if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && evt.altKey) { } else if (evt.type === "keydown" && evt.ctrlKey && evt.keyCode === 75 && !evt.shiftKey && evt.altKey) {
window["codemirror_" + editor.id].autoFormatRange(range.from, range.to); window["codemirror_" + editor.id].autoFormatRange(range.from, range.to);
} }
} }
} }
}); });
var holderHeight = holderElement.$.clientHeight + 'px'; var holderHeight = holderElement.$.clientHeight + 'px';
var holderWidth = holderElement.$.clientWidth + 'px'; var holderWidth = holderElement.$.clientWidth + 'px';
// Store config so we can access it within commands etc. // Store config so we can access it within commands etc.
window["codemirror_" + editor.id].config = config; window["codemirror_" + editor.id].config = config;
if (config.autoFormatOnStart) { if (config.autoFormatOnStart) {
window["codemirror_" + editor.id].autoFormatAll({ window["codemirror_" + editor.id].autoFormatAll({
line: 0, line: 0,
ch: 0 ch: 0
}, { }, {
line: window["codemirror_" + editor.id].lineCount(), line: window["codemirror_" + editor.id].lineCount(),
ch: 0 ch: 0
}); });
} }
function getSelectedRange() { function getSelectedRange() {
return { return {
from: window["codemirror_" + editor.id].getCursor(true), from: window["codemirror_" + editor.id].getCursor(true),
to: window["codemirror_" + editor.id].getCursor(false) to: window["codemirror_" + editor.id].getCursor(false)
}; };
} }
window["codemirror_" + editor.id].on("change", function(cm, change) { window["codemirror_" + editor.id].on("change", function(cm, change) {
clearTimeout(delay); clearTimeout(delay);
delay = setTimeout(function() { delay = setTimeout(function() {
window["codemirror_" + editor.id].save(); window["codemirror_" + editor.id].save();
}, 300); }, 300);
}); });
window["codemirror_" + editor.id].setSize(holderWidth, holderHeight); window["codemirror_" + editor.id].setSize(holderWidth, holderHeight);
// Enable Code Folding (Requires 'lineNumbers' to be set to 'true') // Enable Code Folding (Requires 'lineNumbers' to be set to 'true')
if (config.lineNumbers && config.enableCodeFolding) { if (config.lineNumbers && config.enableCodeFolding) {
window["codemirror_" + editor.id].on("gutterClick", window["foldFunc_" + editor.id]); window["codemirror_" + editor.id].on("gutterClick", window["foldFunc_" + editor.id]);
} }
// Highlight Active Line // Highlight Active Line
if (config.highlightActiveLine) { if (config.highlightActiveLine) {
window["codemirror_" + editor.id].hlLine = window["codemirror_" + editor.id].addLineClass(0, "background", "activeline"); window["codemirror_" + editor.id].hlLine = window["codemirror_" + editor.id].addLineClass(0, "background", "activeline");
window["codemirror_" + editor.id].on("cursorActivity", function() { window["codemirror_" + editor.id].on("cursorActivity", function() {
var cur = window["codemirror_" + editor.id].getLineHandle(window["codemirror_" + editor.id].getCursor().line); var cur = window["codemirror_" + editor.id].getLineHandle(window["codemirror_" + editor.id].getCursor().line);
if (cur != window["codemirror_" + editor.id].hlLine) { if (cur != window["codemirror_" + editor.id].hlLine) {
window["codemirror_" + editor.id].removeLineClass(window["codemirror_" + editor.id].hlLine, "background", "activeline"); window["codemirror_" + editor.id].removeLineClass(window["codemirror_" + editor.id].hlLine, "background", "activeline");
window["codemirror_" + editor.id].hlLine = window["codemirror_" + editor.id].addLineClass(cur, "background", "activeline"); window["codemirror_" + editor.id].hlLine = window["codemirror_" + editor.id].addLineClass(cur, "background", "activeline");
} }
}); });
} }
// Run config.onLoad callback, if present. // Run config.onLoad callback, if present.
if (typeof config.onLoad === 'function') { if (typeof config.onLoad === 'function') {
config.onLoad(window["codemirror_" + editor.id], editor); config.onLoad(window["codemirror_" + editor.id], editor);
} }
} }
editor.addCommand('source', sourcearea.commands.source); editor.addCommand('source', sourcearea.commands.source);
if (editor.ui.addButton) { if (editor.ui.addButton) {
editor.ui.addButton('Source', { editor.ui.addButton('Source', {
label: editor.lang.codemirror.toolbar, label: editor.lang.codemirror.toolbar,
command: 'source', command: 'source',
toolbar: 'mode,10' toolbar: 'mode,10'
}); });
} }
if (config.enableCodeFormatting) { if (config.enableCodeFormatting) {
editor.addCommand('searchCode', sourcearea.commands.searchCode); editor.addCommand('searchCode', sourcearea.commands.searchCode);
editor.addCommand('autoFormat', sourcearea.commands.autoFormat); editor.addCommand('autoFormat', sourcearea.commands.autoFormat);
editor.addCommand('commentSelectedRange', sourcearea.commands.commentSelectedRange); editor.addCommand('commentSelectedRange', sourcearea.commands.commentSelectedRange);
editor.addCommand('uncommentSelectedRange', sourcearea.commands.uncommentSelectedRange); editor.addCommand('uncommentSelectedRange', sourcearea.commands.uncommentSelectedRange);
editor.addCommand('autoCompleteToggle', sourcearea.commands.autoCompleteToggle); editor.addCommand('autoCompleteToggle', sourcearea.commands.autoCompleteToggle);
if (editor.ui.addButton) { if (editor.ui.addButton) {
if (config.showFormatButton || config.showCommentButton || config.showUncommentButton || config.showSearchButton) { if (config.showFormatButton || config.showCommentButton || config.showUncommentButton || config.showSearchButton) {
editor.ui.add('-', CKEDITOR.UI_SEPARATOR, { toolbar: 'mode,30' }); editor.ui.add('-', CKEDITOR.UI_SEPARATOR, { toolbar: 'mode,30' });
} }
if (config.showSearchButton && config.enableSearchTools) { if (config.showSearchButton && config.enableSearchTools) {
editor.ui.addButton('searchCode', { editor.ui.addButton('searchCode', {
label: lang.searchCode, label: lang.searchCode,
command: 'searchCode', command: 'searchCode',
toolbar: 'mode,40' toolbar: 'mode,40'
}); });
} }
if (config.showFormatButton) { if (config.showFormatButton) {
editor.ui.addButton('autoFormat', { editor.ui.addButton('autoFormat', {
label: lang.autoFormat, label: lang.autoFormat,
command: 'autoFormat', command: 'autoFormat',
toolbar: 'mode,50' toolbar: 'mode,50'
}); });
} }
if (config.showCommentButton) { if (config.showCommentButton) {
editor.ui.addButton('CommentSelectedRange', { editor.ui.addButton('CommentSelectedRange', {
label: lang.commentSelectedRange, label: lang.commentSelectedRange,
command: 'commentSelectedRange', command: 'commentSelectedRange',
toolbar: 'mode,60' toolbar: 'mode,60'
}); });
} }
if (config.showUncommentButton) { if (config.showUncommentButton) {
editor.ui.addButton('UncommentSelectedRange', { editor.ui.addButton('UncommentSelectedRange', {
label: lang.uncommentSelectedRange, label: lang.uncommentSelectedRange,
command: 'uncommentSelectedRange', command: 'uncommentSelectedRange',
toolbar: 'mode,70' toolbar: 'mode,70'
}); });
} }
if (config.showAutoCompleteButton) { if (config.showAutoCompleteButton) {
editor.ui.addButton('AutoComplete', { editor.ui.addButton('AutoComplete', {
label: lang.autoCompleteToggle, label: lang.autoCompleteToggle,
command: 'autoCompleteToggle', command: 'autoCompleteToggle',
toolbar: 'mode,80' toolbar: 'mode,80'
}); });
} }
} }
} }
editor.on('mode', function () { editor.on('mode', function () {
editor.getCommand('source').setState(editor.mode === 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF); editor.getCommand('source').setState(editor.mode === 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF);
if (editor.mode === 'source') { if (editor.mode === 'source') {
editor.getCommand('autoCompleteToggle').setState(window["codemirror_" + editor.id].config.autoCloseTags ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF); editor.getCommand('autoCompleteToggle').setState(window["codemirror_" + editor.id].config.autoCloseTags ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF);
} }
}); });
editor.on('resize', function() { editor.on('resize', function() {
if (window["editable_" + editor.id] && editor.mode === 'source') { if (window["editable_" + editor.id] && editor.mode === 'source') {
var holderElement = window["editable_" + editor.id].getParent(); var holderElement = window["editable_" + editor.id].getParent();
var holderHeight = holderElement.$.clientHeight + 'px'; var holderHeight = holderElement.$.clientHeight + 'px';
var holderWidth = holderElement.$.clientWidth + 'px'; var holderWidth = holderElement.$.clientWidth + 'px';
window["codemirror_" + editor.id].setSize(holderWidth, holderHeight); window["codemirror_" + editor.id].setSize(holderWidth, holderHeight);
} }
}); });
var selectAllCommand = editor.commands.selectAll; var selectAllCommand = editor.commands.selectAll;
if (selectAllCommand != null) { if (selectAllCommand != null) {
selectAllCommand.on('exec', function () { selectAllCommand.on('exec', function () {
if (editor.mode === 'source') { if (editor.mode === 'source') {
window["codemirror_" + editor.id].setSelection({ window["codemirror_" + editor.id].setSelection({
line: 0, line: 0,
ch: 0 ch: 0
}, { }, {
line: window["codemirror_" + editor.id].lineCount(), line: window["codemirror_" + editor.id].lineCount(),
ch: 0 ch: 0
}); });
} }
}); });
} }
} }
}); });
var sourceEditable = CKEDITOR.tools.createClass({ var sourceEditable = CKEDITOR.tools.createClass({
base: CKEDITOR.editable, base: CKEDITOR.editable,
proto: { proto: {
setData: function(data) { setData: function(data) {
this.setValue(data); this.setValue(data);
if (this.codeMirror != null) { if (this.codeMirror != null) {
this.codeMirror.setValue(data); this.codeMirror.setValue(data);
} }
this.editor.fire('dataReady'); this.editor.fire('dataReady');
}, },
getData: function() { getData: function() {
return this.getValue(); return this.getValue();
}, },
// Insertions are not supported in source editable. // Insertions are not supported in source editable.
insertHtml: function() { insertHtml: function() {
}, },
insertElement: function() { insertElement: function() {
}, },
insertText: function() { insertText: function() {
}, },
// Read-only support for textarea. // Read-only support for textarea.
setReadOnly: function(isReadOnly) { setReadOnly: function(isReadOnly) {
this[(isReadOnly ? 'set' : 'remove') + 'Attribute']('readOnly', 'readonly'); this[(isReadOnly ? 'set' : 'remove') + 'Attribute']('readOnly', 'readonly');
}, },
editorID: null, editorID: null,
detach: function() { detach: function() {
window["codemirror_" + this.editorID].toTextArea(); window["codemirror_" + this.editorID].toTextArea();
// Free Memory on destroy // Free Memory on destroy
window["editable_" + this.editorID] = null; window["editable_" + this.editorID] = null;
window["codemirror_" + this.editorID] = null; window["codemirror_" + this.editorID] = null;
sourceEditable.baseProto.detach.call(this); sourceEditable.baseProto.detach.call(this);
this.clearCustomData(); this.clearCustomData();
this.remove(); this.remove();
} }
} }
}); });
})(); })();
CKEDITOR.plugins.sourcearea = { CKEDITOR.plugins.sourcearea = {
commands: { commands: {
source: { source: {
modes: { modes: {
wysiwyg: 1, wysiwyg: 1,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function(editor) { exec: function(editor) {
if (editor.mode === 'wysiwyg') { if (editor.mode === 'wysiwyg') {
editor.fire('saveSnapshot'); editor.fire('saveSnapshot');
} }
editor.getCommand('source').setState(CKEDITOR.TRISTATE_DISABLED); editor.getCommand('source').setState(CKEDITOR.TRISTATE_DISABLED);
editor.setMode(editor.mode === 'source' ? 'wysiwyg' : 'source'); editor.setMode(editor.mode === 'source' ? 'wysiwyg' : 'source');
}, },
canUndo: false canUndo: false
}, },
searchCode: { searchCode: {
modes: { modes: {
wysiwyg: 0, wysiwyg: 0,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function(editor) { exec: function(editor) {
CodeMirror.commands.find(window["codemirror_" + editor.id]); CodeMirror.commands.find(window["codemirror_" + editor.id]);
}, },
canUndo: true canUndo: true
}, },
autoFormat: { autoFormat: {
modes: { modes: {
wysiwyg: 0, wysiwyg: 0,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function(editor) { exec: function(editor) {
var range = { var range = {
from: window["codemirror_" + editor.id].getCursor(true), from: window["codemirror_" + editor.id].getCursor(true),
to: window["codemirror_" + editor.id].getCursor(false) to: window["codemirror_" + editor.id].getCursor(false)
}; };
window["codemirror_" + editor.id].autoFormatRange(range.from, range.to); window["codemirror_" + editor.id].autoFormatRange(range.from, range.to);
}, },
canUndo: true canUndo: true
}, },
commentSelectedRange: { commentSelectedRange: {
modes: { modes: {
wysiwyg: 0, wysiwyg: 0,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function(editor) { exec: function(editor) {
var range = { var range = {
from: window["codemirror_" + editor.id].getCursor(true), from: window["codemirror_" + editor.id].getCursor(true),
to: window["codemirror_" + editor.id].getCursor(false) to: window["codemirror_" + editor.id].getCursor(false)
}; };
window["codemirror_" + editor.id].commentRange(true, range.from, range.to); window["codemirror_" + editor.id].commentRange(true, range.from, range.to);
}, },
canUndo: true canUndo: true
}, },
uncommentSelectedRange: { uncommentSelectedRange: {
modes: { modes: {
wysiwyg: 0, wysiwyg: 0,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function(editor) { exec: function(editor) {
var range = { var range = {
from: window["codemirror_" + editor.id].getCursor(true), from: window["codemirror_" + editor.id].getCursor(true),
to: window["codemirror_" + editor.id].getCursor(false) to: window["codemirror_" + editor.id].getCursor(false)
}; };
window["codemirror_" + editor.id].commentRange(false, range.from, range.to); window["codemirror_" + editor.id].commentRange(false, range.from, range.to);
if (window["codemirror_" + editor.id].config.autoFormatOnUncomment) { if (window["codemirror_" + editor.id].config.autoFormatOnUncomment) {
window["codemirror_" + editor.id].autoFormatRange(range.from, range.to); window["codemirror_" + editor.id].autoFormatRange(range.from, range.to);
} }
}, },
canUndo: true canUndo: true
}, },
autoCompleteToggle: { autoCompleteToggle: {
modes: { modes: {
wysiwyg: 0, wysiwyg: 0,
source: 1 source: 1
}, },
editorFocus: false, editorFocus: false,
readOnly: 1, readOnly: 1,
exec: function (editor) { exec: function (editor) {
if (this.state == CKEDITOR.TRISTATE_ON) { if (this.state == CKEDITOR.TRISTATE_ON) {
window["codemirror_" + editor.id].setOption("autoCloseTags", false); window["codemirror_" + editor.id].setOption("autoCloseTags", false);
} else if (this.state == CKEDITOR.TRISTATE_OFF) { } else if (this.state == CKEDITOR.TRISTATE_OFF) {
window["codemirror_" + editor.id].setOption("autoCloseTags", true); window["codemirror_" + editor.id].setOption("autoCloseTags", true);
} }
this.toggleState(); this.toggleState();
}, },
canUndo: true canUndo: true
} }
} }
}; };

View File

@ -1,5 +1,5 @@
.cm-s-ambiance.CodeMirror { .cm-s-ambiance.CodeMirror {
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,25 +1,25 @@
/* Port of TextMate's Blackboard theme */ /* Port of TextMate's Blackboard theme */
.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
.cm-s-blackboard .CodeMirror-linenumber { color: #888; } .cm-s-blackboard .CodeMirror-linenumber { color: #888; }
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
.cm-s-blackboard .cm-keyword { color: #FBDE2D; } .cm-s-blackboard .cm-keyword { color: #FBDE2D; }
.cm-s-blackboard .cm-atom { color: #D8FA3C; } .cm-s-blackboard .cm-atom { color: #D8FA3C; }
.cm-s-blackboard .cm-number { color: #D8FA3C; } .cm-s-blackboard .cm-number { color: #D8FA3C; }
.cm-s-blackboard .cm-def { color: #8DA6CE; } .cm-s-blackboard .cm-def { color: #8DA6CE; }
.cm-s-blackboard .cm-variable { color: #FF6400; } .cm-s-blackboard .cm-variable { color: #FF6400; }
.cm-s-blackboard .cm-operator { color: #FBDE2D;} .cm-s-blackboard .cm-operator { color: #FBDE2D;}
.cm-s-blackboard .cm-comment { color: #AEAEAE; } .cm-s-blackboard .cm-comment { color: #AEAEAE; }
.cm-s-blackboard .cm-string { color: #61CE3C; } .cm-s-blackboard .cm-string { color: #61CE3C; }
.cm-s-blackboard .cm-string-2 { color: #61CE3C; } .cm-s-blackboard .cm-string-2 { color: #61CE3C; }
.cm-s-blackboard .cm-meta { color: #D8FA3C; } .cm-s-blackboard .cm-meta { color: #D8FA3C; }
.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
.cm-s-blackboard .cm-builtin { color: #8DA6CE; } .cm-s-blackboard .cm-builtin { color: #8DA6CE; }
.cm-s-blackboard .cm-tag { color: #8DA6CE; } .cm-s-blackboard .cm-tag { color: #8DA6CE; }
.cm-s-blackboard .cm-attribute { color: #8DA6CE; } .cm-s-blackboard .cm-attribute { color: #8DA6CE; }
.cm-s-blackboard .cm-header { color: #FF6400; } .cm-s-blackboard .cm-header { color: #FF6400; }
.cm-s-blackboard .cm-hr { color: #AEAEAE; } .cm-s-blackboard .cm-hr { color: #AEAEAE; }
.cm-s-blackboard .cm-link { color: #8DA6CE; } .cm-s-blackboard .cm-link { color: #8DA6CE; }

View File

@ -1,18 +1,18 @@
.cm-s-cobalt.CodeMirror { background: #002240; color: white; } .cm-s-cobalt.CodeMirror { background: #002240; color: white; }
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-cobalt span.cm-comment { color: #08f; } .cm-s-cobalt span.cm-comment { color: #08f; }
.cm-s-cobalt span.cm-atom { color: #845dc4; } .cm-s-cobalt span.cm-atom { color: #845dc4; }
.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
.cm-s-cobalt span.cm-keyword { color: #ffee80; } .cm-s-cobalt span.cm-keyword { color: #ffee80; }
.cm-s-cobalt span.cm-string { color: #3ad900; } .cm-s-cobalt span.cm-string { color: #3ad900; }
.cm-s-cobalt span.cm-meta { color: #ff9d00; } .cm-s-cobalt span.cm-meta { color: #ff9d00; }
.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
.cm-s-cobalt span.cm-error { color: #9d1e15; } .cm-s-cobalt span.cm-error { color: #9d1e15; }
.cm-s-cobalt span.cm-bracket { color: #d8d8d8; } .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
.cm-s-cobalt span.cm-link { color: #845dc4; } .cm-s-cobalt span.cm-link { color: #845dc4; }

View File

@ -1,25 +1,25 @@
.cm-s-eclipse span.cm-meta {color: #FF1717;} .cm-s-eclipse span.cm-meta {color: #FF1717;}
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
.cm-s-eclipse span.cm-atom {color: #219;} .cm-s-eclipse span.cm-atom {color: #219;}
.cm-s-eclipse span.cm-number {color: #164;} .cm-s-eclipse span.cm-number {color: #164;}
.cm-s-eclipse span.cm-def {color: #00f;} .cm-s-eclipse span.cm-def {color: #00f;}
.cm-s-eclipse span.cm-variable {color: black;} .cm-s-eclipse span.cm-variable {color: black;}
.cm-s-eclipse span.cm-variable-2 {color: #0000C0;} .cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
.cm-s-eclipse span.cm-variable-3 {color: #0000C0;} .cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
.cm-s-eclipse span.cm-property {color: black;} .cm-s-eclipse span.cm-property {color: black;}
.cm-s-eclipse span.cm-operator {color: black;} .cm-s-eclipse span.cm-operator {color: black;}
.cm-s-eclipse span.cm-comment {color: #3F7F5F;} .cm-s-eclipse span.cm-comment {color: #3F7F5F;}
.cm-s-eclipse span.cm-string {color: #2A00FF;} .cm-s-eclipse span.cm-string {color: #2A00FF;}
.cm-s-eclipse span.cm-string-2 {color: #f50;} .cm-s-eclipse span.cm-string-2 {color: #f50;}
.cm-s-eclipse span.cm-error {color: #f00;} .cm-s-eclipse span.cm-error {color: #f00;}
.cm-s-eclipse span.cm-qualifier {color: #555;} .cm-s-eclipse span.cm-qualifier {color: #555;}
.cm-s-eclipse span.cm-builtin {color: #30a;} .cm-s-eclipse span.cm-builtin {color: #30a;}
.cm-s-eclipse span.cm-bracket {color: #cc7;} .cm-s-eclipse span.cm-bracket {color: #cc7;}
.cm-s-eclipse span.cm-tag {color: #170;} .cm-s-eclipse span.cm-tag {color: #170;}
.cm-s-eclipse span.cm-attribute {color: #00c;} .cm-s-eclipse span.cm-attribute {color: #00c;}
.cm-s-eclipse span.cm-link {color: #219;} .cm-s-eclipse span.cm-link {color: #219;}
.cm-s-eclipse .CodeMirror-matchingbracket { .cm-s-eclipse .CodeMirror-matchingbracket {
outline:1px solid grey; outline:1px solid grey;
color:black !important;; color:black !important;;
} }

View File

@ -1,10 +1,10 @@
.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
.cm-s-elegant span.cm-variable {color: black;} .cm-s-elegant span.cm-variable {color: black;}
.cm-s-elegant span.cm-variable-2 {color: #b11;} .cm-s-elegant span.cm-variable-2 {color: #b11;}
.cm-s-elegant span.cm-qualifier {color: #555;} .cm-s-elegant span.cm-qualifier {color: #555;}
.cm-s-elegant span.cm-keyword {color: #730;} .cm-s-elegant span.cm-keyword {color: #730;}
.cm-s-elegant span.cm-builtin {color: #30a;} .cm-s-elegant span.cm-builtin {color: #30a;}
.cm-s-elegant span.cm-error {background-color: #fdd;} .cm-s-elegant span.cm-error {background-color: #fdd;}
.cm-s-elegant span.cm-link {color: #762;} .cm-s-elegant span.cm-link {color: #762;}

View File

@ -1,21 +1,21 @@
.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-erlang-dark span.cm-atom { color: #845dc4; } .cm-s-erlang-dark span.cm-atom { color: #845dc4; }
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
.cm-s-erlang-dark span.cm-builtin { color: #eaa; } .cm-s-erlang-dark span.cm-builtin { color: #eaa; }
.cm-s-erlang-dark span.cm-comment { color: #77f; } .cm-s-erlang-dark span.cm-comment { color: #77f; }
.cm-s-erlang-dark span.cm-def { color: #e7a; } .cm-s-erlang-dark span.cm-def { color: #e7a; }
.cm-s-erlang-dark span.cm-error { color: #9d1e15; } .cm-s-erlang-dark span.cm-error { color: #9d1e15; }
.cm-s-erlang-dark span.cm-keyword { color: #ffee80; } .cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
.cm-s-erlang-dark span.cm-meta { color: #50fefe; } .cm-s-erlang-dark span.cm-meta { color: #50fefe; }
.cm-s-erlang-dark span.cm-number { color: #ffd0d0; } .cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
.cm-s-erlang-dark span.cm-operator { color: #d11; } .cm-s-erlang-dark span.cm-operator { color: #d11; }
.cm-s-erlang-dark span.cm-string { color: #3ad900; } .cm-s-erlang-dark span.cm-string { color: #3ad900; }
.cm-s-erlang-dark span.cm-tag { color: #9effff; } .cm-s-erlang-dark span.cm-tag { color: #9effff; }
.cm-s-erlang-dark span.cm-variable { color: #50fe50; } .cm-s-erlang-dark span.cm-variable { color: #50fe50; }
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; } .cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }

View File

@ -1,44 +1,44 @@
/* /*
http://lesscss.org/ dark theme http://lesscss.org/ dark theme
Ported to CodeMirror by Peter Kroon Ported to CodeMirror by Peter Kroon
*/ */
.cm-s-lesser-dark { .cm-s-lesser-dark {
line-height: 1.3em; line-height: 1.3em;
} }
.cm-s-lesser-dark { .cm-s-lesser-dark {
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
} }
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
.cm-s-lesser-dark span.cm-keyword { color: #599eff; } .cm-s-lesser-dark span.cm-keyword { color: #599eff; }
.cm-s-lesser-dark span.cm-atom { color: #C2B470; } .cm-s-lesser-dark span.cm-atom { color: #C2B470; }
.cm-s-lesser-dark span.cm-number { color: #B35E4D; } .cm-s-lesser-dark span.cm-number { color: #B35E4D; }
.cm-s-lesser-dark span.cm-def {color: white;} .cm-s-lesser-dark span.cm-def {color: white;}
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; } .cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
.cm-s-lesser-dark span.cm-variable-3 { color: white; } .cm-s-lesser-dark span.cm-variable-3 { color: white; }
.cm-s-lesser-dark span.cm-property {color: #92A75C;} .cm-s-lesser-dark span.cm-property {color: #92A75C;}
.cm-s-lesser-dark span.cm-operator {color: #92A75C;} .cm-s-lesser-dark span.cm-operator {color: #92A75C;}
.cm-s-lesser-dark span.cm-comment { color: #666; } .cm-s-lesser-dark span.cm-comment { color: #666; }
.cm-s-lesser-dark span.cm-string { color: #BCD279; } .cm-s-lesser-dark span.cm-string { color: #BCD279; }
.cm-s-lesser-dark span.cm-string-2 {color: #f50;} .cm-s-lesser-dark span.cm-string-2 {color: #f50;}
.cm-s-lesser-dark span.cm-meta { color: #738C73; } .cm-s-lesser-dark span.cm-meta { color: #738C73; }
.cm-s-lesser-dark span.cm-error { color: #9d1e15; } .cm-s-lesser-dark span.cm-error { color: #9d1e15; }
.cm-s-lesser-dark span.cm-qualifier {color: #555;} .cm-s-lesser-dark span.cm-qualifier {color: #555;}
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
.cm-s-lesser-dark span.cm-tag { color: #669199; } .cm-s-lesser-dark span.cm-tag { color: #669199; }
.cm-s-lesser-dark span.cm-attribute {color: #00c;} .cm-s-lesser-dark span.cm-attribute {color: #00c;}
.cm-s-lesser-dark span.cm-header {color: #a0a;} .cm-s-lesser-dark span.cm-header {color: #a0a;}
.cm-s-lesser-dark span.cm-quote {color: #090;} .cm-s-lesser-dark span.cm-quote {color: #090;}
.cm-s-lesser-dark span.cm-hr {color: #999;} .cm-s-lesser-dark span.cm-hr {color: #999;}
.cm-s-lesser-dark span.cm-link {color: #00c;} .cm-s-lesser-dark span.cm-link {color: #00c;}

View File

@ -1,28 +1,28 @@
/* Based on Sublime Text's Monokai theme */ /* Based on Sublime Text's Monokai theme */
.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
.cm-s-monokai span.cm-comment {color: #75715e;} .cm-s-monokai span.cm-comment {color: #75715e;}
.cm-s-monokai span.cm-atom {color: #ae81ff;} .cm-s-monokai span.cm-atom {color: #ae81ff;}
.cm-s-monokai span.cm-number {color: #ae81ff;} .cm-s-monokai span.cm-number {color: #ae81ff;}
.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
.cm-s-monokai span.cm-keyword {color: #f92672;} .cm-s-monokai span.cm-keyword {color: #f92672;}
.cm-s-monokai span.cm-string {color: #e6db74;} .cm-s-monokai span.cm-string {color: #e6db74;}
.cm-s-monokai span.cm-variable {color: #a6e22e;} .cm-s-monokai span.cm-variable {color: #a6e22e;}
.cm-s-monokai span.cm-variable-2 {color: #9effff;} .cm-s-monokai span.cm-variable-2 {color: #9effff;}
.cm-s-monokai span.cm-def {color: #fd971f;} .cm-s-monokai span.cm-def {color: #fd971f;}
.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
.cm-s-monokai span.cm-bracket {color: #f8f8f2;} .cm-s-monokai span.cm-bracket {color: #f8f8f2;}
.cm-s-monokai span.cm-tag {color: #f92672;} .cm-s-monokai span.cm-tag {color: #f92672;}
.cm-s-monokai span.cm-link {color: #ae81ff;} .cm-s-monokai span.cm-link {color: #ae81ff;}
.cm-s-monokai .CodeMirror-matchingbracket { .cm-s-monokai .CodeMirror-matchingbracket {
text-decoration: underline; text-decoration: underline;
color: white !important; color: white !important;
} }

View File

@ -1,9 +1,9 @@
.cm-s-neat span.cm-comment { color: #a86; } .cm-s-neat span.cm-comment { color: #a86; }
.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
.cm-s-neat span.cm-string { color: #a22; } .cm-s-neat span.cm-string { color: #a22; }
.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
.cm-s-neat span.cm-variable { color: black; } .cm-s-neat span.cm-variable { color: black; }
.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
.cm-s-neat span.cm-meta {color: #555;} .cm-s-neat span.cm-meta {color: #555;}
.cm-s-neat span.cm-link { color: #3a3; } .cm-s-neat span.cm-link { color: #3a3; }

View File

@ -1,21 +1,21 @@
/* Loosely based on the Midnight Textmate theme */ /* Loosely based on the Midnight Textmate theme */
.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-night div.CodeMirror-selected { background: #447 !important; } .cm-s-night div.CodeMirror-selected { background: #447 !important; }
.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-night span.cm-comment { color: #6900a1; } .cm-s-night span.cm-comment { color: #6900a1; }
.cm-s-night span.cm-atom { color: #845dc4; } .cm-s-night span.cm-atom { color: #845dc4; }
.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
.cm-s-night span.cm-keyword { color: #599eff; } .cm-s-night span.cm-keyword { color: #599eff; }
.cm-s-night span.cm-string { color: #37f14a; } .cm-s-night span.cm-string { color: #37f14a; }
.cm-s-night span.cm-meta { color: #7678e2; } .cm-s-night span.cm-meta { color: #7678e2; }
.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
.cm-s-night span.cm-error { color: #9d1e15; } .cm-s-night span.cm-error { color: #9d1e15; }
.cm-s-night span.cm-bracket { color: #8da6ce; } .cm-s-night span.cm-bracket { color: #8da6ce; }
.cm-s-night span.cm-comment { color: #6900a1; } .cm-s-night span.cm-comment { color: #6900a1; }
.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
.cm-s-night span.cm-link { color: #845dc4; } .cm-s-night span.cm-link { color: #845dc4; }

View File

@ -1,21 +1,21 @@
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
.cm-s-rubyblue.CodeMirror { background: #112435; color: white; } .cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
.cm-s-rubyblue .CodeMirror-linenumber { color: white; } .cm-s-rubyblue .CodeMirror-linenumber { color: white; }
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
.cm-s-rubyblue span.cm-atom { color: #F4C20B; } .cm-s-rubyblue span.cm-atom { color: #F4C20B; }
.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
.cm-s-rubyblue span.cm-keyword { color: #F0F; } .cm-s-rubyblue span.cm-keyword { color: #F0F; }
.cm-s-rubyblue span.cm-string { color: #F08047; } .cm-s-rubyblue span.cm-string { color: #F08047; }
.cm-s-rubyblue span.cm-meta { color: #F0F; } .cm-s-rubyblue span.cm-meta { color: #F0F; }
.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
.cm-s-rubyblue span.cm-error { color: #AF2018; } .cm-s-rubyblue span.cm-error { color: #AF2018; }
.cm-s-rubyblue span.cm-bracket { color: #F0F; } .cm-s-rubyblue span.cm-bracket { color: #F0F; }
.cm-s-rubyblue span.cm-link { color: #F4C20B; } .cm-s-rubyblue span.cm-link { color: #F4C20B; }
.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }

File diff suppressed because one or more lines are too long

View File

@ -1,26 +1,26 @@
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
.cm-s-twilight .CodeMirror-linenumber { color: #aaa; } .cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
.cm-s-twilight .cm-atom { color: #FC0; } .cm-s-twilight .cm-atom { color: #FC0; }
.cm-s-twilight .cm-number { color: #ca7841; } /**/ .cm-s-twilight .cm-number { color: #ca7841; } /**/
.cm-s-twilight .cm-def { color: #8DA6CE; } .cm-s-twilight .cm-def { color: #8DA6CE; }
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
.cm-s-twilight .cm-operator { color: #cda869; } /**/ .cm-s-twilight .cm-operator { color: #cda869; } /**/
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
.cm-s-twilight .cm-error { border-bottom: 1px solid red; } .cm-s-twilight .cm-error { border-bottom: 1px solid red; }
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
.cm-s-twilight .cm-tag { color: #997643; } /**/ .cm-s-twilight .cm-tag { color: #997643; } /**/
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
.cm-s-twilight .cm-header { color: #FF6400; } .cm-s-twilight .cm-header { color: #FF6400; }
.cm-s-twilight .cm-hr { color: #AEAEAE; } .cm-s-twilight .cm-hr { color: #AEAEAE; }
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/

View File

@ -1,27 +1,27 @@
/* Taken from the popular Visual Studio Vibrant Ink Schema */ /* Taken from the popular Visual Studio Vibrant Ink Schema */
.cm-s-vibrant-ink.CodeMirror { background: black; color: white; } .cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-vibrant-ink .cm-keyword { color: #CC7832; } .cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
.cm-s-vibrant-ink .cm-atom { color: #FC0; } .cm-s-vibrant-ink .cm-atom { color: #FC0; }
.cm-s-vibrant-ink .cm-number { color: #FFEE98; } .cm-s-vibrant-ink .cm-number { color: #FFEE98; }
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; } .cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D } .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D } .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
.cm-s-vibrant-ink .cm-operator { color: #888; } .cm-s-vibrant-ink .cm-operator { color: #888; }
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
.cm-s-vibrant-ink .cm-string { color: #A5C25C } .cm-s-vibrant-ink .cm-string { color: #A5C25C }
.cm-s-vibrant-ink .cm-string-2 { color: red } .cm-s-vibrant-ink .cm-string-2 { color: red }
.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-header { color: #FF6400; } .cm-s-vibrant-ink .cm-header { color: #FF6400; }
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
.cm-s-vibrant-ink .cm-link { color: blue; } .cm-s-vibrant-ink .cm-link { color: blue; }

View File

@ -1,46 +1,46 @@
/* /*
Copyright (C) 2011 by MarkLogic Corporation Copyright (C) 2011 by MarkLogic Corporation
Author: Mike Brevoort <mike@brevoort.com> Author: Mike Brevoort <mike@brevoort.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; } .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;} .cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;} .cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
.cm-s-xq-dark span.cm-number {color: #164;} .cm-s-xq-dark span.cm-number {color: #164;}
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
.cm-s-xq-dark span.cm-variable {color: #FFF;} .cm-s-xq-dark span.cm-variable {color: #FFF;}
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;} .cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;} .cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
.cm-s-xq-dark span.cm-property {} .cm-s-xq-dark span.cm-property {}
.cm-s-xq-dark span.cm-operator {} .cm-s-xq-dark span.cm-operator {}
.cm-s-xq-dark span.cm-comment {color: gray;} .cm-s-xq-dark span.cm-comment {color: gray;}
.cm-s-xq-dark span.cm-string {color: #9FEE00;} .cm-s-xq-dark span.cm-string {color: #9FEE00;}
.cm-s-xq-dark span.cm-meta {color: yellow;} .cm-s-xq-dark span.cm-meta {color: yellow;}
.cm-s-xq-dark span.cm-error {color: #f00;} .cm-s-xq-dark span.cm-error {color: #f00;}
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;} .cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
.cm-s-xq-dark span.cm-builtin {color: #30a;} .cm-s-xq-dark span.cm-builtin {color: #30a;}
.cm-s-xq-dark span.cm-bracket {color: #cc7;} .cm-s-xq-dark span.cm-bracket {color: #cc7;}
.cm-s-xq-dark span.cm-tag {color: #FFBD40;} .cm-s-xq-dark span.cm-tag {color: #FFBD40;}
.cm-s-xq-dark span.cm-attribute {color: #FFF700;} .cm-s-xq-dark span.cm-attribute {color: #FFF700;}

Some files were not shown because too many files have changed in this diff Show More