@codemirror/search
Advanced tools
Comparing version 0.19.2 to 0.19.3
@@ -0,1 +1,13 @@ | ||
## 0.19.3 (2021-11-22) | ||
### Bug fixes | ||
Add `userEvent` annotations to search and replace transactions. | ||
Make sure the editor handles keys bound to `findNext`/`findPrevious` even when there are no matches, to avoid the browser's search interrupting users. | ||
### New features | ||
Add a `Symbol.iterator` property to the cursor types, so that they can be used with `for`/`of`. | ||
## 0.19.2 (2021-09-16) | ||
@@ -2,0 +14,0 @@ |
@@ -62,2 +62,6 @@ import { Command, KeyBinding } from '@codemirror/view'; | ||
private match; | ||
[Symbol.iterator]: () => Iterator<{ | ||
from: number; | ||
to: number; | ||
}>; | ||
} | ||
@@ -110,2 +114,7 @@ | ||
next(): this; | ||
[Symbol.iterator]: () => Iterator<{ | ||
from: number; | ||
to: number; | ||
match: RegExpExecArray; | ||
}>; | ||
} | ||
@@ -112,0 +121,0 @@ |
@@ -125,2 +125,4 @@ import { EditorView, Decoration, ViewPlugin, runScopeHandlers } from '@codemirror/view'; | ||
} | ||
if (typeof Symbol != "undefined") | ||
SearchCursor.prototype[Symbol.iterator] = function () { return this; }; | ||
@@ -282,2 +284,6 @@ const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec("") }; | ||
} | ||
if (typeof Symbol != "undefined") { | ||
RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = | ||
function () { return this; }; | ||
} | ||
function validRegExp(source) { | ||
@@ -722,3 +728,4 @@ try { | ||
scrollIntoView: true, | ||
effects: announceMatch(view, next) | ||
effects: announceMatch(view, next), | ||
userEvent: "select.search" | ||
}); | ||
@@ -740,3 +747,4 @@ return true; | ||
scrollIntoView: true, | ||
effects: announceMatch(view, range) | ||
effects: announceMatch(view, range), | ||
userEvent: "select.search" | ||
}); | ||
@@ -753,3 +761,4 @@ return true; | ||
view.dispatch({ | ||
selection: EditorSelection.create(ranges.map(r => EditorSelection.range(r.from, r.to))) | ||
selection: EditorSelection.create(ranges.map(r => EditorSelection.range(r.from, r.to))), | ||
userEvent: "select.search.matches" | ||
}); | ||
@@ -774,3 +783,6 @@ return true; | ||
} | ||
dispatch(state.update({ selection: EditorSelection.create(ranges, main) })); | ||
dispatch(state.update({ | ||
selection: EditorSelection.create(ranges, main), | ||
userEvent: "select.search.matches" | ||
})); | ||
return true; | ||
@@ -801,3 +813,4 @@ }; | ||
scrollIntoView: !!selection, | ||
effects: next ? announceMatch(view, next) : undefined | ||
effects: next ? announceMatch(view, next) : undefined, | ||
userEvent: "input.replace" | ||
}); | ||
@@ -819,3 +832,6 @@ return true; | ||
return false; | ||
view.dispatch({ changes }); | ||
view.dispatch({ | ||
changes, | ||
userEvent: "input.replace.all" | ||
}); | ||
return true; | ||
@@ -895,4 +911,4 @@ }); | ||
{ key: "Mod-f", run: openSearchPanel, scope: "editor search-panel" }, | ||
{ key: "F3", run: findNext, shift: findPrevious, scope: "editor search-panel" }, | ||
{ key: "Mod-g", run: findNext, shift: findPrevious, scope: "editor search-panel" }, | ||
{ key: "F3", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true }, | ||
{ key: "Mod-g", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true }, | ||
{ key: "Escape", run: closeSearchPanel, scope: "editor search-panel" }, | ||
@@ -1023,3 +1039,3 @@ { key: "Mod-Shift-l", run: selectSelectionMatches }, | ||
searchState, | ||
/*@__PURE__*/Prec.fallback(searchHighlighter), | ||
/*@__PURE__*/Prec.lowest(searchHighlighter), | ||
baseTheme | ||
@@ -1026,0 +1042,0 @@ ]; |
{ | ||
"name": "@codemirror/search", | ||
"version": "0.19.2", | ||
"version": "0.19.3", | ||
"description": "Search functionality for the CodeMirror code editor", | ||
@@ -31,3 +31,3 @@ "scripts": { | ||
"@codemirror/rangeset": "^0.19.0", | ||
"@codemirror/state": "^0.19.2", | ||
"@codemirror/state": "^0.19.3", | ||
"@codemirror/text": "^0.19.0", | ||
@@ -34,0 +34,0 @@ "@codemirror/view": "^0.19.0", |
Sorry, the diff of this file is not supported yet
92521
2282
Updated@codemirror/state@^0.19.3