codemirror
Advanced tools
Comparing version 4.5.0 to 4.6.0
@@ -132,4 +132,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var dialog = dialogDiv(this, template, options && options.bottom); | ||
var duration = options && (options.duration === undefined ? 5000 : options.duration); | ||
var closed = false, doneTimer; | ||
var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; | ||
@@ -147,5 +147,8 @@ function close() { | ||
}); | ||
if (duration) | ||
doneTimer = setTimeout(close, options.duration); | ||
doneTimer = setTimeout(close, duration); | ||
return close; | ||
}); | ||
}); |
@@ -105,7 +105,21 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (tok.type == "string" || tok.string.charAt(0) != "<" || | ||
tok.start != pos.ch - 1 || inner.mode.name != "xml" || | ||
!state.context || !state.context.tagName || | ||
closingTagExists(cm, state.context.tagName, pos, state)) | ||
tok.start != pos.ch - 1) | ||
return CodeMirror.Pass; | ||
replacements[i] = "/" + state.context.tagName + ">"; | ||
// Kludge to get around the fact that we are not in XML mode | ||
// when completing in JS/CSS snippet in htmlmixed mode. Does not | ||
// work for other XML embedded languages (there is no general | ||
// way to go from a mixed mode to its current XML state). | ||
if (inner.mode.name != "xml") { | ||
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript") | ||
replacements[i] = "/script>"; | ||
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") | ||
replacements[i] = "/style>"; | ||
else | ||
return CodeMirror.Pass; | ||
} else { | ||
if (!state.context || !state.context.tagName || | ||
closingTagExists(cm, state.context.tagName, pos, state)) | ||
return CodeMirror.Pass; | ||
replacements[i] = "/" + state.context.tagName + ">"; | ||
} | ||
} | ||
@@ -112,0 +126,0 @@ cm.replaceSelections(replacements); |
@@ -6,5 +6,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (typeof exports == "object" && typeof module == "object") // CommonJS | ||
mod(require("../../lib/codemirror")); | ||
mod(require("../../lib/codemirror", "./xml-hint")); | ||
else if (typeof define == "function" && define.amd) // AMD | ||
define(["../../lib/codemirror"], mod); | ||
define(["../../lib/codemirror", "./xml-hint"], mod); | ||
else // Plain browser env | ||
@@ -11,0 +11,0 @@ mod(CodeMirror); |
// CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Distributed under an MIT license: http://codemirror.net/LICENSE | ||
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL | ||
(function(mod) { | ||
if (typeof exports == "object" && typeof module == "object") // CommonJS | ||
mod(require("../../lib/codemirror")); | ||
mod(require("../../lib/codemirror"), require("diff_match_patch")); | ||
else if (typeof define == "function" && define.amd) // AMD | ||
define(["../../lib/codemirror"], mod); | ||
define(["../../lib/codemirror", "diff_match_patch"], mod); | ||
else // Plain browser env | ||
mod(CodeMirror); | ||
})(function(CodeMirror) { | ||
mod(CodeMirror, diff_match_patch); | ||
})(function(CodeMirror, diff_match_patch) { | ||
"use strict"; | ||
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL | ||
var Pos = CodeMirror.Pos; | ||
@@ -16,0 +16,0 @@ var svgNS = "http://www.w3.org/2000/svg"; |
@@ -11,8 +11,11 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// The option can be set to true to simply enable it, or to a | ||
// {minChars, style, showToken} object to explicitly configure it. | ||
// minChars is the minimum amount of characters that should be | ||
// {minChars, style, wordsOnly, showToken, delay} object to explicitly | ||
// configure it. minChars is the minimum amount of characters that should be | ||
// selected for the behavior to occur, and style is the token style to | ||
// apply to the matches. This will be prefixed by "cm-" to create an | ||
// actual CSS class name. showToken, when enabled, will cause the | ||
// current token to be highlighted when nothing is selected. | ||
// actual CSS class name. If wordsOnly is enabled, the matches will be | ||
// highlighted only if the selected text is a word. showToken, when enabled, | ||
// will cause the current token to be highlighted when nothing is selected. | ||
// delay is used to specify how much time to wait, in milliseconds, before | ||
// highlighting the matches. | ||
@@ -32,2 +35,3 @@ (function(mod) { | ||
var DEFAULT_DELAY = 100; | ||
var DEFAULT_WORDS_ONLY = false; | ||
@@ -40,2 +44,3 @@ function State(options) { | ||
this.delay = options.delay; | ||
this.wordsOnly = options.wordsOnly; | ||
} | ||
@@ -45,2 +50,3 @@ if (this.style == null) this.style = DEFAULT_TOKEN_STYLE; | ||
if (this.delay == null) this.delay = DEFAULT_DELAY; | ||
if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY; | ||
this.overlay = this.timeout = null; | ||
@@ -88,2 +94,3 @@ } | ||
if (from.line != to.line) return; | ||
if (state.wordsOnly && !isWord(cm, from, to)) return; | ||
var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, ""); | ||
@@ -95,2 +102,19 @@ if (selection.length >= state.minChars) | ||
function isWord(cm, from, to) { | ||
var str = cm.getRange(from, to); | ||
if (str.match(/^\w+$/) !== null) { | ||
if (from.ch > 0) { | ||
var pos = {line: from.line, ch: from.ch - 1}; | ||
var chr = cm.getRange(pos, from); | ||
if (chr.match(/\W/) === null) return false; | ||
} | ||
if (to.ch < cm.getLine(from.line).length) { | ||
var pos = {line: to.line, ch: to.ch + 1}; | ||
var chr = cm.getRange(to, pos); | ||
if (chr.match(/\W/) === null) return false; | ||
} | ||
return true; | ||
} else return false; | ||
} | ||
function boundariesAround(stream, re) { | ||
@@ -97,0 +121,0 @@ return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) && |
{ | ||
"name": "codemirror", | ||
"version":"4.5.0", | ||
"version":"4.6.0", | ||
"main": ["lib/codemirror.js", "lib/codemirror.css"], | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -33,2 +33,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var tagName = state.htmlState.tagName; | ||
if (tagName) tagName = tagName.toLowerCase(); | ||
var style = htmlMode.token(stream, state.htmlState); | ||
@@ -35,0 +36,0 @@ if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") { |
@@ -394,3 +394,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var expr = noComma == false ? expression : expressionNoComma; | ||
if (value == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); | ||
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); | ||
if (type == "operator") { | ||
@@ -421,9 +421,7 @@ if (/\+\+|--/.test(value)) return cont(me); | ||
findFatArrow(cx.stream, cx.state); | ||
if (type == "{") return pass(statement); | ||
return pass(expression); | ||
return pass(type == "{" ? statement : expression); | ||
} | ||
function arrowBodyNoComma(type) { | ||
findFatArrow(cx.stream, cx.state); | ||
if (type == "{") return pass(statement); | ||
return pass(expressionNoComma); | ||
return pass(type == "{" ? statement : expressionNoComma); | ||
} | ||
@@ -430,0 +428,0 @@ function maybelabel(type) { |
@@ -363,11 +363,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (state.escape) { | ||
state.escape = false; | ||
return getType(state); | ||
} | ||
if (ch === '\\') { | ||
if (modeCfg.highlightFormatting) state.formatting = "escape"; | ||
state.escape = true; | ||
return getType(state); | ||
stream.next(); | ||
if (modeCfg.highlightFormatting) { | ||
var type = getType(state); | ||
return type ? type + " formatting-escape" : "formatting-escape"; | ||
} | ||
} | ||
@@ -654,3 +651,2 @@ | ||
escape: false, | ||
formatting: false, | ||
@@ -688,3 +684,2 @@ linkText: false, | ||
text: s.text, | ||
escape: false, | ||
formatting: false, | ||
@@ -724,5 +719,2 @@ linkTitle: s.linkTitle, | ||
// Reset state.escape | ||
state.escape = false; | ||
// Reset state.taskList | ||
@@ -729,0 +721,0 @@ state.taskList = false; |
@@ -57,3 +57,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
FT("formatting_escape", | ||
"[formatting&formatting-escape \\]*"); | ||
"[formatting-escape \\*]"); | ||
@@ -60,0 +60,0 @@ MT("plainText", |
@@ -65,2 +65,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
{name: "mIRC", mime: "text/mirc", mode: "mirc"}, | ||
{name: "Modelica", mime: "text/x-modelica", mode: "modelica"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"}, | ||
@@ -67,0 +68,0 @@ {name: "NTriples", mime: "text/n-triples", mode: "ntriples"}, |
@@ -18,3 +18,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var wordOperators = wordRegexp(["and", "or", "not", "is", "in"]); | ||
var wordOperators = wordRegexp(["and", "or", "not", "is"]); | ||
var commonKeywords = ["as", "assert", "break", "class", "continue", | ||
@@ -24,3 +24,3 @@ "def", "del", "elif", "else", "except", "finally", | ||
"lambda", "pass", "raise", "return", | ||
"try", "while", "with", "yield"]; | ||
"try", "while", "with", "yield", "in"]; | ||
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", | ||
@@ -27,0 +27,0 @@ "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", |
@@ -83,15 +83,2 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
function AssertException(message) { | ||
this.message = message; | ||
} | ||
AssertException.prototype.toString = function () { | ||
return 'AssertException: ' + this.message; | ||
}; | ||
function assert(expression, message) { | ||
if (!expression) throw new AssertException(message); | ||
return expression; | ||
} | ||
/////////////////////////////////////////////////////////////////////////// | ||
@@ -189,3 +176,3 @@ /////////////////////////////////////////////////////////////////////////// | ||
change(state, to_normal, context(rx_role_pre, 1)); | ||
assert(stream.match(/^:/)); | ||
stream.match(/^:/); | ||
token = 'meta'; | ||
@@ -195,3 +182,3 @@ break; | ||
change(state, to_normal, context(rx_role_pre, 2)); | ||
assert(stream.match(rx_NAME)); | ||
stream.match(rx_NAME); | ||
token = 'keyword'; | ||
@@ -205,3 +192,3 @@ | ||
change(state, to_normal, context(rx_role_pre, 3)); | ||
assert(stream.match(/^:`/)); | ||
stream.match(/^:`/); | ||
token = 'meta'; | ||
@@ -228,3 +215,3 @@ break; | ||
change(state, to_normal, context(rx_role_pre, 4)); | ||
assert(stream.match(rx_TEXT2)); | ||
stream.match(rx_TEXT2); | ||
token = 'string'; | ||
@@ -234,3 +221,3 @@ break; | ||
change(state, to_normal, context(rx_role_pre, 5)); | ||
assert(stream.match(/^`/)); | ||
stream.match(/^`/); | ||
token = 'meta'; | ||
@@ -240,7 +227,6 @@ break; | ||
change(state, to_normal, context(rx_role_pre, 6)); | ||
assert(stream.match(rx_TAIL)); | ||
stream.match(rx_TAIL); | ||
break; | ||
default: | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -253,3 +239,3 @@ } else if (phase(state) == rx_role_suf || | ||
change(state, to_normal, context(rx_role_suf, 1)); | ||
assert(stream.match(/^`/)); | ||
stream.match(/^`/); | ||
token = 'meta'; | ||
@@ -259,3 +245,3 @@ break; | ||
change(state, to_normal, context(rx_role_suf, 2)); | ||
assert(stream.match(rx_TEXT2)); | ||
stream.match(rx_TEXT2); | ||
token = 'string'; | ||
@@ -265,3 +251,3 @@ break; | ||
change(state, to_normal, context(rx_role_suf, 3)); | ||
assert(stream.match(/^`:/)); | ||
stream.match(/^`:/); | ||
token = 'meta'; | ||
@@ -271,3 +257,3 @@ break; | ||
change(state, to_normal, context(rx_role_suf, 4)); | ||
assert(stream.match(rx_NAME)); | ||
stream.match(rx_NAME); | ||
token = 'keyword'; | ||
@@ -277,3 +263,3 @@ break; | ||
change(state, to_normal, context(rx_role_suf, 5)); | ||
assert(stream.match(/^:/)); | ||
stream.match(/^:/); | ||
token = 'meta'; | ||
@@ -283,7 +269,6 @@ break; | ||
change(state, to_normal, context(rx_role_suf, 6)); | ||
assert(stream.match(rx_TAIL)); | ||
stream.match(rx_TAIL); | ||
break; | ||
default: | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -295,3 +280,3 @@ } else if (phase(state) == rx_role || stream.match(rx_role, false)) { | ||
change(state, to_normal, context(rx_role, 1)); | ||
assert(stream.match(/^:/)); | ||
stream.match(/^:/); | ||
token = 'meta'; | ||
@@ -301,3 +286,3 @@ break; | ||
change(state, to_normal, context(rx_role, 2)); | ||
assert(stream.match(rx_NAME)); | ||
stream.match(rx_NAME); | ||
token = 'keyword'; | ||
@@ -307,3 +292,3 @@ break; | ||
change(state, to_normal, context(rx_role, 3)); | ||
assert(stream.match(/^:/)); | ||
stream.match(/^:/); | ||
token = 'meta'; | ||
@@ -313,7 +298,6 @@ break; | ||
change(state, to_normal, context(rx_role, 4)); | ||
assert(stream.match(rx_TAIL)); | ||
stream.match(rx_TAIL); | ||
break; | ||
default: | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -326,3 +310,3 @@ } else if (phase(state) == rx_substitution_ref || | ||
change(state, to_normal, context(rx_substitution_ref, 1)); | ||
assert(stream.match(rx_substitution_text)); | ||
stream.match(rx_substitution_text); | ||
token = 'variable-2'; | ||
@@ -336,3 +320,2 @@ break; | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -363,3 +346,3 @@ } else if (stream.match(rx_footnote_ref)) { | ||
change(state, to_normal, context(rx_link_ref2, 2)); | ||
assert(stream.match(/^`/)); | ||
stream.match(/^`/); | ||
token = 'link'; | ||
@@ -369,7 +352,7 @@ break; | ||
change(state, to_normal, context(rx_link_ref2, 3)); | ||
assert(stream.match(rx_TEXT2)); | ||
stream.match(rx_TEXT2); | ||
break; | ||
case 3: | ||
change(state, to_normal, context(rx_link_ref2, 4)); | ||
assert(stream.match(/^`_/)); | ||
stream.match(/^`_/); | ||
token = 'link'; | ||
@@ -379,3 +362,2 @@ break; | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -405,3 +387,3 @@ } else if (stream.match(rx_verbatim)) { | ||
change(state, to_explicit, context(rx_substitution, 1)); | ||
assert(stream.match(rx_substitution_text)); | ||
stream.match(rx_substitution_text); | ||
token = 'variable-2'; | ||
@@ -411,7 +393,7 @@ break; | ||
change(state, to_explicit, context(rx_substitution, 2)); | ||
assert(stream.match(rx_substitution_sepa)); | ||
stream.match(rx_substitution_sepa); | ||
break; | ||
case 2: | ||
change(state, to_explicit, context(rx_substitution, 3)); | ||
assert(stream.match(rx_substitution_name)); | ||
stream.match(rx_substitution_name); | ||
token = 'keyword'; | ||
@@ -421,3 +403,3 @@ break; | ||
change(state, to_explicit, context(rx_substitution, 4)); | ||
assert(stream.match(rx_substitution_tail)); | ||
stream.match(rx_substitution_tail); | ||
token = 'meta'; | ||
@@ -427,3 +409,2 @@ break; | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -436,3 +417,3 @@ } else if (phase(state) == rx_directive || | ||
change(state, to_explicit, context(rx_directive, 1)); | ||
assert(stream.match(rx_directive_name)); | ||
stream.match(rx_directive_name); | ||
token = 'keyword'; | ||
@@ -447,3 +428,3 @@ | ||
change(state, to_explicit, context(rx_directive, 2)); | ||
assert(stream.match(rx_directive_tail)); | ||
stream.match(rx_directive_tail); | ||
token = 'meta'; | ||
@@ -467,3 +448,2 @@ | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -475,4 +455,4 @@ } else if (phase(state) == rx_link || stream.match(rx_link, false)) { | ||
change(state, to_explicit, context(rx_link, 1)); | ||
assert(stream.match(rx_link_head)); | ||
assert(stream.match(rx_link_name)); | ||
stream.match(rx_link_head); | ||
stream.match(rx_link_name); | ||
token = 'link'; | ||
@@ -482,3 +462,3 @@ break; | ||
change(state, to_explicit, context(rx_link, 2)); | ||
assert(stream.match(rx_link_tail)); | ||
stream.match(rx_link_tail); | ||
token = 'meta'; | ||
@@ -488,3 +468,2 @@ break; | ||
change(state, to_normal); | ||
assert(stream.current() == ''); | ||
} | ||
@@ -491,0 +470,0 @@ } else if (stream.match(rx_footnote)) { |
@@ -306,2 +306,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
scopes: [{offset: 0, type: "sass"}], | ||
indentCount: 0, | ||
definedVars: [], | ||
@@ -308,0 +309,0 @@ definedMixins: [] |
@@ -131,3 +131,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
return tokenize(stream, state); | ||
} | ||
}, | ||
lineComment: '#' | ||
}; | ||
@@ -134,0 +135,0 @@ }); |
@@ -56,3 +56,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} else { | ||
if (stream.eatWhile(/[^ .{}\[\]()]/)) | ||
if (stream.eatWhile(/[^\s.{}\[\]()]/)) | ||
token.name = 'string-2'; | ||
@@ -65,3 +65,3 @@ else | ||
if (stream.next() === '<') { | ||
stream.eatWhile(/[^ >]/); | ||
stream.eatWhile(/[^\s>]/); | ||
stream.next(); | ||
@@ -68,0 +68,0 @@ } |
@@ -24,3 +24,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, | ||
'track': true, 'wbr': true}, | ||
'track': true, 'wbr': true, 'menuitem': true}, | ||
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, | ||
@@ -27,0 +27,0 @@ 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, |
{ | ||
"name": "codemirror", | ||
"version":"4.5.0", | ||
"version":"4.6.0", | ||
"main": "lib/codemirror.js", | ||
@@ -5,0 +5,0 @@ "description": "In-browser code editing made bearable", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
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
2898146
368
50923