@codemirror/autocomplete
Advanced tools
Comparing version 0.17.3 to 0.17.4
@@ -0,1 +1,11 @@ | ||
## 0.17.4 (2021-01-18) | ||
### Bug fixes | ||
Fix a styling issue where the selection had become invisible inside snippet fields (when using `drawSelection`). | ||
### New features | ||
Snippet fields can now be selected with the pointing device (so that they are usable on touch devices). | ||
## 0.17.3 (2021-01-18) | ||
@@ -2,0 +12,0 @@ |
@@ -308,4 +308,4 @@ import { showTooltip, tooltips } from '@codemirror/tooltip'; | ||
"$tooltip.completionInfo.right": { left: "100%" }, | ||
"$$light $snippetField": { backgroundColor: "#ddd" }, | ||
"$$dark $snippetField": { backgroundColor: "#333" }, | ||
"$$light $snippetField": { backgroundColor: "#00000022" }, | ||
"$$dark $snippetField": { backgroundColor: "#ffffff22" }, | ||
"$snippetFieldPosition": { | ||
@@ -1084,3 +1084,3 @@ verticalAlign: "text-top", | ||
if (editor.state.field(snippetState, false) === undefined) | ||
spec.reconfigure = { append: [snippetState, addSnippetKeymap, baseTheme] }; | ||
spec.reconfigure = { append: [snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme] }; | ||
} | ||
@@ -1134,2 +1134,17 @@ editor.dispatch(editor.state.update(spec)); | ||
} | ||
const snippetPointerHandler = EditorView.domEventHandlers({ | ||
mousedown(event, view) { | ||
let active = view.state.field(snippetState, false), pos; | ||
if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null) | ||
return false; | ||
let match = active.ranges.find(r => r.from <= pos && r.to >= pos); | ||
if (!match || match.field == active.active) | ||
return false; | ||
view.dispatch({ | ||
selection: fieldSelection(active.ranges, match.field), | ||
effects: setActive.of(active.ranges.some(r => r.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null) | ||
}); | ||
return true; | ||
} | ||
}); | ||
@@ -1136,0 +1151,0 @@ /// A completion source that will scan the document for words (using a |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "0.17.3", | ||
"version": "0.17.4", | ||
"description": "Autocompletion for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
223689
2544