diff --git a/AUTHORS b/AUTHORS index 5d0740fe9d..455d7e68a5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -32,9 +32,11 @@ anaran AndersMad Anders Nawroth Anderson Mesquita +Andrea G Andreas Reischuck Andre von Houck Andrey Fedorov +Andrey Klyuchnikov Andrey Lushnikov Andy Joslin Andy Kimball @@ -86,6 +88,7 @@ ComFreek Curtis Gagliardi dagsta daines +Dale Jung Dan Heberden Daniel, Dao Quang Minh Daniele Di Sarli @@ -144,6 +147,7 @@ Golevka Gordon Smith Grant Skinner greengiant +Gregory Koberger Guillaume Massé Guillaume Massé Gustavo Rodrigues @@ -176,6 +180,7 @@ jankeromnes Jan Keromnes Jan Odvarko Jan T. Sott +Jared Forsyth Jason Jason Grout Jason Johnston @@ -186,6 +191,7 @@ Jean Boussier jeffkenton Jeff Pickhardt jem (graphite) +Jeremy Parmenter Jochen Berger Johan Ask John Connor @@ -229,6 +235,7 @@ LM lochel Lorenzo Stoakes Luciano Longo +Luke Stagner lynschinzer Maksim Lin Maksym Taran @@ -288,8 +295,10 @@ nextrevision nguillaumin Ng Zhi An Nicholas Bollweg +Nicholas Bollweg (Nick) Nick Small Niels van Groningen +nightwing Nikita Beloglazov Nikita Vasilyev Nikolay Kostov @@ -316,6 +325,7 @@ prasanthj Prasanth J Radek Piórkowski Rahul +Randy Burden Randy Edmunds Rasmus Erik Voel Jensen Richard van der Meer @@ -335,6 +345,7 @@ satchmorun sathyamoorthi SCLINIC\jdecker Scott Aikin +Scott Goodhew Sebastian Zaha shaund shaun gilchrist diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47006a17f4..c4296ce4d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ ## Getting help Community discussion, questions, and informal bug reporting is done on the -[CodeMirror Google group](http://groups.google.com/group/codemirror). +[discuss.CodeMirror forum](http://discuss.codemirror.net). ## Submitting bug reports @@ -17,7 +17,7 @@ reporting a bug, read these pointers. **Note:** The issue tracker is for *bugs*, not requests for help. Questions should be asked on the -[CodeMirror Google group](http://groups.google.com/group/codemirror) instead. +[discuss.CodeMirror forum](http://discuss.codemirror.net) instead. ### Reporting bugs effectively diff --git a/addon/edit/closebrackets.js b/addon/edit/closebrackets.js index 32eca014c5..f6b42f02d3 100644 --- a/addon/edit/closebrackets.js +++ b/addon/edit/closebrackets.js @@ -71,7 +71,7 @@ }; var closingBrackets = ""; for (var i = 0; i < pairs.length; i += 2) (function(left, right) { - if (left != right) closingBrackets += right; + closingBrackets += right; map["'" + left + "'"] = function(cm) { if (cm.getOption("disableInput")) return CodeMirror.Pass; var ranges = cm.listSelections(), type, next; diff --git a/addon/hint/javascript-hint.js b/addon/hint/javascript-hint.js index c7292468a0..f6c2440062 100644 --- a/addon/hint/javascript-hint.js +++ b/addon/hint/javascript-hint.js @@ -93,7 +93,7 @@ "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" "); function getCompletions(token, context, keywords, options) { - var found = [], start = token.string; + var found = [], start = token.string, global = options && options.globalScope || window; function maybeAdd(str) { if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str); } @@ -112,28 +112,28 @@ if (options && options.additionalContext) base = options.additionalContext[obj.string]; if (!options || options.useGlobalScope !== false) - base = base || window[obj.string]; + base = base || global[obj.string]; } else if (obj.type == "string") { base = ""; } else if (obj.type == "atom") { base = 1; } else if (obj.type == "function") { - if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && - (typeof window.jQuery == 'function')) - base = window.jQuery(); - else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function')) - base = window._(); + if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && + (typeof global.jQuery == 'function')) + base = global.jQuery(); + else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function')) + base = global._(); } while (base != null && context.length) base = base[context.pop().string]; if (base != null) gatherCompletions(base); } else { - // If not, just look in the window object and any local scope + // If not, just look in the global object and any local scope // (reading into JS mode internals to get at the local and global variables) 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.useGlobalScope !== false) - gatherCompletions(window); + gatherCompletions(global); forEach(keywords, maybeAdd); } return found; diff --git a/addon/hint/xml-hint.js b/addon/hint/xml-hint.js index e31b09b5fc..cc95b20f34 100644 --- a/addon/hint/xml-hint.js +++ b/addon/hint/xml-hint.js @@ -18,10 +18,17 @@ var quote = (options && options.quoteChar) || '"'; if (!tags) return; var cur = cm.getCursor(), token = cm.getTokenAt(cur); + if (/^<\/?$/.test(token.string) && token.end == cur.ch) { + var nextToken = cm.getTokenAt(Pos(cur.line, cur.ch + 1)); + if (nextToken.start == cur.ch && /\btag\b/.test(nextToken.type)) + token = nextToken; + } var inner = CodeMirror.innerMode(cm.getMode(), token.state); if (inner.mode.name != "xml") return; var result = [], replaceToken = false, prefix; - var tag = /\btag\b/.test(token.type), tagName = tag && /^\w/.test(token.string), tagStart; + var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string); + var tagName = tag && /^\w/.test(token.string), tagStart; + if (tagName) { var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start); var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null; @@ -31,6 +38,7 @@ } else if (tag && token.string == " 100) return clearInterval(poll); - if (CodeMirror.modes.hasOwnProperty(mode)) { - clearInterval(poll); - loading[mode] = null; + var file = CodeMirror.modeURL.replace(/%N/g, mode); + if (env == "plain") { + var script = document.createElement("script"); + script.src = file; + var others = document.getElementsByTagName("script")[0]; + var list = loading[mode] = [cont]; + CodeMirror.on(script, "load", function() { ensureDeps(mode, function() { for (var i = 0; i < list.length; ++i) list[i](); }); - } - }, 200); + }); + others.parentNode.insertBefore(script, others); + } else if (env == "cjs") { + require(file); + cont(); + } else if (env == "amd") { + requirejs([file], cont); + } }; CodeMirror.autoLoadMode = function(instance, mode) { diff --git a/addon/mode/overlay.js b/addon/mode/overlay.js index 393054dfa4..e1b9ed3753 100644 --- a/addon/mode/overlay.js +++ b/addon/mode/overlay.js @@ -28,7 +28,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) { overlay: CodeMirror.startState(overlay), basePos: 0, baseCur: null, overlayPos: 0, overlayCur: null, - lineSeen: null + streamSeen: null }; }, copyState: function(state) { @@ -41,9 +41,9 @@ CodeMirror.overlayMode = function(base, overlay, combine) { }, token: function(stream, state) { - if (stream.sol() || stream.string != state.lineSeen || + if (stream != state.streamSeen || Math.min(state.basePos, state.overlayPos) < stream.start) { - state.lineSeen = stream.string; + state.streamSeen = stream; state.basePos = state.overlayPos = stream.start; } diff --git a/bower.json b/bower.json index 81352b6d70..bf28a95f87 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "codemirror", - "version":"4.7.0", + "version":"4.8.0", "main": ["lib/codemirror.js", "lib/codemirror.css"], "ignore": [ "**/.*", diff --git a/demo/closebrackets.html b/demo/closebrackets.html index 45da4ebf87..d702f52696 100644 --- a/demo/closebrackets.html +++ b/demo/closebrackets.html @@ -7,7 +7,7 @@ - + diff --git a/demo/mustache.html b/demo/mustache.html index ecc68555ef..ae4e6a891b 100644 --- a/demo/mustache.html +++ b/demo/mustache.html @@ -46,9 +46,10 @@ var ch; if (stream.match("{{")) { while ((ch = stream.next()) != null) - if (ch == "}" && stream.next() == "}") break; - stream.eat("}"); - return "mustache"; + if (ch == "}" && stream.next() == "}") { + stream.eat("}"); + return "mustache"; + } } while (stream.next() != null && !stream.match("{{", false)) {} return null; diff --git a/demo/sublime.html b/demo/sublime.html index 4cedbcd623..b3b5342c97 100644 --- a/demo/sublime.html +++ b/demo/sublime.html @@ -53,14 +53,11 @@ +

Java example

+ + + +

Dockerfile syntac highlighting for CodeMirror.

+ +

MIME types defined: text/x-dockerfile

+ diff --git a/mode/gfm/gfm.js b/mode/gfm/gfm.js index eb0b7c193b..80a8e2c84d 100644 --- a/mode/gfm/gfm.js +++ b/mode/gfm/gfm.js @@ -109,7 +109,8 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) { var markdownConfig = { underscoresBreakWords: false, taskLists: true, - fencedCodeBlocks: true + fencedCodeBlocks: true, + strikethrough: true }; for (var attr in modeConfig) { markdownConfig[attr] = modeConfig[attr]; diff --git a/mode/gfm/index.html b/mode/gfm/index.html index a35e56866c..7e38c52d60 100644 --- a/mode/gfm/index.html +++ b/mode/gfm/index.html @@ -14,6 +14,7 @@ +