mirror of https://github.com/ColorlibHQ/AdminLTE
update codemirror plugin files
parent
4bbf746378
commit
a2df402653
|
@ -15,7 +15,7 @@
|
||||||
cm.on("blur", onBlur);
|
cm.on("blur", onBlur);
|
||||||
cm.on("change", onChange);
|
cm.on("change", onChange);
|
||||||
cm.on("swapDoc", onChange);
|
cm.on("swapDoc", onChange);
|
||||||
CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = () => onComposition(cm))
|
CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) })
|
||||||
onChange(cm);
|
onChange(cm);
|
||||||
} else if (!val && prev) {
|
} else if (!val && prev) {
|
||||||
cm.off("blur", onBlur);
|
cm.off("blur", onBlur);
|
||||||
|
@ -49,13 +49,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onComposition(cm) {
|
function onComposition(cm) {
|
||||||
var empty = true, input = cm.getInputField()
|
setTimeout(function() {
|
||||||
if (input.nodeName == "TEXTAREA")
|
var empty = false
|
||||||
empty = !input.value
|
if (cm.lineCount() == 1) {
|
||||||
else if (cm.lineCount() == 1)
|
var input = cm.getInputField()
|
||||||
empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
|
empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length
|
||||||
if (empty) clearPlaceholder(cm)
|
: !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
|
||||||
else setPlaceholder(cm)
|
}
|
||||||
|
if (empty) setPlaceholder(cm)
|
||||||
|
else clearPlaceholder(cm)
|
||||||
|
}, 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBlur(cm) {
|
function onBlur(cm) {
|
||||||
|
|
|
@ -128,9 +128,10 @@
|
||||||
replacement = head + "style";
|
replacement = head + "style";
|
||||||
} else {
|
} else {
|
||||||
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
|
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
|
||||||
if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos)))
|
var top = context.length ? context[context.length - 1] : ""
|
||||||
|
if (!context || (context.length && closingTagExists(cm, context, top, pos)))
|
||||||
return CodeMirror.Pass;
|
return CodeMirror.Pass;
|
||||||
replacement = head + context[context.length - 1]
|
replacement = head + top
|
||||||
}
|
}
|
||||||
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
||||||
replacements[i] = replacement;
|
replacements[i] = replacement;
|
||||||
|
|
|
@ -98,6 +98,7 @@
|
||||||
dfn: s,
|
dfn: s,
|
||||||
dir: s,
|
dir: s,
|
||||||
div: s,
|
div: s,
|
||||||
|
dialog: { attrs: { open: null } },
|
||||||
dl: s,
|
dl: s,
|
||||||
dt: s,
|
dt: s,
|
||||||
em: s,
|
em: s,
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
function eachWord(lineText, f) {
|
function eachWord(lineText, f) {
|
||||||
var words = lineText.split(/\s+/)
|
var words = lineText.split(/\s+/)
|
||||||
for (var i = 0; i < words.length; i++)
|
for (var i = 0; i < words.length; i++)
|
||||||
if (words[i]) f(words[i].replace(/[,;]/g, ''))
|
if (words[i]) f(words[i].replace(/[`,;]/g, ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
function findTableByAlias(alias, editor) {
|
function findTableByAlias(alias, editor) {
|
||||||
|
|
|
@ -101,12 +101,12 @@
|
||||||
}
|
}
|
||||||
replaceToken = true;
|
replaceToken = true;
|
||||||
}
|
}
|
||||||
function returnHintsFromAtValues(atValues) {
|
var returnHintsFromAtValues = function(atValues) {
|
||||||
if (atValues)
|
if (atValues)
|
||||||
for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
|
for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
|
||||||
result.push(quote + atValues[i] + quote);
|
result.push(quote + atValues[i] + quote);
|
||||||
return returnHints();
|
return returnHints();
|
||||||
}
|
};
|
||||||
if (atValues && atValues.then) return atValues.then(returnHintsFromAtValues);
|
if (atValues && atValues.then) return atValues.then(returnHintsFromAtValues);
|
||||||
return returnHintsFromAtValues(atValues);
|
return returnHintsFromAtValues(atValues);
|
||||||
} else { // An attribute name
|
} else { // An attribute name
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||||
|
|
||||||
|
// Depends on jshint.js from https://github.com/jshint/jshint
|
||||||
|
|
||||||
(function(mod) {
|
(function(mod) {
|
||||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
mod(require("../../lib/codemirror"));
|
mod(require("../../lib/codemirror"));
|
||||||
|
|
|
@ -3285,19 +3285,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureFocus(cm) {
|
function ensureFocus(cm) {
|
||||||
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
|
if (!cm.hasFocus()) {
|
||||||
|
cm.display.input.focus();
|
||||||
|
if (!cm.state.focused) { onFocus(cm); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delayBlurEvent(cm) {
|
function delayBlurEvent(cm) {
|
||||||
cm.state.delayingBlurEvent = true;
|
cm.state.delayingBlurEvent = true;
|
||||||
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
||||||
cm.state.delayingBlurEvent = false;
|
cm.state.delayingBlurEvent = false;
|
||||||
onBlur(cm);
|
if (cm.state.focused) { onBlur(cm); }
|
||||||
} }, 100);
|
} }, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFocus(cm, e) {
|
function onFocus(cm, e) {
|
||||||
if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
|
if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }
|
||||||
|
|
||||||
if (cm.options.readOnly == "nocursor") { return }
|
if (cm.options.readOnly == "nocursor") { return }
|
||||||
if (!cm.state.focused) {
|
if (!cm.state.focused) {
|
||||||
|
@ -3479,14 +3482,15 @@
|
||||||
if (newTop != screentop) { result.scrollTop = newTop; }
|
if (newTop != screentop) { result.scrollTop = newTop; }
|
||||||
}
|
}
|
||||||
|
|
||||||
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
|
var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
|
||||||
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
|
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
|
||||||
|
var screenw = displayWidth(cm) - display.gutters.offsetWidth;
|
||||||
var tooWide = rect.right - rect.left > screenw;
|
var tooWide = rect.right - rect.left > screenw;
|
||||||
if (tooWide) { rect.right = rect.left + screenw; }
|
if (tooWide) { rect.right = rect.left + screenw; }
|
||||||
if (rect.left < 10)
|
if (rect.left < 10)
|
||||||
{ result.scrollLeft = 0; }
|
{ result.scrollLeft = 0; }
|
||||||
else if (rect.left < screenleft)
|
else if (rect.left < screenleft)
|
||||||
{ result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
|
{ result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
|
||||||
else if (rect.right > screenw + screenleft - 3)
|
else if (rect.right > screenw + screenleft - 3)
|
||||||
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
|
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
|
||||||
return result
|
return result
|
||||||
|
@ -5768,7 +5772,7 @@
|
||||||
changeLine(doc, handle, "widget", function (line) {
|
changeLine(doc, handle, "widget", function (line) {
|
||||||
var widgets = line.widgets || (line.widgets = []);
|
var widgets = line.widgets || (line.widgets = []);
|
||||||
if (widget.insertAt == null) { widgets.push(widget); }
|
if (widget.insertAt == null) { widgets.push(widget); }
|
||||||
else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
|
else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }
|
||||||
widget.line = line;
|
widget.line = line;
|
||||||
if (cm && !lineIsHidden(doc, line)) {
|
if (cm && !lineIsHidden(doc, line)) {
|
||||||
var aboveVisible = heightAtLine(line) < doc.scrollTop;
|
var aboveVisible = heightAtLine(line) < doc.scrollTop;
|
||||||
|
@ -7377,6 +7381,10 @@
|
||||||
var dragEnd = operation(cm, function (e) {
|
var dragEnd = operation(cm, function (e) {
|
||||||
if (webkit) { display.scroller.draggable = false; }
|
if (webkit) { display.scroller.draggable = false; }
|
||||||
cm.state.draggingText = false;
|
cm.state.draggingText = false;
|
||||||
|
if (cm.state.delayingBlurEvent) {
|
||||||
|
if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }
|
||||||
|
else { delayBlurEvent(cm); }
|
||||||
|
}
|
||||||
off(display.wrapper.ownerDocument, "mouseup", dragEnd);
|
off(display.wrapper.ownerDocument, "mouseup", dragEnd);
|
||||||
off(display.wrapper.ownerDocument, "mousemove", mouseMove);
|
off(display.wrapper.ownerDocument, "mousemove", mouseMove);
|
||||||
off(display.scroller, "dragstart", dragStart);
|
off(display.scroller, "dragstart", dragStart);
|
||||||
|
@ -7400,15 +7408,15 @@
|
||||||
if (webkit) { display.scroller.draggable = true; }
|
if (webkit) { display.scroller.draggable = true; }
|
||||||
cm.state.draggingText = dragEnd;
|
cm.state.draggingText = dragEnd;
|
||||||
dragEnd.copy = !behavior.moveOnDrag;
|
dragEnd.copy = !behavior.moveOnDrag;
|
||||||
// IE's approach to draggable
|
|
||||||
if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
|
|
||||||
on(display.wrapper.ownerDocument, "mouseup", dragEnd);
|
on(display.wrapper.ownerDocument, "mouseup", dragEnd);
|
||||||
on(display.wrapper.ownerDocument, "mousemove", mouseMove);
|
on(display.wrapper.ownerDocument, "mousemove", mouseMove);
|
||||||
on(display.scroller, "dragstart", dragStart);
|
on(display.scroller, "dragstart", dragStart);
|
||||||
on(display.scroller, "drop", dragEnd);
|
on(display.scroller, "drop", dragEnd);
|
||||||
|
|
||||||
delayBlurEvent(cm);
|
cm.state.delayingBlurEvent = true;
|
||||||
setTimeout(function () { return display.input.focus(); }, 20);
|
setTimeout(function () { return display.input.focus(); }, 20);
|
||||||
|
// IE's approach to draggable
|
||||||
|
if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function rangeForUnit(cm, pos, unit) {
|
function rangeForUnit(cm, pos, unit) {
|
||||||
|
@ -7421,6 +7429,7 @@
|
||||||
|
|
||||||
// Normal selection, as opposed to text dragging.
|
// Normal selection, as opposed to text dragging.
|
||||||
function leftButtonSelect(cm, event, start, behavior) {
|
function leftButtonSelect(cm, event, start, behavior) {
|
||||||
|
if (ie) { delayBlurEvent(cm); }
|
||||||
var display = cm.display, doc = cm.doc;
|
var display = cm.display, doc = cm.doc;
|
||||||
e_preventDefault(event);
|
e_preventDefault(event);
|
||||||
|
|
||||||
|
@ -9781,7 +9790,7 @@
|
||||||
|
|
||||||
addLegacyProps(CodeMirror);
|
addLegacyProps(CodeMirror);
|
||||||
|
|
||||||
CodeMirror.version = "5.58.0";
|
CodeMirror.version = "5.58.3";
|
||||||
|
|
||||||
return CodeMirror;
|
return CodeMirror;
|
||||||
|
|
||||||
|
|
|
@ -82,15 +82,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||||
state.tokenize = tokenString(ch);
|
state.tokenize = tokenString(ch);
|
||||||
return state.tokenize(stream, state);
|
return state.tokenize(stream, state);
|
||||||
}
|
}
|
||||||
if (isPunctuationChar.test(ch)) {
|
|
||||||
curPunc = ch;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (numberStart.test(ch)) {
|
if (numberStart.test(ch)) {
|
||||||
stream.backUp(1)
|
stream.backUp(1)
|
||||||
if (stream.match(number)) return "number"
|
if (stream.match(number)) return "number"
|
||||||
stream.next()
|
stream.next()
|
||||||
}
|
}
|
||||||
|
if (isPunctuationChar.test(ch)) {
|
||||||
|
curPunc = ch;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (ch == "/") {
|
if (ch == "/") {
|
||||||
if (stream.eat("*")) {
|
if (stream.eat("*")) {
|
||||||
state.tokenize = tokenComment;
|
state.tokenize = tokenComment;
|
||||||
|
|
|
@ -29,7 +29,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
||||||
valueKeywords = parserConfig.valueKeywords || {},
|
valueKeywords = parserConfig.valueKeywords || {},
|
||||||
allowNested = parserConfig.allowNested,
|
allowNested = parserConfig.allowNested,
|
||||||
lineComment = parserConfig.lineComment,
|
lineComment = parserConfig.lineComment,
|
||||||
supportsAtComponent = parserConfig.supportsAtComponent === true;
|
supportsAtComponent = parserConfig.supportsAtComponent === true,
|
||||||
|
highlightNonStandardPropertyKeywords = config.highlightNonStandardPropertyKeywords !== false;
|
||||||
|
|
||||||
var type, override;
|
var type, override;
|
||||||
function ret(style, tp) { type = tp; return style; }
|
function ret(style, tp) { type = tp; return style; }
|
||||||
|
@ -197,7 +198,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
||||||
override = "property";
|
override = "property";
|
||||||
return "maybeprop";
|
return "maybeprop";
|
||||||
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
||||||
override = "string-2";
|
override = highlightNonStandardPropertyKeywords ? "string-2" : "property";
|
||||||
return "maybeprop";
|
return "maybeprop";
|
||||||
} else if (allowNested) {
|
} else if (allowNested) {
|
||||||
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
||||||
|
@ -291,7 +292,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
||||||
else if (propertyKeywords.hasOwnProperty(word))
|
else if (propertyKeywords.hasOwnProperty(word))
|
||||||
override = "property";
|
override = "property";
|
||||||
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
||||||
override = "string-2";
|
override = highlightNonStandardPropertyKeywords ? "string-2" : "property";
|
||||||
else if (valueKeywords.hasOwnProperty(word))
|
else if (valueKeywords.hasOwnProperty(word))
|
||||||
override = "atom";
|
override = "atom";
|
||||||
else if (colorKeywords.hasOwnProperty(word))
|
else if (colorKeywords.hasOwnProperty(word))
|
||||||
|
|
|
@ -74,7 +74,8 @@
|
||||||
name: "xml",
|
name: "xml",
|
||||||
htmlMode: true,
|
htmlMode: true,
|
||||||
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
||||||
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
|
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag,
|
||||||
|
allowMissingTagName: parserConfig.allowMissingTagName,
|
||||||
});
|
});
|
||||||
|
|
||||||
var tags = {};
|
var tags = {};
|
||||||
|
|
|
@ -126,7 +126,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
var kw = keywords[word]
|
var kw = keywords[word]
|
||||||
return ret(kw.type, kw.style, word)
|
return ret(kw.type, kw.style, word)
|
||||||
}
|
}
|
||||||
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
|
if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false))
|
||||||
return ret("async", "keyword", word)
|
return ret("async", "keyword", word)
|
||||||
}
|
}
|
||||||
return ret("variable", "variable", word)
|
return ret("variable", "variable", word)
|
||||||
|
@ -868,7 +868,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
},
|
},
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
indent: function(state, textAfter) {
|
||||||
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;
|
||||||
if (state.tokenize != tokenBase) return 0;
|
if (state.tokenize != tokenBase) return 0;
|
||||||
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
||||||
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
||||||
|
|
|
@ -255,21 +255,21 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tokenCallOrDef(stream, state) {
|
function tokenCallOrDef(stream, state) {
|
||||||
var match = stream.match(/^(\(\s*)/);
|
for (;;) {
|
||||||
|
var match = stream.match(/^(\(\s*)/), charsAdvanced = 0;
|
||||||
if (match) {
|
if (match) {
|
||||||
if (state.firstParenPos < 0)
|
if (state.firstParenPos < 0)
|
||||||
state.firstParenPos = state.scopes.length;
|
state.firstParenPos = state.scopes.length;
|
||||||
state.scopes.push('(');
|
state.scopes.push('(');
|
||||||
state.charsAdvanced += match[1].length;
|
charsAdvanced += match[1].length;
|
||||||
}
|
}
|
||||||
if (currentScope(state) == '(' && stream.match(/^\)/)) {
|
if (currentScope(state) == '(' && stream.match(/^\)/)) {
|
||||||
state.scopes.pop();
|
state.scopes.pop();
|
||||||
state.charsAdvanced += 1;
|
charsAdvanced += 1;
|
||||||
if (state.scopes.length <= state.firstParenPos) {
|
if (state.scopes.length <= state.firstParenPos) {
|
||||||
var isDefinition = stream.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/, false);
|
var isDefinition = stream.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/, false);
|
||||||
stream.backUp(state.charsAdvanced);
|
stream.backUp(charsAdvanced);
|
||||||
state.firstParenPos = -1;
|
state.firstParenPos = -1;
|
||||||
state.charsAdvanced = 0;
|
|
||||||
state.tokenize = tokenBase;
|
state.tokenize = tokenBase;
|
||||||
if (isDefinition)
|
if (isDefinition)
|
||||||
return "def";
|
return "def";
|
||||||
|
@ -280,16 +280,18 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
|
||||||
// to undo anything done upto here if a function call or definition splits
|
// to undo anything done upto here if a function call or definition splits
|
||||||
// over two or more lines.
|
// over two or more lines.
|
||||||
if (stream.match(/^$/g, false)) {
|
if (stream.match(/^$/g, false)) {
|
||||||
stream.backUp(state.charsAdvanced);
|
stream.backUp(charsAdvanced);
|
||||||
while (state.scopes.length > state.firstParenPos)
|
while (state.scopes.length > state.firstParenPos)
|
||||||
state.scopes.pop();
|
state.scopes.pop();
|
||||||
state.firstParenPos = -1;
|
state.firstParenPos = -1;
|
||||||
state.charsAdvanced = 0;
|
|
||||||
state.tokenize = tokenBase;
|
state.tokenize = tokenBase;
|
||||||
return "builtin";
|
return "builtin";
|
||||||
}
|
}
|
||||||
state.charsAdvanced += stream.match(/^([^()]*)/)[1].length;
|
if (!stream.match(/^[^()]+/)) {
|
||||||
return state.tokenize(stream, state);
|
stream.next()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tokenAnnotation(stream, state) {
|
function tokenAnnotation(stream, state) {
|
||||||
|
@ -383,7 +385,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
|
||||||
nestedComments: 0,
|
nestedComments: 0,
|
||||||
nestedGenerators: 0,
|
nestedGenerators: 0,
|
||||||
nestedParameters: 0,
|
nestedParameters: 0,
|
||||||
charsAdvanced: 0,
|
|
||||||
firstParenPos: -1
|
firstParenPos: -1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -169,7 +169,8 @@
|
||||||
{name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
|
{name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
|
||||||
{name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
|
{name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
|
||||||
{name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
|
{name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
|
||||||
{name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]}
|
{name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
|
||||||
|
{name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
|
||||||
];
|
];
|
||||||
// Ensure all modes have a mime property for backwards compatibility
|
// Ensure all modes have a mime property for backwards compatibility
|
||||||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
|
for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
|
||||||
|
|
|
@ -70,6 +70,13 @@ CodeMirror.defineMode('shell', function() {
|
||||||
stream.eatWhile(/\w/);
|
stream.eatWhile(/\w/);
|
||||||
return 'attribute';
|
return 'attribute';
|
||||||
}
|
}
|
||||||
|
if (ch == "<") {
|
||||||
|
var heredoc = stream.match(/^<-?\s+(.*)/)
|
||||||
|
if (heredoc) {
|
||||||
|
state.tokens.unshift(tokenHeredoc(heredoc[1]))
|
||||||
|
return 'string-2'
|
||||||
|
}
|
||||||
|
}
|
||||||
if (/\d/.test(ch)) {
|
if (/\d/.test(ch)) {
|
||||||
stream.eatWhile(/\d/);
|
stream.eatWhile(/\d/);
|
||||||
if(stream.eol() || !/\w/.test(stream.peek())) {
|
if(stream.eol() || !/\w/.test(stream.peek())) {
|
||||||
|
@ -129,6 +136,14 @@ CodeMirror.defineMode('shell', function() {
|
||||||
return 'def';
|
return 'def';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function tokenHeredoc(delim) {
|
||||||
|
return function(stream, state) {
|
||||||
|
if (stream.sol() && stream.string == delim) state.tokens.shift()
|
||||||
|
stream.skipToEnd()
|
||||||
|
return "string-2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function tokenize(stream, state) {
|
function tokenize(stream, state) {
|
||||||
return (state.tokens[0] || tokenBase) (stream, state);
|
return (state.tokens[0] || tokenBase) (stream, state);
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
"alias": { noEndTag: true },
|
"alias": { noEndTag: true },
|
||||||
"delpackage": { noEndTag: true },
|
"delpackage": { noEndTag: true },
|
||||||
"namespace": { noEndTag: true, soyState: "namespace-def" },
|
"namespace": { noEndTag: true, soyState: "namespace-def" },
|
||||||
|
"@attribute": paramData,
|
||||||
|
"@attribute?": paramData,
|
||||||
"@param": paramData,
|
"@param": paramData,
|
||||||
"@param?": paramData,
|
"@param?": paramData,
|
||||||
"@inject": paramData,
|
"@inject": paramData,
|
||||||
|
@ -53,7 +55,7 @@
|
||||||
CodeMirror.defineMode("soy", function(config) {
|
CodeMirror.defineMode("soy", function(config) {
|
||||||
var textMode = CodeMirror.getMode(config, "text/plain");
|
var textMode = CodeMirror.getMode(config, "text/plain");
|
||||||
var modes = {
|
var modes = {
|
||||||
html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}),
|
html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false, allowMissingTagName: true}),
|
||||||
attributes: textMode,
|
attributes: textMode,
|
||||||
text: textMode,
|
text: textMode,
|
||||||
uri: textMode,
|
uri: textMode,
|
||||||
|
@ -274,6 +276,11 @@
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
case "param-def":
|
case "param-def":
|
||||||
|
if (match = stream.match(/^\*/)) {
|
||||||
|
state.soyState.pop();
|
||||||
|
state.soyState.push("param-type");
|
||||||
|
return "type";
|
||||||
|
}
|
||||||
if (match = stream.match(/^\w+/)) {
|
if (match = stream.match(/^\w+/)) {
|
||||||
state.variables = prepend(state.variables, match[0]);
|
state.variables = prepend(state.variables, match[0]);
|
||||||
state.soyState.pop();
|
state.soyState.pop();
|
||||||
|
@ -491,6 +498,17 @@
|
||||||
}
|
}
|
||||||
return expression(stream, state);
|
return expression(stream, state);
|
||||||
|
|
||||||
|
case "template-call-expression":
|
||||||
|
if (stream.match(/^([\w-?]+)(?==)/)) {
|
||||||
|
return "attribute";
|
||||||
|
} else if (stream.eat('>')) {
|
||||||
|
state.soyState.pop();
|
||||||
|
return "keyword";
|
||||||
|
} else if (stream.eat('/>')) {
|
||||||
|
state.soyState.pop();
|
||||||
|
return "keyword";
|
||||||
|
}
|
||||||
|
return expression(stream, state);
|
||||||
case "literal":
|
case "literal":
|
||||||
if (stream.match(/^(?=\{\/literal})/)) {
|
if (stream.match(/^(?=\{\/literal})/)) {
|
||||||
state.soyState.pop();
|
state.soyState.pop();
|
||||||
|
@ -556,6 +574,15 @@
|
||||||
state.soyState.push("import");
|
state.soyState.push("import");
|
||||||
state.indent += 2 * config.indentUnit;
|
state.indent += 2 * config.indentUnit;
|
||||||
return "keyword";
|
return "keyword";
|
||||||
|
} else if (match = stream.match(/^<\{/)) {
|
||||||
|
state.soyState.push("template-call-expression");
|
||||||
|
state.tag = "print";
|
||||||
|
state.indent += 2 * config.indentUnit;
|
||||||
|
state.soyState.push("tag");
|
||||||
|
return "keyword";
|
||||||
|
} else if (match = stream.match(/^<\/>/)) {
|
||||||
|
state.indent -= 2 * config.indentUnit;
|
||||||
|
return "keyword";
|
||||||
}
|
}
|
||||||
|
|
||||||
return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
|
return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
|
||||||
|
|
|
@ -60,12 +60,18 @@ CodeMirror.defineMode("sparql", function(config) {
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
return "comment";
|
return "comment";
|
||||||
}
|
}
|
||||||
|
else if (ch === "^") {
|
||||||
|
ch = stream.peek();
|
||||||
|
if (ch === "^") stream.eat("^");
|
||||||
|
else stream.eatWhile(operatorChars);
|
||||||
|
return "operator";
|
||||||
|
}
|
||||||
else if (operatorChars.test(ch)) {
|
else if (operatorChars.test(ch)) {
|
||||||
stream.eatWhile(operatorChars);
|
stream.eatWhile(operatorChars);
|
||||||
return "operator";
|
return "operator";
|
||||||
}
|
}
|
||||||
else if (ch == ":") {
|
else if (ch == ":") {
|
||||||
stream.eatWhile(/[\w\d\._\-]/);
|
eatPnLocal(stream);
|
||||||
return "atom";
|
return "atom";
|
||||||
}
|
}
|
||||||
else if (ch == "@") {
|
else if (ch == "@") {
|
||||||
|
@ -75,7 +81,7 @@ CodeMirror.defineMode("sparql", function(config) {
|
||||||
else {
|
else {
|
||||||
stream.eatWhile(/[_\w\d]/);
|
stream.eatWhile(/[_\w\d]/);
|
||||||
if (stream.eat(":")) {
|
if (stream.eat(":")) {
|
||||||
stream.eatWhile(/[\w\d_\-]/);
|
eatPnLocal(stream);
|
||||||
return "atom";
|
return "atom";
|
||||||
}
|
}
|
||||||
var word = stream.current();
|
var word = stream.current();
|
||||||
|
@ -88,6 +94,10 @@ CodeMirror.defineMode("sparql", function(config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eatPnLocal(stream) {
|
||||||
|
while (stream.match(/([:\w\d._-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-fA-F0-9][a-fA-F0-9])/));
|
||||||
|
}
|
||||||
|
|
||||||
function tokenLiteral(quote) {
|
function tokenLiteral(quote) {
|
||||||
return function(stream, state) {
|
return function(stream, state) {
|
||||||
var escaped = false, ch;
|
var escaped = false, ch;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -189,7 +189,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||||
|
|
||||||
function Context(state, tagName, startOfLine) {
|
function Context(state, tagName, startOfLine) {
|
||||||
this.prev = state.context;
|
this.prev = state.context;
|
||||||
this.tagName = tagName;
|
this.tagName = tagName || "";
|
||||||
this.indent = state.indented;
|
this.indent = state.indented;
|
||||||
this.startOfLine = startOfLine;
|
this.startOfLine = startOfLine;
|
||||||
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
||||||
|
@ -399,7 +399,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||||
xmlCurrentContext: function(state) {
|
xmlCurrentContext: function(state) {
|
||||||
var context = []
|
var context = []
|
||||||
for (var cx = state.context; cx; cx = cx.prev)
|
for (var cx = state.context; cx; cx = cx.prev)
|
||||||
if (cx.tagName) context.push(cx.tagName)
|
context.push(cx.tagName)
|
||||||
return context.reverse()
|
return context.reverse()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue