reverted 4622 codemirror3 because broke zencoding and drops support for IE7, we do not use the new features anyway. Sorry

This commit is contained in:
mdipierro
2013-01-23 08:17:59 -06:00
parent b7f2991246
commit b1f77b9c4a
47 changed files with 4458 additions and 7601 deletions
+15 -13
View File
@@ -70,12 +70,11 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
return "meta";
}
else {
var isClose = stream.eat("/");
type = stream.eat("/") ? "closeTag" : "openTag";
stream.eatSpace();
tagName = "";
var c;
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
if (!tagName) return "error";
type = isClose ? "closeTag" : "openTag";
state.tokenize = inTag;
return "tag";
}
@@ -115,7 +114,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
return state.tokenize(stream, state);
}
else {
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
return "word";
}
}
@@ -211,16 +210,14 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
}
function endtag(startOfLine) {
return function(type) {
var tagName = curState.tagName;
curState.tagName = null;
if (type == "selfcloseTag" ||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
maybePopContext(tagName.toLowerCase());
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase()))) {
maybePopContext(curState.tagName.toLowerCase());
return cont();
}
if (type == "endTag") {
maybePopContext(tagName.toLowerCase());
pushContext(tagName, startOfLine);
maybePopContext(curState.tagName.toLowerCase());
pushContext(curState.tagName, startOfLine);
return cont();
}
return cont();
@@ -258,7 +255,6 @@ 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";
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
}
function attvalue(type) {
@@ -312,9 +308,15 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
else return 0;
},
electricChars: "/",
compareStates: function(a, b) {
if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
if (!ca || !cb) return ca == cb;
if (ca.tagName != cb.tagName || ca.indent != cb.indent) return false;
}
},
configuration: parserConfig.htmlMode ? "html" : "xml"
electricChars: "/"
};
});