codemirror
Advanced tools
Comparing version 5.52.2 to 5.53.0
@@ -85,3 +85,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); | ||
if (options.closeOnBlur !== false) CodeMirror.on(dialog, "focusout", function (evt) { | ||
if (evt.relatedTarget !== null) close(); | ||
}); | ||
} else if (button = dialog.getElementsByTagName("button")[0]) { | ||
@@ -88,0 +90,0 @@ CodeMirror.on(button, "click", function() { |
@@ -147,3 +147,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} else { | ||
// If not, just look in the global object and any local scope | ||
// If not, just look in the global object, any local scope, and optional additional-context | ||
// (reading into JS mode internals to get at the local and global variables) | ||
@@ -154,2 +154,5 @@ for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); | ||
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name); | ||
if (options && options.additionalContext != null) | ||
for (var key in options.additionalContext) | ||
maybeAdd(key); | ||
if (!options || options.useGlobalScope !== false) | ||
@@ -156,0 +159,0 @@ gatherCompletions(global); |
@@ -89,6 +89,11 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var completion = data.list[i]; | ||
if (completion.hint) completion.hint(this.cm, data, completion); | ||
else this.cm.replaceRange(getText(completion), completion.from || data.from, | ||
completion.to || data.to, "complete"); | ||
CodeMirror.signal(data, "pick", completion); | ||
this.cm.operation(function(){ | ||
if (completion.hint) | ||
completion.hint(this.cm, data, completion); | ||
else | ||
this.cm.replaceRange(getText(completion), completion.from || data.from, | ||
completion.to || data.to, "complete"); | ||
CodeMirror.signal(data, "pick", completion); | ||
this.cm.scrollIntoView(); | ||
}) | ||
this.close(); | ||
@@ -103,5 +108,10 @@ }, | ||
var identStart = this.startPos; | ||
if(this.data) { | ||
identStart = this.data.from; | ||
} | ||
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line); | ||
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || | ||
pos.ch < this.startPos.ch || this.cm.somethingSelected() || | ||
pos.ch < identStart.ch || this.cm.somethingSelected() || | ||
(!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) { | ||
@@ -375,6 +385,7 @@ this.close(); | ||
var node = this.hints.childNodes[this.selectedHint] | ||
var firstNode = this.hints.firstChild; | ||
if (node.offsetTop < this.hints.scrollTop) | ||
this.hints.scrollTop = node.offsetTop - 3; | ||
this.hints.scrollTop = node.offsetTop - firstNode.offsetTop; | ||
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) | ||
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3; | ||
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + firstNode.offsetTop; | ||
}, | ||
@@ -381,0 +392,0 @@ |
@@ -446,9 +446,13 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var cm = [dv.edit, dv.orig], scroll = []; | ||
var cm = [dv.edit, dv.orig], scroll = [], offset = [] | ||
if (other) cm.push(other.orig); | ||
for (var i = 0; i < cm.length; i++) | ||
for (var i = 0; i < cm.length; i++) { | ||
scroll.push(cm[i].getScrollInfo().top); | ||
offset.push(-cm[i].getScrollerElement().getBoundingClientRect().top) | ||
} | ||
if (offset[0] != offset[1] || cm.length == 3 && offset[1] != offset[2]) | ||
alignLines(cm, offset, [0, 0, 0], aligners) | ||
for (var ln = 0; ln < linesToAlign.length; ln++) | ||
alignLines(cm, linesToAlign[ln], aligners); | ||
alignLines(cm, offset, linesToAlign[ln], aligners); | ||
@@ -459,6 +463,6 @@ for (var i = 0; i < cm.length; i++) | ||
function alignLines(cm, lines, aligners) { | ||
var maxOffset = 0, offset = []; | ||
function alignLines(cm, cmOffset, lines, aligners) { | ||
var maxOffset = -1e8, offset = []; | ||
for (var i = 0; i < cm.length; i++) if (lines[i] != null) { | ||
var off = cm[i].heightAtLine(lines[i], "local"); | ||
var off = cm[i].heightAtLine(lines[i], "local") - cmOffset[i]; | ||
offset[i] = off; | ||
@@ -465,0 +469,0 @@ maxOffset = Math.max(maxOffset, off); |
@@ -107,4 +107,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var mode = CodeMirror.getMode({ indentUnit: 2 }, modespec); | ||
var ie = /MSIE \d/.test(navigator.userAgent); | ||
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); | ||
if (callback.nodeType == 1) { | ||
if (callback.appendChild) { | ||
var tabSize = (options && options.tabSize) || 4; | ||
@@ -115,3 +117,5 @@ var node = callback, col = 0; | ||
if (text == "\n") { | ||
node.appendChild(document.createElement("br")); | ||
// Emitting LF or CRLF on IE8 or earlier results in an incorrect display. | ||
// Emitting a carriage return makes everything ok. | ||
node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text)); | ||
col = 0; | ||
@@ -118,0 +122,0 @@ return; |
@@ -243,3 +243,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Implements weird auto-growing behavior on null-matches for | ||
// backwards-compatiblity with the vim code (unfortunately) | ||
// backwards-compatibility with the vim code (unfortunately) | ||
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) { | ||
@@ -246,0 +246,0 @@ if (reverse) { |
@@ -407,3 +407,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"Ctrl-Q Tab": repeated("insertTab"), | ||
"Ctrl-U": addPrefixMap | ||
"Ctrl-U": addPrefixMap, | ||
"fallthrough": "default" | ||
}); | ||
@@ -410,0 +411,0 @@ |
@@ -631,2 +631,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"Cmd-K Cmd-Backspace": "delLineLeft", | ||
"Cmd-K Cmd-1": "foldAll", | ||
"Cmd-K Cmd-0": "unfoldAll", | ||
@@ -693,2 +694,3 @@ "Cmd-K Cmd-J": "unfoldAll", | ||
"Ctrl-K Ctrl-Backspace": "delLineLeft", | ||
"Ctrl-K Ctrl-1": "foldAll", | ||
"Ctrl-K Ctrl-0": "unfoldAll", | ||
@@ -695,0 +697,0 @@ "Ctrl-K Ctrl-J": "unfoldAll", |
@@ -130,3 +130,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (inArray(state) && ch === ']') { | ||
while (currentScope(state) !== "[") { state.scopes.pop(); } | ||
while (state.scopes.length && currentScope(state) !== "[") { state.scopes.pop(); } | ||
state.scopes.pop(); | ||
@@ -138,3 +138,3 @@ state.nestedArrays--; | ||
if (inGenerator(state) && ch === ')') { | ||
while (currentScope(state) !== "(") { state.scopes.pop(); } | ||
while (state.scopes.length && currentScope(state) !== "(") { state.scopes.pop(); } | ||
state.scopes.pop(); | ||
@@ -141,0 +141,0 @@ state.nestedGenerators--; |
@@ -41,3 +41,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var punctuation = /[\[\]{},;`\.]|@[({]/; | ||
var punctuation = /[\[\]{},;`\\\.]|@[({]/; | ||
var wordOperators = buildRegexp([ | ||
@@ -44,0 +44,0 @@ 'f', |
@@ -45,3 +45,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/; | ||
// (Backwards-compatiblity with old, cumbersome config system) | ||
// (Backwards-compatibility with old, cumbersome config system) | ||
var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters, | ||
@@ -48,0 +48,0 @@ parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/] |
@@ -28,4 +28,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
token: "number"}, | ||
{regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]}, | ||
{regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"}, | ||
{regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type|union)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]}, | ||
{regex: /(?:abstract|alignof|as|async|await|box|break|continue|const|crate|do|dyn|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"}, | ||
{regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"}, | ||
@@ -32,0 +32,0 @@ {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"}, |
{ | ||
"name": "codemirror", | ||
"version": "5.52.2", | ||
"version": "5.53.0", | ||
"main": "lib/codemirror.js", | ||
@@ -5,0 +5,0 @@ "style": "lib/codemirror.css", |
@@ -69,2 +69,2 @@ // EDITOR CONSTRUCTOR | ||
CodeMirror.version = "5.52.2" | ||
CodeMirror.version = "5.53.0" |
@@ -418,3 +418,3 @@ import { deleteNearSelection } from "./deleteNearSelection.js" | ||
updateGutterSpace(this.display) | ||
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) | ||
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping) | ||
estimateLineHeights(this) | ||
@@ -421,0 +421,0 @@ signal(this, "refresh", this) |
@@ -135,2 +135,8 @@ import { onBlur } from "../display/focus.js" | ||
}) | ||
option("screenReaderLabel", null, (cm, val) => { | ||
val = (val === '') ? null : val | ||
cm.display.input.screenReaderLabelChanged(val) | ||
}) | ||
option("disableInput", false, (cm, val) => {if (!val) cm.display.input.reset()}, true) | ||
@@ -137,0 +143,0 @@ option("dragDrop", true, dragDropChanged) |
@@ -102,2 +102,11 @@ import { operation, runInOp } from "../display/operations.js" | ||
screenReaderLabelChanged(label) { | ||
// Label for screenreaders, accessibility | ||
if(label) { | ||
this.div.setAttribute('aria-label', label) | ||
} else { | ||
this.div.removeAttribute('aria-label') | ||
} | ||
} | ||
prepareSelection() { | ||
@@ -104,0 +113,0 @@ let result = prepareSelection(this.cm, false) |
@@ -135,2 +135,2 @@ import { runInOp } from "../display/operations.js" | ||
return div | ||
} | ||
} |
@@ -121,2 +121,11 @@ import { operation, runInOp } from "../display/operations.js" | ||
screenReaderLabelChanged(label) { | ||
// Label for screenreaders, accessibility | ||
if(label) { | ||
this.textarea.setAttribute('aria-label', label) | ||
} else { | ||
this.textarea.removeAttribute('aria-label') | ||
} | ||
} | ||
prepareSelection() { | ||
@@ -123,0 +132,0 @@ // Redraw the selection and/or cursor |
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2848470
332
64358