Skip to content

Commit fcf0b1c

Browse files
committed
Merge remote-tracking branch 'codemirror/master'
# Conflicts: # addon/edit/continuelist.js # package.json
2 parents 01a02c8 + 1e072d5 commit fcf0b1c

File tree

112 files changed

+3493
-1567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3493
-1567
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/mode/*/*.html
99
/mode/index.html
1010
.*
11+
bin

AUTHORS

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ alexey-k
2929
Alex Piggott
3030
Aliaksei Chapyzhenka
3131
Allen Sarkisyan
32+
Ami Fischman
3233
Amin Shali
3334
Amin Ullah Khan
3435
amshali@google.com
@@ -45,6 +46,7 @@ Andrea G
4546
Andreas Reischuck
4647
Andres Taylor
4748
Andre von Houck
49+
Andrew Cheng
4850
Andrey Fedorov
4951
Andrey Klyuchnikov
5052
Andrey Lushnikov
@@ -67,11 +69,14 @@ Apollo Zhu
6769
AQNOUCH Mohammed
6870
areos
6971
Arnab Bose
72+
Arthur Müller
73+
Arun Narasani
7074
as3boyan
7175
atelierbram
7276
AtomicPages LLC
7377
Atul Bhouraskar
7478
Aurelian Oancea
79+
Axel Lewenhaupt
7580
Barret Rennie
7681
Basarat Ali Syed
7782
Bastian Müller
@@ -100,7 +105,9 @@ Brandon Wamboldt
100105
Brett Zamir
101106
Brian Grinstead
102107
Brian Sletten
108+
brrd
103109
Bruce Mitchener
110+
Bryan Massoth
104111
Caitlin Potter
105112
Calin Barbat
106113
callodacity
@@ -119,6 +126,7 @@ Chris Smith
119126
Christian Oyarzun
120127
Christian Petrov
121128
Christopher Brown
129+
Christopher Kramer
122130
Christopher Mitchell
123131
Christopher Pfohl
124132
Chunliang Lyu
@@ -174,10 +182,12 @@ eborden
174182
edsharp
175183
ekhaled
176184
Elisée
185+
Emmanuel Schanzer
177186
Enam Mijbah Noor
178187
Eric Allam
179188
Erik Welander
180189
eustas
190+
Fabien Dubosson
181191
Fabien O'Carroll
182192
Fabio Zendhi Nagao
183193
Faiza Alsaied
@@ -186,6 +196,7 @@ fbuchinger
186196
feizhang365
187197
Felipe Lalanne
188198
Felix Raab
199+
ficristo
189200
Filip Noetzel
190201
Filip Stollár
191202
flack
@@ -202,6 +213,7 @@ Gary Sheng
202213
Gautam Mehta
203214
Gavin Douglas
204215
gekkoe
216+
Geordie Hall
205217
geowarin
206218
Gerard Braad
207219
Gergely Hegykozi
@@ -245,6 +257,7 @@ Irakli Gozalishvili
245257
Ivan Kurnosov
246258
Ivoah
247259
Jacob Lee
260+
Jake Peyser
248261
Jakob Miland
249262
Jakub Vrana
250263
Jakub Vrána
@@ -298,6 +311,7 @@ Jon Malmaud
298311
Jon Sangster
299312
Joost-Wim Boekesteijn
300313
Joseph Pecoraro
314+
Josh Barnes
301315
Josh Cohen
302316
Josh Soref
303317
Joshua Newman
@@ -320,6 +334,7 @@ Ken Newman
320334
ken restivo
321335
Ken Rockot
322336
Kevin Earls
337+
Kevin Muret
323338
Kevin Sawicki
324339
Kevin Ushey
325340
Klaus Silveira
@@ -345,6 +360,7 @@ LloydMilligan
345360
LM
346361
lochel
347362
Lorenzo Stoakes
363+
Luca Fabbri
348364
Luciano Longo
349365
Lu Fangjian
350366
Luke Browning
@@ -500,12 +516,15 @@ Remi Nyborg
500516
Richard Denton
501517
Richard van der Meer
502518
Richard Z.H. Wang
519+
Rishi Goomar
503520
Robert Crossfield
504521
Roberto Abdelkader Martínez Pérez
505522
robertop23
506523
Robert Plummer
507524
Rrandom
525+
Rrrandom
508526
Ruslan Osmanov
527+
Ryan Petrello
509528
Ryan Prior
510529
sabaca
511530
Sam Lee
@@ -582,6 +601,7 @@ Todd Berman
582601
Tomas-A
583602
Tomas Varaneckas
584603
Tom Erik Støwer
604+
Tom Klancer
585605
Tom MacWright
586606
Tony Jian
587607
Travis Heppe
@@ -613,6 +633,7 @@ Yunchi Luo
613633
Yuvi Panda
614634
Zac Anger
615635
Zachary Dremann
636+
Zeno Rocha
616637
Zhang Hao
617638
zziuni
618639
魏鹏刚

CHANGELOG.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,133 @@
1+
## 5.25.0 (2017-02-22)
2+
3+
### Bug fixes
4+
5+
In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.
6+
7+
Fix handling of selections bigger than the viewport in contentEditable mode.
8+
9+
Improve handling of changes that insert or delete lines in contentEditable mode.
10+
11+
Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.
12+
13+
Fix handling of shadow DOM roots when finding the active element.
14+
15+
Add `role=presentation` to more DOM elements to improve screen reader support.
16+
17+
[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
18+
19+
[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment.
20+
21+
[javascript mode](http://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
22+
23+
[r mode](http://codemirror.net/mode/r/): Fix indentation after semicolon-less statements.
24+
25+
[shell mode](http://codemirror.net/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
26+
27+
[markdown mode](http://codemirror.net/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
28+
29+
[soy mode](http://codemirror.net/mode/soy/): Improve indentation.
30+
31+
### New features
32+
33+
[lint addon](http://codemirror.net/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
34+
35+
[continuelist addon](http://codemirror.net/doc/manual.html#addon_continuelist): Support continuing task lists.
36+
37+
[vim bindings](http://codemirror.net/mode/demo/vim.html): Make Y behave like yy.
38+
39+
[sql mode](http://codemirror.net/mode/sql/): Support sqlite dialect.
40+
41+
## 5.24.2 (2017-02-22)
42+
43+
### Bug fixes
44+
45+
[javascript mode](http://codemirror.net/mode/javascript/): Support computed class method names.
46+
47+
[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
48+
49+
## 5.24.0 (2017-02-20)
50+
51+
### Bug fixes
52+
53+
A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.
54+
55+
Visual cursor motion in line-wrapped right-to-left text should be much more correct.
56+
57+
Fix bug in handling of read-only marked text.
58+
59+
[shell mode](http://codemirror.net/mode/shell/): Properly tokenize nested parentheses.
60+
61+
[python mode](http://codemirror.net/mode/python/): Support underscores in number literals.
62+
63+
[sass mode](http://codemirror.net/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
64+
65+
[css mode](http://codemirror.net/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
66+
67+
[julia mode](http://codemirror.net/mode/julia/): Properly indent `elseif` lines.
68+
69+
[markdown mode](http://codemirror.net/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
70+
71+
[scala mode](http://codemirror.net/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.
72+
73+
[xml mode](http://codemirror.net/mode/xml/): Allow dashes in HTML tag names.
74+
75+
[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
76+
77+
[indent-fold addon](http://codemirror.net/demo/folding.html): Ignore comment lines.
78+
79+
### New features
80+
81+
Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.
82+
83+
[vim bindings](http://codemirror.net/mode/demo/vim.html): Make it possible to remove built-in bindings through the API.
84+
85+
[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.
86+
87+
### Breaking changes
88+
89+
The [sass mode](http://codemirror.net/mode/sass/) now depends on the [css mode](http://codemirror.net/mode/css/).
90+
91+
## 5.23.0 (2017-01-19)
92+
93+
### Bug fixes
94+
95+
Presentation-related elements DOM elements are now marked as such to help screen readers.
96+
97+
[markdown mode](http://codemirror.net/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
98+
99+
### New features
100+
101+
`findModeByMIME` now understands `+json` and `+xml` MIME suffixes.
102+
103+
[closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
104+
105+
[panel addon](http://codemirror.net/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
106+
107+
## 5.22.2 (2017-01-12)
108+
109+
### Bug fixes
110+
111+
Include rollup.config.js in NPM package, so that it can be used to build from source.
112+
113+
## 5.22.0 (2016-12-20)
114+
115+
### Bug fixes
116+
117+
[sublime bindings](http://codemirror.net/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
118+
119+
[javascript mode](http://codemirror.net/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
120+
121+
A contentEditable editor instance with autofocus enabled no longer crashes during initializing.
122+
123+
### New features
124+
125+
[emacs bindings](http://codemirror.net/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
126+
127+
[active-line addon](http://codemirror.net/doc/manual.html#addon_active-line): Add `nonEmpty` option.
128+
129+
New event: [`optionChange`](http://codemirror.net/doc/manual.html#event_optionChange).
130+
1131
## 5.21.0 (2016-11-21)
2132

3133
### Bug fixes

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Copyright (C) 2016 by Marijn Haverbeke <marijnh@gmail.com> and others
1+
MIT License
2+
3+
Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy
46
of this software and associated documentation files (the "Software"), to deal

addon/comment/comment.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@
4646

4747
// Rough heuristic to try and detect lines that are part of multi-line string
4848
function probablyInsideString(cm, pos, line) {
49-
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
49+
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
50+
}
51+
52+
function getMode(cm, pos) {
53+
var mode = cm.getMode()
54+
return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
5055
}
5156

5257
CodeMirror.defineExtension("lineComment", function(from, to, options) {
5358
if (!options) options = noOptions;
54-
var self = this, mode = self.getModeAt(from);
59+
var self = this, mode = getMode(self, from);
5560
var firstLine = self.getLine(from.line);
5661
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
5762

@@ -95,7 +100,7 @@
95100

96101
CodeMirror.defineExtension("blockComment", function(from, to, options) {
97102
if (!options) options = noOptions;
98-
var self = this, mode = self.getModeAt(from);
103+
var self = this, mode = getMode(self, from);
99104
var startString = options.blockCommentStart || mode.blockCommentStart;
100105
var endString = options.blockCommentEnd || mode.blockCommentEnd;
101106
if (!startString || !endString) {
@@ -129,7 +134,7 @@
129134

130135
CodeMirror.defineExtension("uncomment", function(from, to, options) {
131136
if (!options) options = noOptions;
132-
var self = this, mode = self.getModeAt(from);
137+
var self = this, mode = getMode(self, from);
133138
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
134139

135140
// Try finding line comments
@@ -171,9 +176,11 @@
171176
endLine = self.getLine(--end);
172177
close = endLine.indexOf(endString);
173178
}
179+
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
174180
if (close == -1 ||
175-
!/comment/.test(self.getTokenTypeAt(Pos(start, open + 1))) ||
176-
!/comment/.test(self.getTokenTypeAt(Pos(end, close + 1))))
181+
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
182+
!/comment/.test(self.getTokenTypeAt(insideEnd)) ||
183+
self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
177184
return false;
178185

179186
// Avoid killing block comments completely outside the selection.

addon/display/panel.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
var height = (options && options.height) || node.offsetHeight;
3939
this._setSize(null, info.heightLeft -= height);
4040
info.panels++;
41+
if (options.stable && isAtTop(this, node))
42+
this.scrollTo(null, this.getScrollInfo().top + height)
43+
4144
return new Panel(this, node, options, height);
4245
});
4346

@@ -54,6 +57,8 @@
5457
this.cleared = true;
5558
var info = this.cm.state.panels;
5659
this.cm._setSize(null, info.heightLeft += this.height);
60+
if (this.options.stable && isAtTop(this.cm, this.node))
61+
this.cm.scrollTo(null, this.cm.getScrollInfo().top - this.height)
5762
info.wrapper.removeChild(this.node);
5863
if (--info.panels == 0) removePanels(this.cm);
5964
};
@@ -109,4 +114,10 @@
109114
cm.setSize = cm._setSize;
110115
cm.setSize();
111116
}
117+
118+
function isAtTop(cm, dom) {
119+
for (var sibling = dom.nextSibling; sibling; sibling = sibling.nextSibling)
120+
if (sibling == cm.getWrapperElement()) return true
121+
return false
122+
}
112123
});

addon/edit/closebrackets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
function getConfig(cm) {
4747
var deflt = cm.state.closeBrackets;
48-
if (!deflt) return null;
48+
if (!deflt || deflt.override) return deflt;
4949
var mode = cm.getModeAt(cm.getCursor());
5050
return mode.closeBrackets || deflt;
5151
}
@@ -185,7 +185,7 @@
185185
function enteringString(cm, pos, ch) {
186186
var line = cm.getLine(pos.line);
187187
var token = cm.getTokenAt(pos);
188-
if (/\bstring2?\b/.test(token.type)) return false;
188+
if (/\bstring2?\b/.test(token.type) || stringStartsAfter(cm, pos)) return false;
189189
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
190190
stream.pos = stream.start = token.start;
191191
for (;;) {

addon/edit/continuelist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
return;
3131
}
3232
if (emptyListRE.test(line)) {
33-
cm.replaceRange("", {
33+
if (!/>\s*$/.test(line)) cm.replaceRange("", {
3434
line: pos.line, ch: 0
3535
}, {
3636
line: pos.line, ch: pos.ch + 1

0 commit comments

Comments
 (0)