diff --git a/js/vendor/codemirror/lib/codemirror.js b/js/vendor/codemirror/lib/codemirror.js index 5c464cb086..0436a99683 100644 --- a/js/vendor/codemirror/lib/codemirror.js +++ b/js/vendor/codemirror/lib/codemirror.js @@ -3285,19 +3285,22 @@ } 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) { cm.state.delayingBlurEvent = true; setTimeout(function () { if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; - onBlur(cm); + if (cm.state.focused) { onBlur(cm); } } }, 100); } 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.state.focused) { @@ -5769,7 +5772,7 @@ changeLine(doc, handle, "widget", function (line) { var widgets = line.widgets || (line.widgets = []); 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; if (cm && !lineIsHidden(doc, line)) { var aboveVisible = heightAtLine(line) < doc.scrollTop; @@ -7378,6 +7381,10 @@ var dragEnd = operation(cm, function (e) { if (webkit) { display.scroller.draggable = 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, "mousemove", mouseMove); off(display.scroller, "dragstart", dragStart); @@ -7401,15 +7408,15 @@ if (webkit) { display.scroller.draggable = true; } cm.state.draggingText = dragEnd; 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, "mousemove", mouseMove); on(display.scroller, "dragstart", dragStart); on(display.scroller, "drop", dragEnd); - delayBlurEvent(cm); + cm.state.delayingBlurEvent = true; setTimeout(function () { return display.input.focus(); }, 20); + // IE's approach to draggable + if (display.scroller.dragDrop) { display.scroller.dragDrop(); } } function rangeForUnit(cm, pos, unit) { @@ -7422,6 +7429,7 @@ // Normal selection, as opposed to text dragging. function leftButtonSelect(cm, event, start, behavior) { + if (ie) { delayBlurEvent(cm); } var display = cm.display, doc = cm.doc; e_preventDefault(event); @@ -9782,7 +9790,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.58.2"; + CodeMirror.version = "5.58.3"; return CodeMirror; diff --git a/js/vendor/codemirror/mode/xml/xml.js b/js/vendor/codemirror/mode/xml/xml.js index 73c6e0e0dd..46806ac425 100644 --- a/js/vendor/codemirror/mode/xml/xml.js +++ b/js/vendor/codemirror/mode/xml/xml.js @@ -189,7 +189,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { function Context(state, tagName, startOfLine) { this.prev = state.context; - this.tagName = tagName; + this.tagName = tagName || ""; this.indent = state.indented; this.startOfLine = startOfLine; if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) @@ -399,7 +399,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { xmlCurrentContext: function(state) { var context = [] for (var cx = state.context; cx; cx = cx.prev) - if (cx.tagName) context.push(cx.tagName) + context.push(cx.tagName) return context.reverse() } }; diff --git a/js/vendor/jquery/jquery-migrate.js b/js/vendor/jquery/jquery-migrate.js index 2e4bde47fb..7917349ea8 100644 --- a/js/vendor/jquery/jquery-migrate.js +++ b/js/vendor/jquery/jquery-migrate.js @@ -1,5 +1,5 @@ /*! - * jQuery Migrate - v3.3.1 - 2020-06-25T01:07Z + * jQuery Migrate - v3.3.2 - 2020-11-17T23:22Z * Copyright OpenJS Foundation and other contributors */ ( function( factory ) { @@ -24,7 +24,7 @@ } )( function( jQuery, window ) { "use strict"; -jQuery.migrateVersion = "3.3.1"; +jQuery.migrateVersion = "3.3.2"; // Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2 function compareVersions( v1, v2 ) { @@ -238,6 +238,10 @@ if ( jQueryVersionSince( "3.2.0" ) ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, "jQuery.nodeName is deprecated" ); + + migrateWarnFunc( jQuery, "isArray", Array.isArray, + "jQuery.isArray is deprecated; use Array.isArray" + ); } if ( jQueryVersionSince( "3.3.0" ) ) { @@ -289,16 +293,13 @@ if ( jQueryVersionSince( "3.3.0" ) ) { }, "jQuery.isWindow() is deprecated" ); - - migrateWarnFunc( jQuery, "isArray", Array.isArray, - "jQuery.isArray is deprecated; use Array.isArray" - ); } // Support jQuery slim which excludes the ajax module if ( jQuery.ajax ) { -var oldAjax = jQuery.ajax; +var oldAjax = jQuery.ajax, + rjsonp = /(=)\?(?=&|$)|\?\?/; jQuery.ajax = function( ) { var jQXHR = oldAjax.apply( this, arguments ); @@ -316,6 +317,28 @@ jQuery.ajax = function( ) { return jQXHR; }; +// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion +// behavior is gone in jQuery 4.0 and as it has security implications, we don't +// want to restore the legacy behavior. +if ( !jQueryVersionSince( "4.0.0" ) ) { + + // Register this prefilter before the jQuery one. Otherwise, a promoted + // request is transformed into one with the script dataType and we can't + // catch it anymore. + jQuery.ajaxPrefilter( "+json", function( s ) { + + // Warn if JSON-to-JSONP auto-promotion happens. + if ( s.jsonp !== false && ( rjsonp.test( s.url ) || + typeof s.data === "string" && + ( s.contentType || "" ) + .indexOf( "application/x-www-form-urlencoded" ) === 0 && + rjsonp.test( s.data ) + ) ) { + migrateWarn( "JSON-to-JSONP auto-promotion is deprecated" ); + } + } ); +} + } var oldRemoveAttr = jQuery.fn.removeAttr, @@ -475,6 +498,7 @@ jQuery.fn.css = function( name, value ) { jQuery.each( name, function( n, v ) { jQuery.fn.css.call( origThis, n, v ); } ); + return this; } if ( typeof value === "number" ) { camelName = camelCase( name ); diff --git a/package.json b/package.json index a86cf0aa9b..af677f6187 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,13 @@ "@babel/preset-env": "^7.12.1", "blueimp-md5": "^2.18.0", "bootstrap": "4.5.3", - "codemirror": "5.58.2", + "codemirror": "5.58.3", "jqplot": "^1.0.9", "jquery": "3.5.1", "jquery-debounce-throttle": "^1.0.6-rc.0", "jquery-fullscreen-plugin": "^1.1.5", "jquery-hashchange": "^2.0.0", - "jquery-migrate": "3.3.1", + "jquery-migrate": "3.3.2", "jquery-mousewheel": "3.1.13", "jquery-ui": "1.12.1", "jquery-ui-timepicker-addon": "1.6.3", diff --git a/yarn.lock b/yarn.lock index 49d79f5022..b4eca36001 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1573,10 +1573,10 @@ clone-regexp@^2.1.0: dependencies: is-regexp "^2.0.0" -codemirror@5.58.2: - version "5.58.2" - resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.58.2.tgz#ed54a1796de1498688bea1cdd4e9eeb187565d1b" - integrity sha512-K/hOh24cCwRutd1Mk3uLtjWzNISOkm4fvXiMO7LucCrqbh6aJDdtqUziim3MZUI6wOY0rvY1SlL1Ork01uMy6w== +codemirror@5.58.3: + version "5.58.3" + resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.58.3.tgz#3f0689854ecfbed5d4479a98b96148b2c3b79796" + integrity sha512-KBhB+juiyOOgn0AqtRmWyAT3yoElkuvWTI6hsHa9E6GQrl6bk/fdAYcvuqW1/upO9T9rtEtapWdw4XYcNiVDEA== collapse-white-space@^1.0.2: version "1.0.5" @@ -2721,10 +2721,10 @@ jquery-hashchange@^2.0.0: resolved "https://registry.yarnpkg.com/jquery-hashchange/-/jquery-hashchange-2.0.0.tgz#905b801803b6928fa8b3655381badf42dc49ba82" integrity sha512-9/RrnnUKw7qLy5e4X8nCusAlvXZPpUuNZv9BnpSfSfIY/RJLyhd1N1YRvP03H3RwEdx4TKTWZ59AnBgcrdfC3A== -jquery-migrate@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-3.3.1.tgz#0f8e2b7531228fda5d88be58dc0e7d5848e52fd1" - integrity sha512-QAXfshB6xqaANDX8OPExKnnooLtX0cSDCKfRnqhdv+3CVEVD9L1v3zNAhZum/4AukKlWUWUoxM6ywJJcLMXLSA== +jquery-migrate@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/jquery-migrate/-/jquery-migrate-3.3.2.tgz#7829ee24de3054d0d2f42dd093390d8a7b7af01a" + integrity sha512-L3gYhr7yEtLUSAeqXSicVa0vRD4aGwjw/bWY8YzrO2o/qDY1BaMyP3oB3bZf5Auy3Hu9ynliio0CTyDWCBPVDw== jquery-mousewheel@3.1.13: version "3.1.13"