Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror - npm Package Compare versions

Comparing version 5.53.2 to 5.54.0

12

addon/edit/matchbrackets.js

@@ -121,4 +121,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
cm.off("cursorActivity", doMatchBrackets);
function clear(cm) {
if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {

@@ -129,5 +128,14 @@ cm.state.matchBrackets.currentlyHighlighted();

}
if (old && old != CodeMirror.Init) {
cm.off("cursorActivity", doMatchBrackets);
cm.off("focus", doMatchBrackets)
cm.off("blur", clear)
clear(cm);
}
if (val) {
cm.state.matchBrackets = typeof val == "object" ? val : {};
cm.on("cursorActivity", doMatchBrackets);
cm.on("focus", doMatchBrackets)
cm.on("blur", clear)
}

@@ -134,0 +142,0 @@ });

13

addon/runmode/runmode-standalone.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
window.CodeMirror = {};
var root = typeof globalThis !== 'undefined' ? globalThis : window;
root.CodeMirror = {};

@@ -11,5 +12,7 @@ (function() {

function StringStream(string) {
function StringStream(strings, i) {
this.pos = this.start = 0;
this.string = string;
this.string = strings[i];
this.strings = strings
this.i = i
this.lineStart = 0;

@@ -70,3 +73,3 @@ }

},
lookAhead: function() { return null }
lookAhead: function(n) { return this.strings[this.i + n] }
};

@@ -155,3 +158,3 @@ CodeMirror.StringStream = StringStream;

if (i) callback("\n");
var stream = new CodeMirror.StringStream(lines[i]);
var stream = new CodeMirror.StringStream(lines, i);
if (!stream.string && mode.blankLine) mode.blankLine(state);

@@ -158,0 +161,0 @@ while (!stream.eol()) {

@@ -62,3 +62,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (i) callback("\n");
var stream = new CodeMirror.StringStream(lines[i]);
var stream = new CodeMirror.StringStream(lines[i], null, {
lookAhead: function(n) { return lines[i + n] },
baseToken: function() {}
});
if (!stream.string && mode.blankLine) mode.blankLine(state);

@@ -65,0 +68,0 @@ while (!stream.eol()) {

@@ -93,3 +93,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) {
var searchFor = hasBoundary ? new RegExp("\\b" + query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") + "\\b") : query;
var searchFor = hasBoundary ? new RegExp((/\w/.test(query.charAt(0)) ? "\\b" : "") +
query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") +
(/\w/.test(query.charAt(query.length - 1)) ? "\\b" : "")) : query;
state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, false,

@@ -96,0 +98,0 @@ {className: "CodeMirror-selection-highlight-scrollbar"});

@@ -18,6 +18,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

"try catch finally do else for if switch while import library export " +
"part of show hide is as extension on yield").split(" ");
"part of show hide is as extension on yield late required").split(" ");
var blockKeywords = "try catch finally do else for if switch while".split(" ");
var atoms = "true false null".split(" ");
var builtins = "void bool num int double dynamic var String".split(" ");
var builtins = "void bool num int double dynamic var String Null Never".split(" ");

@@ -24,0 +24,0 @@ function set(words) {

@@ -101,5 +101,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

return tokenQuasi(stream, state);
} else if (ch == "#") {
} else if (ch == "#" && stream.peek() == "!") {
stream.skipToEnd();
return ret("error", "error");
return ret("meta", "meta");
} else if (ch == "#" && stream.eatWhile(wordRE)) {
return ret("variable", "property")
} else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->")) {

@@ -117,2 +119,3 @@ stream.skipToEnd()

}
if (ch == "?" && stream.eat(".")) return ret(".")
return ret("operator", "operator", stream.current());

@@ -460,3 +463,3 @@ } else if (wordRE.test(ch)) {

if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
if (isTS && value == "<" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/, false))
return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);

@@ -763,7 +766,7 @@ if (value == "?") return cont(expression, expect(":"), expr);

cx.marked = "property";
return cont(isTS ? classfield : functiondef, classBody);
return cont(classfield, classBody);
}
if (type == "number" || type == "string") return cont(isTS ? classfield : functiondef, classBody);
if (type == "number" || type == "string") return cont(classfield, classBody);
if (type == "[")
return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
return cont(expression, maybetype, expect("]"), classfield, classBody)
if (value == "*") {

@@ -770,0 +773,0 @@ cx.marked = "keyword";

@@ -50,2 +50,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

modeCfg.fencedCodeBlockHighlighting = true;
if (modeCfg.fencedCodeBlockDefaultMode === undefined)
modeCfg.fencedCodeBlockDefaultMode = '';

@@ -240,3 +243,3 @@ if (modeCfg.xml === undefined)

// try switching mode
state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);

@@ -243,0 +246,0 @@ state.f = state.block = local;

@@ -147,3 +147,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

