@uiw/react-codemirror 4.25.2 → 4.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -28
- package/dist/codemirror.js +170 -32
- package/dist/codemirror.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
<div markdown="1">
|
|
2
2
|
<sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
|
|
3
3
|
<br>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
4
|
+
<a target="_blank" href="https://apps.apple.com/app/Keyzer/6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" width="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
|
|
5
|
+
<a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>
|
|
6
|
+
<a target="_blank" href="https://apps.apple.com/app/VidCrop/6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" width="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
|
|
7
|
+
<a target="_blank" href="https://apps.apple.com/app/Vidwall/6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
|
|
8
|
+
<a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img alt="Mousio Hint" height="52" width="52" src="https://wangchujiang.com/appicon/mousio-hint.png"></a>
|
|
9
|
+
<a target="_blank" href="https://apps.apple.com/app/6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
|
|
10
|
+
<a target="_blank" href="https://apps.apple.com/app/6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" width="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
|
|
11
|
+
<a target="_blank" href="https://apps.apple.com/app/6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" width="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
|
|
12
|
+
<a target="_blank" href="https://apps.apple.com/app/6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" width="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
|
|
13
|
+
<a target="_blank" href="https://apps.apple.com/app/6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" width="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
|
|
14
|
+
<a target="_blank" href="https://apps.apple.com/app/6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" width="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
|
|
15
|
+
<a target="_blank" href="https://apps.apple.com/app/6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" width="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
|
|
16
|
+
<a target="_blank" href="https://apps.apple.com/app/6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" width="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
|
|
17
|
+
<a target="_blank" href="https://apps.apple.com/app/6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" width="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
|
|
18
|
+
<a target="_blank" href="https://apps.apple.com/app/6737160756" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
|
|
19
|
+
<a target="_blank" href="https://apps.apple.com/app/6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
|
|
20
|
+
<a target="_blank" href="https://apps.apple.com/app/6670696072" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
|
|
21
|
+
<a target="_blank" href="https://apps.apple.com/app/6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" width="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
|
|
22
|
+
<a target="_blank" href="https://apps.apple.com/app/6503953628" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" width="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
|
|
23
|
+
<a target="_blank" href="https://apps.apple.com/app/6471227008" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" width="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
|
|
24
|
+
<a target="_blank" href="https://apps.apple.com/app/6479819388" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" width="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
|
|
25
|
+
<a target="_blank" href="https://apps.apple.com/app/6479194014" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" width="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
|
|
26
|
+
<a target="_blank" href="https://apps.apple.com/app/6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" width="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
|
|
27
|
+
<a target="_blank" href="https://apps.apple.com/app/6478511402" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" width="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
|
|
28
|
+
<a target="_blank" href="https://apps.apple.com/app/6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" width="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
|
|
29
|
+
<a target="_blank" href="https://apps.apple.com/app/6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" width="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
|
|
30
|
+
<a target="_blank" href="https://apps.apple.com/app/6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" width="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
|
|
31
|
+
<a target="_blank" href="https://apps.apple.com/app/6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" width="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
|
|
32
|
+
<a target="_blank" href="https://apps.apple.com/app/6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" width="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
|
|
31
33
|
<br><br>
|
|
32
34
|
</div>
|
|
33
35
|
<hr>
|
|
34
36
|
|
|
35
|
-
<p
|
|
37
|
+
<p>
|
|
36
38
|
<a href="https://uiwjs.github.io/react-codemirror/">
|
|
37
39
|
<img alt="react-codemirror logo" src="https://user-images.githubusercontent.com/1680273/177491470-c31a6d7e-f676-4914-a027-2fbeebfeb5b4.svg">
|
|
38
40
|
</a>
|
package/dist/codemirror.js
CHANGED
|
@@ -237,7 +237,7 @@ must be quoted as JSON strings.
|
|
|
237
237
|
For example:
|
|
238
238
|
|
|
239
239
|
```javascript
|
|
240
|
-
parser.
|
|
240
|
+
parser.configure({props: [
|
|
241
241
|
styleTags({
|
|
242
242
|
// Style Number and BigNumber nodes
|
|
243
243
|
"Number BigNumber": tags.number,
|
|
@@ -252,7 +252,7 @@ parser.withProps(
|
|
|
252
252
|
// Style the node named "/" as punctuation
|
|
253
253
|
'"/"': tags.punctuation
|
|
254
254
|
})
|
|
255
|
-
)
|
|
255
|
+
]})
|
|
256
256
|
```
|
|
257
257
|
*/
|
|
258
258
|
function styleTags(spec) {
|
|
@@ -294,7 +294,30 @@ function styleTags(spec) {
|
|
|
294
294
|
}
|
|
295
295
|
return ruleNodeProp.add(byName);
|
|
296
296
|
}
|
|
297
|
-
const ruleNodeProp = new dist/* NodeProp */.uY(
|
|
297
|
+
const ruleNodeProp = new dist/* NodeProp */.uY({
|
|
298
|
+
combine(a, b) {
|
|
299
|
+
let cur, root, take;
|
|
300
|
+
while (a || b) {
|
|
301
|
+
if (!a || b && a.depth >= b.depth) {
|
|
302
|
+
take = b;
|
|
303
|
+
b = b.next;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
take = a;
|
|
307
|
+
a = a.next;
|
|
308
|
+
}
|
|
309
|
+
if (cur && cur.mode == take.mode && !take.context && !cur.context)
|
|
310
|
+
continue;
|
|
311
|
+
let copy = new Rule(take.tags, take.mode, take.context);
|
|
312
|
+
if (cur)
|
|
313
|
+
cur.next = copy;
|
|
314
|
+
else
|
|
315
|
+
root = copy;
|
|
316
|
+
cur = copy;
|
|
317
|
+
}
|
|
318
|
+
return root;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
298
321
|
class Rule {
|
|
299
322
|
constructor(tags, mode, context, next) {
|
|
300
323
|
this.tags = tags;
|
|
@@ -3867,6 +3890,7 @@ class NodeProp {
|
|
|
3867
3890
|
this.deserialize = config.deserialize || (() => {
|
|
3868
3891
|
throw new Error("This node type doesn't define a deserialize function");
|
|
3869
3892
|
});
|
|
3893
|
+
this.combine = config.combine || null;
|
|
3870
3894
|
}
|
|
3871
3895
|
/**
|
|
3872
3896
|
This is meant to be used with
|
|
@@ -4131,7 +4155,10 @@ class NodeSet {
|
|
|
4131
4155
|
if (add) {
|
|
4132
4156
|
if (!newProps)
|
|
4133
4157
|
newProps = Object.assign({}, type.props);
|
|
4134
|
-
|
|
4158
|
+
let value = add[1], prop = add[0];
|
|
4159
|
+
if (prop.combine && prop.id in newProps)
|
|
4160
|
+
value = prop.combine(newProps[prop.id], value);
|
|
4161
|
+
newProps[prop.id] = value;
|
|
4135
4162
|
}
|
|
4136
4163
|
}
|
|
4137
4164
|
newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type);
|
|
@@ -5114,7 +5141,7 @@ function buildTree(data) {
|
|
|
5114
5141
|
function takeNode(parentStart, minPos, children, positions, inRepeat, depth) {
|
|
5115
5142
|
let { id, start, end, size } = cursor;
|
|
5116
5143
|
let lookAheadAtStart = lookAhead, contextAtStart = contextHash;
|
|
5117
|
-
|
|
5144
|
+
if (size < 0) {
|
|
5118
5145
|
cursor.next();
|
|
5119
5146
|
if (size == -1 /* SpecialRecord.Reuse */) {
|
|
5120
5147
|
let node = reused[id];
|
|
@@ -5719,8 +5746,15 @@ class MixedParse {
|
|
|
5719
5746
|
}
|
|
5720
5747
|
else if (!cursor.type.isAnonymous && (nest = this.nest(cursor, this.input)) &&
|
|
5721
5748
|
(cursor.from < cursor.to || !nest.overlay)) {
|
|
5722
|
-
if (!cursor.tree)
|
|
5749
|
+
if (!cursor.tree) {
|
|
5723
5750
|
materialize(cursor);
|
|
5751
|
+
// materialize create one more level of nesting
|
|
5752
|
+
// we need to add depth to active overlay for going backwards
|
|
5753
|
+
if (overlay)
|
|
5754
|
+
overlay.depth++;
|
|
5755
|
+
if (covered)
|
|
5756
|
+
covered.depth++;
|
|
5757
|
+
}
|
|
5724
5758
|
let oldMounts = fragmentCursor.findMounts(cursor.from, nest.parser);
|
|
5725
5759
|
if (typeof nest.overlay == "function") {
|
|
5726
5760
|
overlay = new ActiveOverlay(nest.parser, nest.overlay, oldMounts, this.inner.length, cursor.from, cursor.tree, overlay);
|
|
@@ -8198,7 +8232,8 @@ class CompletionTooltip {
|
|
|
8198
8232
|
this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);
|
|
8199
8233
|
this.showOptions(open.options, cState.id);
|
|
8200
8234
|
}
|
|
8201
|
-
|
|
8235
|
+
let newSel = this.updateSelectedOption(open.selected);
|
|
8236
|
+
if (newSel) {
|
|
8202
8237
|
this.destroyInfo();
|
|
8203
8238
|
let { completion } = open.options[open.selected];
|
|
8204
8239
|
let { info } = completion;
|
|
@@ -8215,6 +8250,7 @@ class CompletionTooltip {
|
|
|
8215
8250
|
}
|
|
8216
8251
|
else {
|
|
8217
8252
|
this.addInfoPane(infoResult, completion);
|
|
8253
|
+
newSel.setAttribute("aria-describedby", this.info.id);
|
|
8218
8254
|
}
|
|
8219
8255
|
}
|
|
8220
8256
|
}
|
|
@@ -8222,6 +8258,7 @@ class CompletionTooltip {
|
|
|
8222
8258
|
this.destroyInfo();
|
|
8223
8259
|
let wrap = this.info = document.createElement("div");
|
|
8224
8260
|
wrap.className = "cm-tooltip cm-completionInfo";
|
|
8261
|
+
wrap.id = "cm-completionInfo-" + Math.floor(Math.random() * 0xffff).toString(16);
|
|
8225
8262
|
if (content.nodeType != null) {
|
|
8226
8263
|
wrap.appendChild(content);
|
|
8227
8264
|
this.infoDestroy = null;
|
|
@@ -8247,8 +8284,10 @@ class CompletionTooltip {
|
|
|
8247
8284
|
}
|
|
8248
8285
|
}
|
|
8249
8286
|
else {
|
|
8250
|
-
if (opt.hasAttribute("aria-selected"))
|
|
8287
|
+
if (opt.hasAttribute("aria-selected")) {
|
|
8251
8288
|
opt.removeAttribute("aria-selected");
|
|
8289
|
+
opt.removeAttribute("aria-describedby");
|
|
8290
|
+
}
|
|
8252
8291
|
}
|
|
8253
8292
|
}
|
|
8254
8293
|
if (set)
|
|
@@ -8362,7 +8401,7 @@ function score(option) {
|
|
|
8362
8401
|
}
|
|
8363
8402
|
function sortOptions(active, state) {
|
|
8364
8403
|
let options = [];
|
|
8365
|
-
let sections = null;
|
|
8404
|
+
let sections = null, dynamicSectionScore = null;
|
|
8366
8405
|
let addOption = (option) => {
|
|
8367
8406
|
options.push(option);
|
|
8368
8407
|
let { section } = option.completion;
|
|
@@ -8389,13 +8428,24 @@ function sortOptions(active, state) {
|
|
|
8389
8428
|
for (let option of a.result.options)
|
|
8390
8429
|
if (match = matcher.match(option.label)) {
|
|
8391
8430
|
let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];
|
|
8392
|
-
|
|
8431
|
+
let score = match.score + (option.boost || 0);
|
|
8432
|
+
addOption(new Option(option, a.source, matched, score));
|
|
8433
|
+
if (typeof option.section == "object" && option.section.rank === "dynamic") {
|
|
8434
|
+
let { name } = option.section;
|
|
8435
|
+
if (!dynamicSectionScore)
|
|
8436
|
+
dynamicSectionScore = Object.create(null);
|
|
8437
|
+
dynamicSectionScore[name] = Math.max(score, dynamicSectionScore[name] || -1e9);
|
|
8438
|
+
}
|
|
8393
8439
|
}
|
|
8394
8440
|
}
|
|
8395
8441
|
}
|
|
8396
8442
|
if (sections) {
|
|
8397
8443
|
let sectionOrder = Object.create(null), pos = 0;
|
|
8398
|
-
let cmp = (a, b) => {
|
|
8444
|
+
let cmp = (a, b) => {
|
|
8445
|
+
return (a.rank === "dynamic" && b.rank === "dynamic" ? dynamicSectionScore[b.name] - dynamicSectionScore[a.name] : 0) ||
|
|
8446
|
+
(typeof a.rank == "number" ? a.rank : 1e9) - (typeof b.rank == "number" ? b.rank : 1e9) ||
|
|
8447
|
+
(a.name < b.name ? -1 : 1);
|
|
8448
|
+
};
|
|
8399
8449
|
for (let s of sections.sort(cmp)) {
|
|
8400
8450
|
pos -= 1e5;
|
|
8401
8451
|
sectionOrder[s.name] = pos;
|
|
@@ -9727,6 +9777,7 @@ class LintState {
|
|
|
9727
9777
|
diagnostics = diagnosticFilter(diagnostics, state);
|
|
9728
9778
|
let sorted = diagnostics.slice().sort((a, b) => a.from - b.from || a.to - b.to);
|
|
9729
9779
|
let deco = new state_.RangeSetBuilder(), active = [], pos = 0;
|
|
9780
|
+
let scan = state.doc.iter(), scanPos = 0, docLen = state.doc.length;
|
|
9730
9781
|
for (let i = 0;;) {
|
|
9731
9782
|
let next = i == sorted.length ? null : sorted[i];
|
|
9732
9783
|
if (!next && !active.length)
|
|
@@ -9738,6 +9789,8 @@ class LintState {
|
|
|
9738
9789
|
}
|
|
9739
9790
|
else {
|
|
9740
9791
|
from = next.from;
|
|
9792
|
+
if (from > docLen)
|
|
9793
|
+
break;
|
|
9741
9794
|
to = next.to;
|
|
9742
9795
|
active.push(next);
|
|
9743
9796
|
i++;
|
|
@@ -9754,8 +9807,31 @@ class LintState {
|
|
|
9754
9807
|
break;
|
|
9755
9808
|
}
|
|
9756
9809
|
}
|
|
9810
|
+
to = Math.min(to, docLen);
|
|
9811
|
+
let widget = false;
|
|
9812
|
+
if (active.some(d => d.from == from && (d.to == to || to == docLen))) {
|
|
9813
|
+
widget = from == to;
|
|
9814
|
+
if (!widget && to - from < 10) {
|
|
9815
|
+
let behind = from - (scanPos + scan.value.length);
|
|
9816
|
+
if (behind > 0) {
|
|
9817
|
+
scan.next(behind);
|
|
9818
|
+
scanPos = from;
|
|
9819
|
+
}
|
|
9820
|
+
for (let check = from;;) {
|
|
9821
|
+
if (check >= to) {
|
|
9822
|
+
widget = true;
|
|
9823
|
+
break;
|
|
9824
|
+
}
|
|
9825
|
+
if (!scan.lineBreak && scanPos + scan.value.length > check)
|
|
9826
|
+
break;
|
|
9827
|
+
check = scanPos + scan.value.length;
|
|
9828
|
+
scanPos += scan.value.length;
|
|
9829
|
+
scan.next();
|
|
9830
|
+
}
|
|
9831
|
+
}
|
|
9832
|
+
}
|
|
9757
9833
|
let sev = maxSeverity(active);
|
|
9758
|
-
if (
|
|
9834
|
+
if (widget) {
|
|
9759
9835
|
deco.add(from, from, view_.Decoration.widget({
|
|
9760
9836
|
widget: new DiagnosticWidget(sev),
|
|
9761
9837
|
diagnostics: active.slice()
|
|
@@ -9770,6 +9846,8 @@ class LintState {
|
|
|
9770
9846
|
}));
|
|
9771
9847
|
}
|
|
9772
9848
|
pos = to;
|
|
9849
|
+
if (pos == docLen)
|
|
9850
|
+
break;
|
|
9773
9851
|
for (let i = 0; i < active.length; i++)
|
|
9774
9852
|
if (active[i].to <= pos)
|
|
9775
9853
|
active.splice(i--, 1);
|
|
@@ -10022,22 +10100,36 @@ function batchResults(promises, sink, error) {
|
|
|
10022
10100
|
}
|
|
10023
10101
|
const lintConfig = /*@__PURE__*/state_.Facet.define({
|
|
10024
10102
|
combine(input) {
|
|
10025
|
-
return
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10103
|
+
return {
|
|
10104
|
+
sources: input.map(i => i.source).filter(x => x != null),
|
|
10105
|
+
...(0,state_.combineConfig)(input.map(i => i.config), {
|
|
10106
|
+
delay: 750,
|
|
10107
|
+
markerFilter: null,
|
|
10108
|
+
tooltipFilter: null,
|
|
10109
|
+
needsRefresh: null,
|
|
10110
|
+
hideOn: () => null,
|
|
10111
|
+
}, {
|
|
10112
|
+
delay: Math.max,
|
|
10113
|
+
markerFilter: combineFilter,
|
|
10114
|
+
tooltipFilter: combineFilter,
|
|
10115
|
+
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u),
|
|
10116
|
+
hideOn: (a, b) => !a ? b : !b ? a : (t, x, y) => a(t, x, y) || b(t, x, y),
|
|
10117
|
+
autoPanel: (a, b) => a || b
|
|
10118
|
+
})
|
|
10119
|
+
};
|
|
10034
10120
|
}
|
|
10035
10121
|
});
|
|
10122
|
+
function combineFilter(a, b) {
|
|
10123
|
+
return !a ? b : !b ? a : (d, s) => b(a(d, s), s);
|
|
10124
|
+
}
|
|
10036
10125
|
/**
|
|
10037
10126
|
Given a diagnostic source, this function returns an extension that
|
|
10038
10127
|
enables linting with that source. It will be called whenever the
|
|
10039
|
-
editor is idle (after its content changed).
|
|
10040
|
-
|
|
10128
|
+
editor is idle (after its content changed).
|
|
10129
|
+
|
|
10130
|
+
Note that settings given here will apply to all linters active in
|
|
10131
|
+
the editor. If `null` is given as source, this only configures the
|
|
10132
|
+
lint extension.
|
|
10041
10133
|
*/
|
|
10042
10134
|
function linter(source, config = {}) {
|
|
10043
10135
|
return [
|
|
@@ -10087,9 +10179,10 @@ function renderDiagnostic(view, diagnostic, inPanel) {
|
|
|
10087
10179
|
let nameElt = keyIndex < 0 ? name : [name.slice(0, keyIndex),
|
|
10088
10180
|
crelt("u", name.slice(keyIndex, keyIndex + 1)),
|
|
10089
10181
|
name.slice(keyIndex + 1)];
|
|
10182
|
+
let markClass = action.markClass ? " " + action.markClass : "";
|
|
10090
10183
|
return crelt("button", {
|
|
10091
10184
|
type: "button",
|
|
10092
|
-
class: "cm-diagnosticAction",
|
|
10185
|
+
class: "cm-diagnosticAction" + markClass,
|
|
10093
10186
|
onclick: click,
|
|
10094
10187
|
onmousedown: click,
|
|
10095
10188
|
"aria-label": ` Action: ${name}${keyIndex < 0 ? "" : ` (access key "${keys[i]})"`}.`
|
|
@@ -10512,7 +10605,7 @@ const lintGutterTooltip = /*@__PURE__*/state_.StateField.define({
|
|
|
10512
10605
|
create() { return null; },
|
|
10513
10606
|
update(tooltip, tr) {
|
|
10514
10607
|
if (tooltip && tr.docChanged)
|
|
10515
|
-
tooltip = hideTooltip(tr, tooltip) ? null :
|
|
10608
|
+
tooltip = hideTooltip(tr, tooltip) ? null : { ...tooltip, pos: tr.changes.mapPos(tooltip.pos) };
|
|
10516
10609
|
return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip);
|
|
10517
10610
|
},
|
|
10518
10611
|
provide: field => view_.showTooltip.from(field)
|
|
@@ -10742,7 +10835,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__708__;
|
|
|
10742
10835
|
/* harmony export */ cL: () => (/* binding */ historyKeymap),
|
|
10743
10836
|
/* harmony export */ pw: () => (/* binding */ defaultKeymap)
|
|
10744
10837
|
/* harmony export */ });
|
|
10745
|
-
/* unused harmony exports blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection */
|
|
10838
|
+
/* unused harmony exports addCursorAbove, addCursorBelow, blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteGroupForwardWin, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection */
|
|
10746
10839
|
/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60);
|
|
10747
10840
|
/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(730);
|
|
10748
10841
|
/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(194);
|
|
@@ -11836,6 +11929,41 @@ const selectParentSyntax = ({ state, dispatch }) => {
|
|
|
11836
11929
|
dispatch(setSel(state, selection));
|
|
11837
11930
|
return true;
|
|
11838
11931
|
};
|
|
11932
|
+
function addCursorVertically(view, forward) {
|
|
11933
|
+
let { state } = view, sel = state.selection, ranges = state.selection.ranges.slice();
|
|
11934
|
+
for (let range of state.selection.ranges) {
|
|
11935
|
+
let line = state.doc.lineAt(range.head);
|
|
11936
|
+
if (forward ? line.to < view.state.doc.length : line.from > 0)
|
|
11937
|
+
for (let cur = range;;) {
|
|
11938
|
+
let next = view.moveVertically(cur, forward);
|
|
11939
|
+
if (next.head < line.from || next.head > line.to) {
|
|
11940
|
+
if (!ranges.some(r => r.head == next.head))
|
|
11941
|
+
ranges.push(next);
|
|
11942
|
+
break;
|
|
11943
|
+
}
|
|
11944
|
+
else if (next.head == cur.head) {
|
|
11945
|
+
break;
|
|
11946
|
+
}
|
|
11947
|
+
else {
|
|
11948
|
+
cur = next;
|
|
11949
|
+
}
|
|
11950
|
+
}
|
|
11951
|
+
}
|
|
11952
|
+
if (ranges.length == sel.ranges.length)
|
|
11953
|
+
return false;
|
|
11954
|
+
view.dispatch(setSel(state, _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.create(ranges, ranges.length - 1)));
|
|
11955
|
+
return true;
|
|
11956
|
+
}
|
|
11957
|
+
/**
|
|
11958
|
+
Expand the selection by adding a cursor above the heads of
|
|
11959
|
+
currently selected ranges.
|
|
11960
|
+
*/
|
|
11961
|
+
const addCursorAbove = view => addCursorVertically(view, false);
|
|
11962
|
+
/**
|
|
11963
|
+
Expand the selection by adding a cursor below the heads of
|
|
11964
|
+
currently selected ranges.
|
|
11965
|
+
*/
|
|
11966
|
+
const addCursorBelow = view => addCursorVertically(view, true);
|
|
11839
11967
|
/**
|
|
11840
11968
|
Simplify the current selection. When multiple ranges are selected,
|
|
11841
11969
|
reduce it to its main range. Otherwise, if the selection is
|
|
@@ -11961,6 +12089,12 @@ Delete the selection or forward until the end of the next group.
|
|
|
11961
12089
|
*/
|
|
11962
12090
|
const deleteGroupForward = target => deleteByGroup(target, true);
|
|
11963
12091
|
/**
|
|
12092
|
+
Variant of [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)
|
|
12093
|
+
that uses the Windows convention of also deleting the whitespace
|
|
12094
|
+
after a word.
|
|
12095
|
+
*/
|
|
12096
|
+
const deleteGroupForwardWin = view => deleteBy(view, range => view.moveByChar(range, true, start => toGroupStart(view, range.head, start)).head);
|
|
12097
|
+
/**
|
|
11964
12098
|
Delete the selection, or, if it is a cursor selection, delete to
|
|
11965
12099
|
the end of the line. If the cursor is directly at the end of the
|
|
11966
12100
|
line, delete the line break after it.
|
|
@@ -12429,12 +12563,12 @@ const standardKeymap = /*@__PURE__*/[
|
|
|
12429
12563
|
{ key: "Mod-End", run: cursorDocEnd, shift: selectDocEnd },
|
|
12430
12564
|
{ key: "Enter", run: insertNewlineAndIndent, shift: insertNewlineAndIndent },
|
|
12431
12565
|
{ key: "Mod-a", run: selectAll },
|
|
12432
|
-
{ key: "Backspace", run: deleteCharBackward, shift: deleteCharBackward },
|
|
12433
|
-
{ key: "Delete", run: deleteCharForward },
|
|
12434
|
-
{ key: "Mod-Backspace", mac: "Alt-Backspace", run: deleteGroupBackward },
|
|
12435
|
-
{ key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward },
|
|
12436
|
-
{ mac: "Mod-Backspace", run: deleteLineBoundaryBackward },
|
|
12437
|
-
{ mac: "Mod-Delete", run: deleteLineBoundaryForward }
|
|
12566
|
+
{ key: "Backspace", run: deleteCharBackward, shift: deleteCharBackward, preventDefault: true },
|
|
12567
|
+
{ key: "Delete", run: deleteCharForward, preventDefault: true },
|
|
12568
|
+
{ key: "Mod-Backspace", mac: "Alt-Backspace", run: deleteGroupBackward, preventDefault: true },
|
|
12569
|
+
{ key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward, preventDefault: true },
|
|
12570
|
+
{ mac: "Mod-Backspace", run: deleteLineBoundaryBackward, preventDefault: true },
|
|
12571
|
+
{ mac: "Mod-Delete", run: deleteLineBoundaryForward, preventDefault: true }
|
|
12438
12572
|
].concat(/*@__PURE__*/emacsStyleKeymap.map(b => ({ mac: b.key, run: b.run, shift: b.shift })));
|
|
12439
12573
|
/**
|
|
12440
12574
|
The default keymap. Includes all bindings from
|
|
@@ -12446,6 +12580,8 @@ The default keymap. Includes all bindings from
|
|
|
12446
12580
|
- Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)
|
|
12447
12581
|
- Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)
|
|
12448
12582
|
- Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)
|
|
12583
|
+
- Ctrl-Alt-ArrowUp (Cmd-Alt-ArrowUp on macOS): [`addCursorAbove`](https://codemirror.net/6/docs/ref/#commands.addCursorAbove).
|
|
12584
|
+
- Ctrl-Alt-ArrowDown (Cmd-Alt-ArrowDown on macOS): [`addCursorBelow`](https://codemirror.net/6/docs/ref/#commands.addCursorBelow).
|
|
12449
12585
|
- Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)
|
|
12450
12586
|
- Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
|
|
12451
12587
|
- Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)
|
|
@@ -12466,6 +12602,8 @@ const defaultKeymap = /*@__PURE__*/[
|
|
|
12466
12602
|
{ key: "Shift-Alt-ArrowUp", run: copyLineUp },
|
|
12467
12603
|
{ key: "Alt-ArrowDown", run: moveLineDown },
|
|
12468
12604
|
{ key: "Shift-Alt-ArrowDown", run: copyLineDown },
|
|
12605
|
+
{ key: "Mod-Alt-ArrowUp", run: addCursorAbove },
|
|
12606
|
+
{ key: "Mod-Alt-ArrowDown", run: addCursorBelow },
|
|
12469
12607
|
{ key: "Escape", run: simplifySelection },
|
|
12470
12608
|
{ key: "Mod-Enter", run: insertBlankLine },
|
|
12471
12609
|
{ key: "Alt-l", mac: "Ctrl-l", run: selectLine },
|