diff --git a/plugins/codemirror/addon/hint/show-hint.js b/plugins/codemirror/addon/hint/show-hint.js index a9f2ded18..bfe7d3a35 100644 --- a/plugins/codemirror/addon/hint/show-hint.js +++ b/plugins/codemirror/addon/hint/show-hint.js @@ -360,7 +360,7 @@ close: function() { if (this.completion.widget != this) return; this.completion.widget = null; - this.hints.parentNode.removeChild(this.hints); + if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints); this.completion.cm.removeKeyMap(this.keyMap); var cm = this.completion.cm; diff --git a/plugins/codemirror/addon/mode/multiplex.js b/plugins/codemirror/addon/mode/multiplex.js index 93fd9a5a4..6140bc4f9 100644 --- a/plugins/codemirror/addon/mode/multiplex.js +++ b/plugins/codemirror/addon/mode/multiplex.js @@ -12,7 +12,7 @@ "use strict"; CodeMirror.multiplexingMode = function(outer /*, others */) { - // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects + // Others should be {open, close, mode [, delimStyle] [, innerStyle] [, parseDelimiters]} objects var others = Array.prototype.slice.call(arguments, 1); function indexOf(string, pattern, from, returnEnd) { @@ -29,7 +29,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { return { outer: CodeMirror.startState(outer), innerActive: null, - inner: null + inner: null, + startingInner: false }; }, @@ -37,7 +38,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { return { outer: CodeMirror.copyState(outer, state.outer), innerActive: state.innerActive, - inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) + inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner), + startingInner: state.startingInner }; }, @@ -49,6 +51,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { var found = indexOf(oldContent, other.open, stream.pos); if (found == stream.pos) { if (!other.parseDelimiters) stream.match(other.open); + state.startingInner = !!other.parseDelimiters state.innerActive = other; // Get the outer indent, making sure to handle CodeMirror.Pass @@ -74,7 +77,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { state.innerActive = state.inner = null; return this.token(stream, state); } - var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; + var found = curInner.close && !state.startingInner ? + indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; if (found == stream.pos && !curInner.parseDelimiters) { stream.match(curInner.close); state.innerActive = state.inner = null; @@ -83,6 +87,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { if (found > -1) stream.string = oldContent.slice(0, found); var innerToken = curInner.mode.token(stream, state.inner); if (found > -1) stream.string = oldContent; + else if (stream.pos > stream.start) state.startingInner = false if (found == stream.pos && curInner.parseDelimiters) state.innerActive = state.inner = null; diff --git a/plugins/codemirror/addon/mode/multiplex_test.js b/plugins/codemirror/addon/mode/multiplex_test.js index c51cad45d..850398867 100644 --- a/plugins/codemirror/addon/mode/multiplex_test.js +++ b/plugins/codemirror/addon/mode/multiplex_test.js @@ -30,4 +30,20 @@ MT( "stexInsideMarkdown", "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]"); + + CodeMirror.defineMode("identical_delim_multiplex", function() { + return CodeMirror.multiplexingMode(CodeMirror.getMode({indentUnit: 2}, "javascript"), { + open: "#", + close: "#", + mode: CodeMirror.getMode({}, "markdown"), + parseDelimiters: true, + innerStyle: "q" + }); + }); + + var mode2 = CodeMirror.getMode({}, "identical_delim_multiplex"); + + test.mode("identical_delimiters_with_parseDelimiters", mode2, [ + "[keyword let] [def x] [operator =] [q #foo][q&em *bar*][q #];" + ], "multiplexing") })(); diff --git a/plugins/codemirror/addon/mode/simple.js b/plugins/codemirror/addon/mode/simple.js index 655f99147..a1c626417 100644 --- a/plugins/codemirror/addon/mode/simple.js +++ b/plugins/codemirror/addon/mode/simple.js @@ -137,10 +137,9 @@ var token = rule.token if (token && token.apply) token = token(matches) if (matches.length > 2 && rule.token && typeof rule.token != "string") { - state.pending = []; for (var j = 2; j < matches.length; j++) if (matches[j]) - state.pending.push({text: matches[j], token: rule.token[j - 1]}); + (state.pending || (state.pending = [])).push({text: matches[j], token: rule.token[j - 1]}); stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0)); return token[0]; } else if (token && token.join) { diff --git a/plugins/codemirror/codemirror.js b/plugins/codemirror/codemirror.js index e4bc4a0e6..055963b04 100644 --- a/plugins/codemirror/codemirror.js +++ b/plugins/codemirror/codemirror.js @@ -6181,7 +6181,7 @@ var out = []; for (var i = 0; i < ranges.length; i++) { out[i] = new Range(clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head)); } + clipPos(this, ranges[i].head || ranges[i].anchor)); } if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } setSelection(this, normalizeSelection(this.cm, out, primary), options); }), @@ -8766,6 +8766,7 @@ var input = this, cm = input.cm; var div = input.div = display.lineDiv; + div.contentEditable = true; disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize); function belongsToInput(e) { @@ -9793,7 +9794,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.59.4"; + CodeMirror.version = "5.60.0"; return CodeMirror; diff --git a/plugins/codemirror/keymap/sublime.js b/plugins/codemirror/keymap/sublime.js index 7edf172eb..0c9a63e01 100644 --- a/plugins/codemirror/keymap/sublime.js +++ b/plugins/codemirror/keymap/sublime.js @@ -339,7 +339,7 @@ }; - function sortLines(cm, caseSensitive) { + function sortLines(cm, caseSensitive, direction) { if (cm.isReadOnly()) return CodeMirror.Pass var ranges = cm.listSelections(), toSort = [], selected; for (var i = 0; i < ranges.length; i++) { @@ -361,12 +361,12 @@ var start = Pos(from, 0), end = Pos(to); var lines = cm.getRange(start, end, false); if (caseSensitive) - lines.sort(); + lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; }); else lines.sort(function(a, b) { var au = a.toUpperCase(), bu = b.toUpperCase(); if (au != bu) { a = au; b = bu; } - return a < b ? -1 : a == b ? 0 : 1; + return a < b ? -direction : a == b ? 0 : direction; }); cm.replaceRange(lines, start, end); if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)}); @@ -375,8 +375,10 @@ }); } - cmds.sortLines = function(cm) { sortLines(cm, true); }; - cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); }; + cmds.sortLines = function(cm) { sortLines(cm, true, 1); }; + cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); }; + cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); }; + cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); }; cmds.nextBookmark = function(cm) { var marks = cm.state.sublimeBookmarks; @@ -609,7 +611,9 @@ "Cmd-J": "joinLines", "Shift-Cmd-D": "duplicateLine", "F5": "sortLines", + "Shift-F5": "reverseSortLines", "Cmd-F5": "sortLinesInsensitive", + "Shift-Cmd-F5": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Cmd-F2": "toggleBookmark", @@ -671,7 +675,9 @@ "Ctrl-J": "joinLines", "Shift-Ctrl-D": "duplicateLine", "F9": "sortLines", + "Shift-F9": "reverseSortLines", "Ctrl-F9": "sortLinesInsensitive", + "Shift-Ctrl-F9": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Ctrl-F2": "toggleBookmark", diff --git a/plugins/codemirror/mode/crystal/crystal.js b/plugins/codemirror/mode/crystal/crystal.js index 5c601c6ab..14dea98e2 100644 --- a/plugins/codemirror/mode/crystal/crystal.js +++ b/plugins/codemirror/mode/crystal/crystal.js @@ -194,17 +194,17 @@ // Numbers if (stream.eat("0")) { if (stream.eat("x")) { - stream.match(/^[0-9a-fA-F]+/); + stream.match(/^[0-9a-fA-F_]+/); } else if (stream.eat("o")) { - stream.match(/^[0-7]+/); + stream.match(/^[0-7_]+/); } else if (stream.eat("b")) { - stream.match(/^[01]+/); + stream.match(/^[01_]+/); } return "number"; } if (stream.eat(/^\d/)) { - stream.match(/^\d*(?:\.\d+)?(?:[eE][+-]?\d+)?/); + stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/); return "number"; } diff --git a/plugins/codemirror/mode/erlang/erlang.js b/plugins/codemirror/mode/erlang/erlang.js index f0541bb95..d827296f3 100644 --- a/plugins/codemirror/mode/erlang/erlang.js +++ b/plugins/codemirror/mode/erlang/erlang.js @@ -339,8 +339,8 @@ CodeMirror.defineMode("erlang", function(cmCfg) { } function lookahead(stream) { - var m = stream.match(/([\n\s]+|%[^\n]*\n)*(.)/,false); - return m ? m.pop() : ""; + var m = stream.match(/^\s*([^\s%])/, false) + return m ? m[1] : ""; } function is_member(element,list) { diff --git a/plugins/codemirror/mode/javascript/javascript.js b/plugins/codemirror/mode/javascript/javascript.js index 047395622..a42f23d07 100644 --- a/plugins/codemirror/mode/javascript/javascript.js +++ b/plugins/codemirror/mode/javascript/javascript.js @@ -218,7 +218,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { // Parser - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; + var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, + "regexp": true, "this": true, "import": true, "jsonld-keyword": true}; function JSLexical(indented, column, type, align, prev, info) { this.indented = indented; @@ -441,7 +442,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "{") return contCommasep(objprop, "}", null, maybeop); if (type == "quasi") return pass(quasi, maybeop); if (type == "new") return cont(maybeTarget(noComma)); - if (type == "import") return cont(expression); return cont(); } function maybeexpression(type) { @@ -605,7 +605,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } } function typeexpr(type, value) { - if (value == "keyof" || value == "typeof" || value == "infer") { + if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") { cx.marked = "keyword" return cont(value == "typeof" ? expressionNoComma : typeexpr) } @@ -802,6 +802,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function afterImport(type) { if (type == "string") return cont(); if (type == "(") return pass(expression); + if (type == ".") return pass(maybeoperatorComma); return pass(importSpec, maybeMoreImports, maybeFrom); } function importSpec(type, value) { diff --git a/plugins/codemirror/mode/julia/julia.js b/plugins/codemirror/mode/julia/julia.js index bff5413b8..de9f987d8 100644 --- a/plugins/codemirror/mode/julia/julia.js +++ b/plugins/codemirror/mode/julia/julia.js @@ -241,10 +241,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) { state.isDefinition = false; return "def"; } - if (stream.match(/^({[^}]*})*\(/, false)) { - state.tokenize = tokenCallOrDef; - return state.tokenize(stream, state); - } state.leavingExpr = true; return "variable"; } @@ -254,46 +250,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return "error"; } - function tokenCallOrDef(stream, state) { - for (;;) { - var match = stream.match(/^(\(\s*)/), charsAdvanced = 0; - if (match) { - if (state.firstParenPos < 0) - state.firstParenPos = state.scopes.length; - state.scopes.push('('); - charsAdvanced += match[1].length; - } - if (currentScope(state) == '(' && stream.match(')')) { - state.scopes.pop(); - charsAdvanced += 1; - if (state.scopes.length <= state.firstParenPos) { - var isDefinition = stream.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/, false); - stream.backUp(charsAdvanced); - state.firstParenPos = -1; - state.tokenize = tokenBase; - if (isDefinition) - return "def"; - return "builtin"; - } - } - // Unfortunately javascript does not support multiline strings, so we have - // to undo anything done upto here if a function call or definition splits - // over two or more lines. - if (stream.match(/^$/g, false)) { - stream.backUp(charsAdvanced); - while (state.scopes.length > state.firstParenPos) - state.scopes.pop(); - state.firstParenPos = -1; - state.tokenize = tokenBase; - return "builtin"; - } - if (!stream.match(/^[^()]+/)) { - stream.next() - return null - } - } - } - function tokenAnnotation(stream, state) { stream.match(/.*?(?=[,;{}()=\s]|$)/); if (stream.match('{')) { diff --git a/plugins/codemirror/mode/lua/lua.js b/plugins/codemirror/mode/lua/lua.js index 202f37358..2fad0180f 100644 --- a/plugins/codemirror/mode/lua/lua.js +++ b/plugins/codemirror/mode/lua/lua.js @@ -148,6 +148,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) { return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0)); }, + electricInput: /^\s*(?:end|until|else|\)|\})$/, lineComment: "--", blockCommentStart: "--[[", blockCommentEnd: "]]" diff --git a/plugins/codemirror/mode/markdown/markdown.js b/plugins/codemirror/mode/markdown/markdown.js index 038a776bd..a9e272ea8 100644 --- a/plugins/codemirror/mode/markdown/markdown.js +++ b/plugins/codemirror/mode/markdown/markdown.js @@ -735,7 +735,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (stream.peek() === undefined) { // End of line, set flag to check next line state.linkTitle = true; } else { // More content on line, check if link title - stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true); + stream.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true); } state.f = state.inline = inlineNormal; return tokenTypes.linkHref + " url"; diff --git a/plugins/codemirror/mode/python/python.js b/plugins/codemirror/mode/python/python.js index de5fd38a1..1befb4045 100644 --- a/plugins/codemirror/mode/python/python.js +++ b/plugins/codemirror/mode/python/python.js @@ -282,7 +282,7 @@ } function pushBracketScope(stream, state, type) { - var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1 + var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1 state.scopes.push({offset: state.indent + hangingIndent, type: type, align: align}) diff --git a/plugins/codemirror/mode/sass/sass.js b/plugins/codemirror/mode/sass/sass.js index 1258e142c..d8427bff5 100644 --- a/plugins/codemirror/mode/sass/sass.js +++ b/plugins/codemirror/mode/sass/sass.js @@ -445,7 +445,12 @@ CodeMirror.defineMode("sass", function(config) { indent: function(state) { return state.scopes[0].offset; - } + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + fold: "indent" }; }, "css"); diff --git a/plugins/codemirror/mode/wast/wast.js b/plugins/codemirror/mode/wast/wast.js index a730d39ef..9bddc8878 100644 --- a/plugins/codemirror/mode/wast/wast.js +++ b/plugins/codemirror/mode/wast/wast.js @@ -11,11 +11,96 @@ })(function(CodeMirror) { "use strict"; +var kKeywords = [ + "align", + "block", + "br(_if|_table|_on_(cast|data|func|i31|null))?", + "call(_indirect|_ref)?", + "current_memory", + "\\bdata\\b", + "drop", + "elem", + "else", + "end", + "export", + "\\bextern\\b", + "\\bfunc\\b", + "global(\\.(get|set))?", + "if", + "import", + "local(\\.(get|set|tee))?", + "loop", + "module", + "mut", + "nop", + "offset", + "param", + "result", + "return(_call(_indirect|_ref)?)?", + "select", + "start", + "table(\\.(size|get|set|size|grow|fill|init|copy))?", + "then", + "type", + "unreachable", + + // Numeric opcodes. + "i(32|64)\\.(store(8|16)|(load(8|16)_[su]))", + "i64\\.(load32_[su]|store32)", + "[fi](32|64)\\.(const|load|store)", + "f(32|64)\\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)", + "i(32|64)\\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)", + "i64\\.extend_[su]_i32", + "i32\\.wrap_i64", + "i(32|64)\\.trunc_f(32|64)_[su]", + "f(32|64)\\.convert_i(32|64)_[su]", + "f64\\.promote_f32", + "f32\\.demote_f64", + "f32\\.reinterpret_i32", + "i32\\.reinterpret_f32", + "f64\\.reinterpret_i64", + "i64\\.reinterpret_f64", + // Atomics. + "memory(\\.((atomic\\.(notify|wait(32|64)))|grow|size))?", + "i64\.atomic\\.(load32_u|store32|rmw32\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)", + "i(32|64)\\.atomic\\.(load((8|16)_u)?|store(8|16)?|rmw(\\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))", + // SIMD. + "v128\\.load(8x8|16x4|32x2)_[su]", + "v128\\.load(8|16|32|64)_splat", + "v128\\.(load|store)(8|16|32|64)_lane", + "v128\\.load(32|64)_zero", + "v128\.(load|store|const|not|andnot|and|or|xor|bitselect|any_true)", + "i(8x16|16x8)\\.(extract_lane_[su]|(add|sub)_sat_[su]|avgr_u)", + "i(8x16|16x8|32x4|64x2)\\.(neg|add|sub|abs|shl|shr_[su]|all_true|bitmask|eq|ne|[lg][te]_s)", + "(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane)", + "i(8x16|16x8|32x4)\\.(([lg][te]_u)|((min|max)_[su]))", + "f(32x4|64x2)\\.(neg|add|sub|abs|nearest|eq|ne|[lg][te]|sqrt|mul|div|min|max|ceil|floor|trunc)", + "[fi](32x4|64x2)\\.extract_lane", + "i8x16\\.(shuffle|swizzle|popcnt|narrow_i16x8_[su])", + "i16x8\\.(narrow_i32x4_[su]|mul|extadd_pairwise_i8x16_[su]|q15mulr_sat_s)", + "i16x8\\.(extend|extmul)_(low|high)_i8x16_[su]", + "i32x4\\.(mul|dot_i16x8_s|trunc_sat_f64x2_[su]_zero)", + "i32x4\\.((extend|extmul)_(low|high)_i16x8_|trunc_sat_f32x4_|extadd_pairwise_i16x8_)[su]", + "i64x2\\.(mul|(extend|extmul)_(low|high)_i32x4_[su])", + "f32x4\\.(convert_i32x4_[su]|demote_f64x2_zero)", + "f64x2\\.(promote_low_f32x4|convert_low_i32x4_[su])", + // Reference types, function references, and GC. + "\\bany\\b", + "array\\.len", + "(array|struct)(\\.(new_(default_)?with_rtt|get(_[su])?|set))?", + "\\beq\\b", + "field", + "i31\\.(new|get_[su])", + "\\bnull\\b", + "ref(\\.(([ai]s_(data|func|i31))|cast|eq|func|(is_|as_non_)?null|test))?", + "rtt(\\.(canon|sub))?", +]; + CodeMirror.defineSimpleMode('wast', { start: [ {regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"}, - {regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|\bfunc\b|param|result|local|global|module|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]|ref\.(func|(is_)?null)|\bextern\b|table(\.(size|get|set|size|grow|fill|init|copy))?/, token: "keyword"}, - {regex: /\b(funcref|externref|[fi](32|64))\b/, token: "atom"}, + {regex: new RegExp(kKeywords.join('|')), token: "keyword"}, + {regex: /\b((any|data|eq|extern|i31|func)ref|[fi](32|64)|i(8|16))\b/, token: "atom"}, {regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"}, {regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"}, {regex: /\(;.*?/, token: "comment", next: "comment"}, diff --git a/plugins/datatables-buttons/css/buttons.bootstrap4.css b/plugins/datatables-buttons/css/buttons.bootstrap4.css index 2851f5fe3..f0f940369 100644 --- a/plugins/datatables-buttons/css/buttons.bootstrap4.css +++ b/plugins/datatables-buttons/css/buttons.bootstrap4.css @@ -182,7 +182,7 @@ div.dt-buttons a.btn.processing:after { margin: -8px 0 0 -8px; box-sizing: border-box; display: block; - content: ' '; + content: " "; border: 2px solid #282828; border-radius: 50%; border-left-color: transparent; diff --git a/plugins/datatables-buttons/css/buttons.bootstrap4.min.css b/plugins/datatables-buttons/css/buttons.bootstrap4.min.css index fd0f71b3b..1e79cc78c 100644 --- a/plugins/datatables-buttons/css/buttons.bootstrap4.min.css +++ b/plugins/datatables-buttons/css/buttons.bootstrap4.min.css @@ -1 +1 @@ -@keyframes dtb-spinner{100%{transform:rotate(360deg)}}@-o-keyframes dtb-spinner{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes dtb-spinner{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dtb-spinner{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes dtb-spinner{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}div.dt-button-info{position:fixed;top:50%;left:50%;width:400px;margin-top:-100px;margin-left:-200px;background-color:white;border:2px solid #111;box-shadow:3px 3px 8px rgba(0,0,0,0.3);border-radius:3px;text-align:center;z-index:21}div.dt-button-info h2{padding:0.5em;margin:0;font-weight:normal;border-bottom:1px solid #ddd;background-color:#f3f3f3}div.dt-button-info>div{padding:1em}div.dt-button-collection-title{text-align:center;padding:0.3em 0 0.5em;font-size:0.9em}div.dt-button-collection-title:empty{display:none}div.dt-button-collection{position:absolute;z-index:2001}div.dt-button-collection div.dropdown-menu{display:block;z-index:2002;min-width:100%}div.dt-button-collection div.dt-button-collection-title{background-color:white;border:1px solid rgba(0,0,0,0.15)}div.dt-button-collection.fixed{position:fixed;top:50%;left:50%;margin-left:-75px;border-radius:0}div.dt-button-collection.fixed.two-column{margin-left:-200px}div.dt-button-collection.fixed.three-column{margin-left:-225px}div.dt-button-collection.fixed.four-column{margin-left:-300px}div.dt-button-collection>:last-child{display:block !important;-webkit-column-gap:8px;-moz-column-gap:8px;-ms-column-gap:8px;-o-column-gap:8px;column-gap:8px}div.dt-button-collection>:last-child>*{-webkit-column-break-inside:avoid;break-inside:avoid}div.dt-button-collection.two-column{width:400px}div.dt-button-collection.two-column>:last-child{padding-bottom:1px;-webkit-column-count:2;-moz-column-count:2;-ms-column-count:2;-o-column-count:2;column-count:2}div.dt-button-collection.three-column{width:450px}div.dt-button-collection.three-column>:last-child{padding-bottom:1px;-webkit-column-count:3;-moz-column-count:3;-ms-column-count:3;-o-column-count:3;column-count:3}div.dt-button-collection.four-column{width:600px}div.dt-button-collection.four-column>:last-child{padding-bottom:1px;-webkit-column-count:4;-moz-column-count:4;-ms-column-count:4;-o-column-count:4;column-count:4}div.dt-button-collection .dt-button{border-radius:0}div.dt-button-collection.fixed{max-width:none}div.dt-button-collection.fixed:before,div.dt-button-collection.fixed:after{display:none}div.dt-button-background{position:fixed;top:0;left:0;width:100%;height:100%;z-index:999}@media screen and (max-width: 767px){div.dt-buttons{float:none;width:100%;text-align:center;margin-bottom:0.5em}div.dt-buttons a.btn{float:none}}div.dt-buttons button.btn.processing,div.dt-buttons div.btn.processing,div.dt-buttons a.btn.processing{color:rgba(0,0,0,0.2)}div.dt-buttons button.btn.processing:after,div.dt-buttons div.btn.processing:after,div.dt-buttons a.btn.processing:after{position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;box-sizing:border-box;display:block;content:' ';border:2px solid #282828;border-radius:50%;border-left-color:transparent;border-right-color:transparent;animation:dtb-spinner 1500ms infinite linear;-o-animation:dtb-spinner 1500ms infinite linear;-ms-animation:dtb-spinner 1500ms infinite linear;-webkit-animation:dtb-spinner 1500ms infinite linear;-moz-animation:dtb-spinner 1500ms infinite linear} +@keyframes dtb-spinner{100%{transform:rotate(360deg)}}@-o-keyframes dtb-spinner{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes dtb-spinner{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dtb-spinner{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes dtb-spinner{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}div.dt-button-info{position:fixed;top:50%;left:50%;width:400px;margin-top:-100px;margin-left:-200px;background-color:white;border:2px solid #111;box-shadow:3px 3px 8px rgba(0, 0, 0, 0.3);border-radius:3px;text-align:center;z-index:21}div.dt-button-info h2{padding:.5em;margin:0;font-weight:normal;border-bottom:1px solid #ddd;background-color:#f3f3f3}div.dt-button-info>div{padding:1em}div.dt-button-collection-title{text-align:center;padding:.3em 0 .5em;font-size:.9em}div.dt-button-collection-title:empty{display:none}div.dt-button-collection{position:absolute;z-index:2001}div.dt-button-collection div.dropdown-menu{display:block;z-index:2002;min-width:100%}div.dt-button-collection div.dt-button-collection-title{background-color:white;border:1px solid rgba(0, 0, 0, 0.15)}div.dt-button-collection.fixed{position:fixed;top:50%;left:50%;margin-left:-75px;border-radius:0}div.dt-button-collection.fixed.two-column{margin-left:-200px}div.dt-button-collection.fixed.three-column{margin-left:-225px}div.dt-button-collection.fixed.four-column{margin-left:-300px}div.dt-button-collection>:last-child{display:block !important;-webkit-column-gap:8px;-moz-column-gap:8px;-ms-column-gap:8px;-o-column-gap:8px;column-gap:8px}div.dt-button-collection>:last-child>*{-webkit-column-break-inside:avoid;break-inside:avoid}div.dt-button-collection.two-column{width:400px}div.dt-button-collection.two-column>:last-child{padding-bottom:1px;-webkit-column-count:2;-moz-column-count:2;-ms-column-count:2;-o-column-count:2;column-count:2}div.dt-button-collection.three-column{width:450px}div.dt-button-collection.three-column>:last-child{padding-bottom:1px;-webkit-column-count:3;-moz-column-count:3;-ms-column-count:3;-o-column-count:3;column-count:3}div.dt-button-collection.four-column{width:600px}div.dt-button-collection.four-column>:last-child{padding-bottom:1px;-webkit-column-count:4;-moz-column-count:4;-ms-column-count:4;-o-column-count:4;column-count:4}div.dt-button-collection .dt-button{border-radius:0}div.dt-button-collection.fixed{max-width:none}div.dt-button-collection.fixed:before,div.dt-button-collection.fixed:after{display:none}div.dt-button-background{position:fixed;top:0;left:0;width:100%;height:100%;z-index:999}@media screen and (max-width: 767px){div.dt-buttons{float:none;width:100%;text-align:center;margin-bottom:.5em}div.dt-buttons a.btn{float:none}}div.dt-buttons button.btn.processing,div.dt-buttons div.btn.processing,div.dt-buttons a.btn.processing{color:rgba(0, 0, 0, 0.2)}div.dt-buttons button.btn.processing:after,div.dt-buttons div.btn.processing:after,div.dt-buttons a.btn.processing:after{position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;box-sizing:border-box;display:block;content:" ";border:2px solid #282828;border-radius:50%;border-left-color:transparent;border-right-color:transparent;animation:dtb-spinner 1500ms infinite linear;-o-animation:dtb-spinner 1500ms infinite linear;-ms-animation:dtb-spinner 1500ms infinite linear;-webkit-animation:dtb-spinner 1500ms infinite linear;-moz-animation:dtb-spinner 1500ms infinite linear} diff --git a/plugins/datatables-buttons/js/dataTables.buttons.js b/plugins/datatables-buttons/js/dataTables.buttons.js index de95de260..9fcc32e23 100644 --- a/plugins/datatables-buttons/js/dataTables.buttons.js +++ b/plugins/datatables-buttons/js/dataTables.buttons.js @@ -1,5 +1,5 @@ -/*! Buttons for DataTables 1.6.5 - * ©2016-2020 SpryMedia Ltd - datatables.net/license +/*! Buttons for DataTables 1.7.0 + * ©2016-2021 SpryMedia Ltd - datatables.net/license */ (function( factory ){ @@ -585,7 +585,7 @@ $.extend( Buttons.prototype, { } // Make sure that the button is available based on whatever requirements - // it has. For example, Flash buttons require Flash + // it has. For example, PDF button require pdfmake if ( config.available && ! config.available( dt, config ) ) { return false; } @@ -1464,6 +1464,41 @@ Buttons.buttonSelector = function ( insts, selector ) return ret; }; +/** + * Default function used for formatting output data. + * @param {*} str Data to strip + */ +Buttons.stripData = function ( str, config ) { + if ( typeof str !== 'string' ) { + return str; + } + + // Always remove script tags + str = str.replace( /)<[^<]*)*<\/script>/gi, '' ); + + // Always remove comments + str = str.replace( //g, '' ); + + if ( config.stripHtml ) { + str = str.replace( /<[^>]*>/g, '' ); + } + + if ( config.trim ) { + str = str.replace( /^\s+|\s+$/g, '' ); + } + + if ( config.stripNewlines ) { + str = str.replace( /\n/g, ' ' ); + } + + if ( config.decodeEntities ) { + _exportTextarea.innerHTML = str; + str = _exportTextarea.value; + } + + return str; +}; + /** * Buttons defaults. For full documentation, please refer to the docs/option @@ -1485,10 +1520,7 @@ Buttons.defaults = { className: '' }, button: { - // Flash buttons will not work with `