diff options
author | Wu Cheng-Han | 2016-01-17 14:28:04 -0600 |
---|---|---|
committer | Wu Cheng-Han | 2016-01-17 14:28:04 -0600 |
commit | eaa8ccaccb1091820d0a8d1223996a6dd057347d (patch) | |
tree | 6b4aaa3b3d1a2fed68147510142663222533775a /public/vendor/codemirror/addon/edit | |
parent | ce65e58096d57ace02723d11a125673f9d48c293 (diff) |
Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor
Diffstat (limited to 'public/vendor/codemirror/addon/edit')
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/closebrackets.js | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/closetag.js | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/continuelist.js | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/matchbrackets.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/matchtags.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/addon/edit/trailingspace.js | 0 |
6 files changed, 25 insertions, 12 deletions
diff --git a/public/vendor/codemirror/addon/edit/closebrackets.js b/public/vendor/codemirror/addon/edit/closebrackets.js index 1ceda4e3..3eb9d8ea 100755..100644 --- a/public/vendor/codemirror/addon/edit/closebrackets.js +++ b/public/vendor/codemirror/addon/edit/closebrackets.js @@ -79,7 +79,7 @@ if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; } cm.operation(function() { - cm.replaceSelection("\n\n", null, "+input"); + cm.replaceSelection("\n\n", null); cm.execCommand("goCharLeft"); ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { @@ -90,6 +90,12 @@ }); } + function contractSelection(sel) { + var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; + return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), + head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))}; + } + function handleChar(cm, ch) { var conf = getConfig(cm); if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; @@ -144,13 +150,17 @@ var sels = cm.getSelections(); for (var i = 0; i < sels.length; i++) sels[i] = left + sels[i] + right; - cm.replaceSelections(sels, "around", "+input"); + cm.replaceSelections(sels, "around"); + sels = cm.listSelections().slice(); + for (var i = 0; i < sels.length; i++) + sels[i] = contractSelection(sels[i]); + cm.setSelections(sels); } else if (type == "both") { - cm.replaceSelection(left + right, null, "+input"); + cm.replaceSelection(left + right, null); cm.triggerElectric(left + right); cm.execCommand("goCharLeft"); } else if (type == "addFour") { - cm.replaceSelection(left + left + left + left, "before", "+input"); + cm.replaceSelection(left + left + left + left, "before"); cm.execCommand("goCharRight"); } }); diff --git a/public/vendor/codemirror/addon/edit/closetag.js b/public/vendor/codemirror/addon/edit/closetag.js index c2d2263e..a518da3e 100755..100644 --- a/public/vendor/codemirror/addon/edit/closetag.js +++ b/public/vendor/codemirror/addon/edit/closetag.js @@ -108,21 +108,24 @@ // 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). + var replacement; if (inner.mode.name != "xml") { if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript") - replacements[i] = head + "script>"; + replacement = head + "script"; else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") - replacements[i] = head + "style>"; + replacement = head + "style"; else return CodeMirror.Pass; } else { if (!state.context || !state.context.tagName || closingTagExists(cm, state.context.tagName, pos, state)) return CodeMirror.Pass; - replacements[i] = head + state.context.tagName + ">"; + replacement = head + state.context.tagName; } + if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">"; + replacements[i] = replacement; } - cm.replaceSelections(replacements, null, '+input'); + cm.replaceSelections(replacements); ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) diff --git a/public/vendor/codemirror/addon/edit/continuelist.js b/public/vendor/codemirror/addon/edit/continuelist.js index a0941d4f..df5179fe 100755..100644 --- a/public/vendor/codemirror/addon/edit/continuelist.js +++ b/public/vendor/codemirror/addon/edit/continuelist.js @@ -11,8 +11,8 @@ })(function(CodeMirror) { "use strict"; - var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/, - emptyListRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/, + var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/, + emptyListRE = /^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/; CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { @@ -34,7 +34,7 @@ line: pos.line, ch: 0 }, { line: pos.line, ch: pos.ch + 1 - }, "+delete"); + }); replacements[i] = "\n"; } else { var indent = match[1], after = match[5]; @@ -46,6 +46,6 @@ } } - cm.replaceSelections(replacements, null, "+input"); + cm.replaceSelections(replacements); }; }); diff --git a/public/vendor/codemirror/addon/edit/matchbrackets.js b/public/vendor/codemirror/addon/edit/matchbrackets.js index 70e1ae18..70e1ae18 100755..100644 --- a/public/vendor/codemirror/addon/edit/matchbrackets.js +++ b/public/vendor/codemirror/addon/edit/matchbrackets.js diff --git a/public/vendor/codemirror/addon/edit/matchtags.js b/public/vendor/codemirror/addon/edit/matchtags.js index fb1911a8..fb1911a8 100755..100644 --- a/public/vendor/codemirror/addon/edit/matchtags.js +++ b/public/vendor/codemirror/addon/edit/matchtags.js diff --git a/public/vendor/codemirror/addon/edit/trailingspace.js b/public/vendor/codemirror/addon/edit/trailingspace.js index fa7b56be..fa7b56be 100755..100644 --- a/public/vendor/codemirror/addon/edit/trailingspace.js +++ b/public/vendor/codemirror/addon/edit/trailingspace.js |