{name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
{name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
{name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
{name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},

@@ -150,0 +150,0 @@ {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},

@@ -101,7 +101,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

function tokenBaseInner(stream, state) {
function tokenBaseInner(stream, state, inFormat) {
if (stream.eatSpace()) return null;
// Handle Comments
if (stream.match(/^#.*/)) return "comment";
if (!inFormat && stream.match(/^#.*/)) return "comment";

@@ -181,3 +181,3 @@ // Handle Number Literals

stream.next();
return ERRORCLASS;
return inFormat ? null :ERRORCLASS;
}

@@ -194,3 +194,3 @@

return function(stream, state) {
var inner = tokenBaseInner(stream, state)
var inner = tokenBaseInner(stream, state, true)
if (inner == "punctuation") {

@@ -197,0 +197,0 @@ if (stream.current() == "{") {

@@ -303,6 +303,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

return null;
} else if (peekChar == "<") {
state.soyState.push('param-type-parameter');
return null;
} else if (match = stream.match(/^([\w]+|[?])/)) {
if (match[0] == "map" || match[0] == "list") {
state.soyState.push('param-type-map-list');
}
return "type";

@@ -326,4 +326,3 @@ }

case "param-type-map-list":
var peekChar = stream.peek();
case "param-type-parameter":
if (stream.match(/^[>]/)) {

@@ -330,0 +329,0 @@ state.soyState.pop();

@@ -134,3 +134,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

return state.tokenize(stream, state);
}
},
lineComment: "#"
};

@@ -137,0 +138,0 @@ });

{
"name": "codemirror",
"version": "5.53.2",
"version": "5.54.0",
"main": "lib/codemirror.js",

@@ -5,0 +5,0 @@ "style": "lib/codemirror.css",

@@ -77,3 +77,4 @@ import { sawCollapsedSpans } from "../line/saw_special_spans.js"

snapshot.activeElt.focus()
if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
let sel = window.getSelection(), range = document.createRange()

@@ -80,0 +81,0 @@ range.setEnd(snapshot.anchorNode, snapshot.anchorOffset)

@@ -109,2 +109,3 @@ import { signalLater } from "../util/operation_group.js"

let cm = this
if (e.target && e.target != cm.display.input.getField()) return
cm.curOp.focus = activeElt()

@@ -153,2 +154,3 @@ if (signalDOMEvent(cm, e)) return

let cm = this
if (e.target && e.target != cm.display.input.getField()) return
if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return

@@ -155,0 +157,0 @@ let keyCode = e.keyCode, charCode = e.charCode

@@ -69,2 +69,2 @@ // EDITOR CONSTRUCTOR

CodeMirror.version = "5.53.2"
CodeMirror.version = "5.54.0"

@@ -10,3 +10,3 @@ import { delayBlurEvent, ensureFocus } from "../display/focus.js"

import { extendRange, extendSelection, replaceOneSelection, setSelection } from "../model/selection_updates.js"
import { captureRightClick, chromeOS, ie, ie_version, mac, webkit } from "../util/browser.js"
import { captureRightClick, chromeOS, ie, ie_version, mac, webkit, safari } from "../util/browser.js"
import { getOrder, getBidiPartAt } from "../util/bidi.js"

@@ -162,4 +162,4 @@ import { activeElt } from "../util/dom.js"

// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
if (webkit || ie && ie_version == 9)
setTimeout(() => {display.wrapper.ownerDocument.body.focus(); display.input.focus()}, 20)
if ((webkit && !safari) || ie && ie_version == 9)
setTimeout(() => {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus()}, 20)
else

@@ -166,0 +166,0 @@ display.input.focus()

@@ -34,4 +34,12 @@ import { operation, runInOp } from "../display/operations.js"

function belongsToInput(e) {
for (let t = e.target; t; t = t.parentNode) {
if (t == div) return true
if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) break
}
return false
}
on(div, "paste", e => {
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) return
// IE doesn't fire input events, so we schedule a read for the pasted content in this way

@@ -61,3 +69,3 @@ if (ie_version <= 11) setTimeout(operation(cm, () => this.updateFromDOM()), 20)

function onCopyCut(e) {
if (signalDOMEvent(cm, e)) return
if (!belongsToInput(e) || signalDOMEvent(cm, e)) return
if (cm.somethingSelected()) {

@@ -64,0 +72,0 @@ setLastCopied({lineWise: false, text: cm.getSelections()})

@@ -201,3 +201,3 @@ import { countColumn } from "../util/misc.js"

output[prop] = lineClass[2]
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
output[prop] += " " + lineClass[2]

@@ -204,0 +204,0 @@ }

@@ -64,3 +64,3 @@ export function bind(f) {

// Number of pixels added to scroller and sizer to hide scrollbar
export let scrollerGap = 30
export let scrollerGap = 50

@@ -67,0 +67,0 @@ // Returned or thrown by various protocols to signal 'I'm not

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc