mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 15:49:56 +01:00
codemirror 5.65.9
This commit is contained in:
20
libraries/codemirror/mode/xml/xml.js
vendored
20
libraries/codemirror/mode/xml/xml.js
vendored
@@ -1,5 +1,5 @@
|
||||
// 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/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
@@ -187,6 +187,10 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
};
|
||||
}
|
||||
|
||||
function lower(tagName) {
|
||||
return tagName && tagName.toLowerCase();
|
||||
}
|
||||
|
||||
function Context(state, tagName, startOfLine) {
|
||||
this.prev = state.context;
|
||||
this.tagName = tagName || "";
|
||||
@@ -205,8 +209,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
return;
|
||||
}
|
||||
parentTagName = state.context.tagName;
|
||||
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
|
||||
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
||||
if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) ||
|
||||
!config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) {
|
||||
return;
|
||||
}
|
||||
popContext(state);
|
||||
@@ -240,7 +244,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
if (type == "word") {
|
||||
var tagName = stream.current();
|
||||
if (state.context && state.context.tagName != tagName &&
|
||||
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
||||
config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName)))
|
||||
popContext(state);
|
||||
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
|
||||
setStyle = "tag";
|
||||
@@ -279,7 +283,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
var tagName = state.tagName, tagStart = state.tagStart;
|
||||
state.tagName = state.tagStart = null;
|
||||
if (type == "selfcloseTag" ||
|
||||
config.autoSelfClosers.hasOwnProperty(tagName)) {
|
||||
config.autoSelfClosers.hasOwnProperty(lower(tagName))) {
|
||||
maybePopContext(state, tagName);
|
||||
} else {
|
||||
maybePopContext(state, tagName);
|
||||
@@ -359,7 +363,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
if (context.tagName == tagAfter[2]) {
|
||||
context = context.prev;
|
||||
break;
|
||||
} else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
||||
} else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) {
|
||||
context = context.prev;
|
||||
} else {
|
||||
break;
|
||||
@@ -367,8 +371,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
||||
}
|
||||
} else if (tagAfter) { // Opening tag spotted
|
||||
while (context) {
|
||||
var grabbers = config.contextGrabbers[context.tagName];
|
||||
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
||||
var grabbers = config.contextGrabbers[lower(context.tagName)];
|
||||
if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2])))
|
||||
context = context.prev;
|
||||
else
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user