mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 23:54:42 -04:00
Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor
This commit is contained in:
parent
ce65e58096
commit
eaa8ccaccb
381 changed files with 6726 additions and 2636 deletions
40
public/vendor/codemirror/mode/coffeescript/coffeescript.js
vendored
Executable file → Normal file
40
public/vendor/codemirror/mode/coffeescript/coffeescript.js
vendored
Executable file → Normal file
|
@ -25,7 +25,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
|
||||
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
|
||||
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
var properties = /^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
|
||||
|
||||
var wordOperators = wordRegexp(["and", "or", "not",
|
||||
"is", "isnt", "in",
|
||||
|
@ -145,6 +145,8 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle operators and delimiters
|
||||
if (stream.match(operators) || stream.match(wordOperators)) {
|
||||
return "operator";
|
||||
|
@ -157,6 +159,10 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
return "atom";
|
||||
}
|
||||
|
||||
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
|
||||
return "property";
|
||||
}
|
||||
|
||||
if (stream.match(keywords)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
@ -165,10 +171,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
return "variable";
|
||||
}
|
||||
|
||||
if (stream.match(properties)) {
|
||||
return "property";
|
||||
}
|
||||
|
||||
// Handle non-detected items
|
||||
stream.next();
|
||||
return ERRORCLASS;
|
||||
|
@ -265,24 +267,11 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
var style = state.tokenize(stream, state);
|
||||
var current = stream.current();
|
||||
|
||||
// Handle "." connected identifiers
|
||||
if (current === ".") {
|
||||
style = state.tokenize(stream, state);
|
||||
current = stream.current();
|
||||
if (/^\.[\w$]+$/.test(current)) {
|
||||
return "variable";
|
||||
} else {
|
||||
return ERRORCLASS;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle scope changes.
|
||||
if (current === "return") {
|
||||
state.dedent = true;
|
||||
}
|
||||
if (((current === "->" || current === "=>") &&
|
||||
!state.lambda &&
|
||||
!stream.peek())
|
||||
if (((current === "->" || current === "=>") && stream.eol())
|
||||
|| style === "indent") {
|
||||
indent(stream, state);
|
||||
}
|
||||
|
@ -324,8 +313,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
return {
|
||||
tokenize: tokenBase,
|
||||
scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
|
||||
lastToken: null,
|
||||
lambda: false,
|
||||
prop: false,
|
||||
dedent: 0
|
||||
};
|
||||
},
|
||||
|
@ -335,12 +323,9 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
if (fillAlign && stream.sol()) fillAlign.align = false;
|
||||
|
||||
var style = tokenLexer(stream, state);
|
||||
if (fillAlign && style && style != "comment") fillAlign.align = true;
|
||||
|
||||
state.lastToken = {style:style, content: stream.current()};
|
||||
|
||||
if (stream.eol() && stream.lambda) {
|
||||
state.lambda = false;
|
||||
if (style && style != "comment") {
|
||||
if (fillAlign) fillAlign.align = true;
|
||||
state.prop = style == "punctuation" && stream.current() == "."
|
||||
}
|
||||
|
||||
return style;
|
||||
|
@ -365,5 +350,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
|
|||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
|
||||
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue