codemirror 3.18 with enabled the fullscreen addon

This commit is contained in:
Paolo
2013-09-26 21:52:53 +02:00
parent 633acffd28
commit ddf1998d49
166 changed files with 3820 additions and 2321 deletions
+19 -4
View File
@@ -1,6 +1,7 @@
CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag || true;
var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
@@ -111,6 +112,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
return "error";
} else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
state.stringStartCol = stream.column();
return state.tokenize(stream, state);
} else {
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
@@ -119,7 +121,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
}
function inAttribute(quote) {
return function(stream, state) {
var closure = function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
@@ -128,6 +130,8 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
}
return "string";
};
closure.isInAttribute = true;
return closure;
}
function inBlock(style, terminator) {
@@ -257,7 +261,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
function attribute(type) {
if (type == "equals") return cont(attvalue, attributes);
if (!Kludges.allowMissing) setStyle = "error";
else if (type == "word") setStyle = "attribute";
else if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
}
function attvalue(type) {
@@ -299,10 +303,20 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
indent: function(state, textAfter, fullLine) {
var context = state.context;
// Indent multi-line strings (e.g. css).
if (state.tokenize.isInAttribute) {
return state.stringStartCol + 1;
}
if ((state.tokenize != inTag && state.tokenize != inText) ||
context && context.noIndent)
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
if (state.tagName) return state.tagStart + indentUnit * multilineTagIndentFactor;
// Indent the starts of attribute names.
if (state.tagName) {
if (multilineTagIndentPastTag)
return state.tagStart + state.tagName.length + 2;
else
return state.tagStart + indentUnit * multilineTagIndentFactor;
}
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter))
context = context.prev;
@@ -316,7 +330,8 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
blockCommentStart: "<!--",
blockCommentEnd: "-->",
configuration: parserConfig.htmlMode ? "html" : "xml"
configuration: parserConfig.htmlMode ? "html" : "xml",
helperType: parserConfig.htmlMode ? "html" : "xml"
};
});