@codemirror/autocomplete 6.20.0 → 6.20.1
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/CHANGELOG.md +5 -0
- package/dist/index.cjs +13 -2
- package/dist/index.js +13 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -441,6 +441,7 @@ function defaultPositionInfo(view$1, list, option, info, space, tooltip) {
|
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
const setSelectedEffect = state.StateEffect.define();
|
|
444
445
|
function optionContent(config) {
|
|
445
446
|
let content = config.addToOptions.slice();
|
|
446
447
|
if (config.icons)
|
|
@@ -532,6 +533,16 @@ class CompletionTooltip {
|
|
|
532
533
|
return;
|
|
533
534
|
}
|
|
534
535
|
}
|
|
536
|
+
if (e.target == this.list) {
|
|
537
|
+
let move = this.list.classList.contains("cm-completionListIncompleteTop") &&
|
|
538
|
+
e.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 :
|
|
539
|
+
this.list.classList.contains("cm-completionListIncompleteBottom") &&
|
|
540
|
+
e.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
|
|
541
|
+
if (move != null) {
|
|
542
|
+
view.dispatch({ effects: setSelectedEffect.of(move) });
|
|
543
|
+
e.preventDefault();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
535
546
|
});
|
|
536
547
|
this.dom.addEventListener("focusout", (e) => {
|
|
537
548
|
let state = view.state.field(this.stateField, false);
|
|
@@ -1033,7 +1044,6 @@ function checkValid(validFor, state, from, to) {
|
|
|
1033
1044
|
const setActiveEffect = state.StateEffect.define({
|
|
1034
1045
|
map(sources, mapping) { return sources.map(s => s.map(mapping)); }
|
|
1035
1046
|
});
|
|
1036
|
-
const setSelectedEffect = state.StateEffect.define();
|
|
1037
1047
|
const completionState = state.StateField.define({
|
|
1038
1048
|
create() { return CompletionState.start(); },
|
|
1039
1049
|
update(value, tr) { return value.update(tr); },
|
|
@@ -1767,7 +1777,8 @@ A completion source that will scan the document for words (using a
|
|
|
1767
1777
|
return those as completions.
|
|
1768
1778
|
*/
|
|
1769
1779
|
const completeAnyWord = context => {
|
|
1770
|
-
|
|
1780
|
+
var _a;
|
|
1781
|
+
let wordChars = (_a = context.state.languageDataAt("wordChars", context.pos)[0]) !== null && _a !== void 0 ? _a : "";
|
|
1771
1782
|
let re = wordRE(wordChars);
|
|
1772
1783
|
let token = context.matchBefore(mapRE(re, s => s + "$"));
|
|
1773
1784
|
if (!token && !context.explicit)
|
package/dist/index.js
CHANGED
|
@@ -439,6 +439,7 @@ function defaultPositionInfo(view, list, option, info, space, tooltip) {
|
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
const setSelectedEffect = /*@__PURE__*/StateEffect.define();
|
|
442
443
|
function optionContent(config) {
|
|
443
444
|
let content = config.addToOptions.slice();
|
|
444
445
|
if (config.icons)
|
|
@@ -530,6 +531,16 @@ class CompletionTooltip {
|
|
|
530
531
|
return;
|
|
531
532
|
}
|
|
532
533
|
}
|
|
534
|
+
if (e.target == this.list) {
|
|
535
|
+
let move = this.list.classList.contains("cm-completionListIncompleteTop") &&
|
|
536
|
+
e.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 :
|
|
537
|
+
this.list.classList.contains("cm-completionListIncompleteBottom") &&
|
|
538
|
+
e.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
|
|
539
|
+
if (move != null) {
|
|
540
|
+
view.dispatch({ effects: setSelectedEffect.of(move) });
|
|
541
|
+
e.preventDefault();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
533
544
|
});
|
|
534
545
|
this.dom.addEventListener("focusout", (e) => {
|
|
535
546
|
let state = view.state.field(this.stateField, false);
|
|
@@ -1031,7 +1042,6 @@ function checkValid(validFor, state, from, to) {
|
|
|
1031
1042
|
const setActiveEffect = /*@__PURE__*/StateEffect.define({
|
|
1032
1043
|
map(sources, mapping) { return sources.map(s => s.map(mapping)); }
|
|
1033
1044
|
});
|
|
1034
|
-
const setSelectedEffect = /*@__PURE__*/StateEffect.define();
|
|
1035
1045
|
const completionState = /*@__PURE__*/StateField.define({
|
|
1036
1046
|
create() { return CompletionState.start(); },
|
|
1037
1047
|
update(value, tr) { return value.update(tr); },
|
|
@@ -1765,7 +1775,8 @@ A completion source that will scan the document for words (using a
|
|
|
1765
1775
|
return those as completions.
|
|
1766
1776
|
*/
|
|
1767
1777
|
const completeAnyWord = context => {
|
|
1768
|
-
|
|
1778
|
+
var _a;
|
|
1779
|
+
let wordChars = (_a = context.state.languageDataAt("wordChars", context.pos)[0]) !== null && _a !== void 0 ? _a : "";
|
|
1769
1780
|
let re = wordRE(wordChars);
|
|
1770
1781
|
let token = context.matchBefore(mapRE(re, s => s + "$"));
|
|
1771
1782
|
if (!token && !context.explicit)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemirror/autocomplete",
|
|
3
|
-
"version": "6.20.
|
|
3
|
+
"version": "6.20.1",
|
|
4
4
|
"description": "Autocompletion for the CodeMirror code editor",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "cm-runtests",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/codemirror/autocomplete.git"
|
|
39
|
+
"url": "git+https://github.com/codemirror/autocomplete.git"
|
|
40
40
|
}
|
|
41
41
|
}
|