@codemirror/search
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -0,1 +1,13 @@ | ||
## 0.19.1 (2021-09-06) | ||
### Bug fixes | ||
Make `highlightSelectionMatches` not produce overlapping decorations, since those tend to just get unreadable. | ||
Make sure any existing search text is selected when opening the search panel. Add search config option to not match case when search panel is opened (#4) | ||
### New features | ||
The `searchConfig` function now takes a `matchCase` option that controls whether the search panel starts in case-sensitive mode. | ||
## 0.19.0 (2021-08-11) | ||
@@ -2,0 +14,0 @@ |
@@ -161,2 +161,7 @@ import { Command, KeyBinding } from '@codemirror/view'; | ||
top?: boolean; | ||
/** | ||
Whether to match case by default when the search panel is activated | ||
(the default is true) | ||
*/ | ||
matchCase?: boolean; | ||
} | ||
@@ -163,0 +168,0 @@ /** |
@@ -443,3 +443,3 @@ import { EditorView, Decoration, ViewPlugin, runScopeHandlers } from '@codemirror/view'; | ||
let cursor = new SearchCursor(state.doc, query, part.from, part.to); | ||
while (!cursor.nextOverlapping().done) { | ||
while (!cursor.next().done) { | ||
let { from, to } = cursor.value; | ||
@@ -512,3 +512,7 @@ if (!check || ((from == 0 || check(state.sliceDoc(from - 1, from)) != CharCategory.Word) && | ||
combine(configs) { | ||
return { top: configs.some(c => c.top) }; | ||
let matchCase = configs.some(c => c.matchCase); | ||
return { | ||
top: configs.some(c => c.top), | ||
matchCase: matchCase === undefined ? true : matchCase, | ||
}; | ||
} | ||
@@ -819,5 +823,7 @@ }); | ||
function defaultQuery(state, fallback) { | ||
var _a; | ||
let sel = state.selection.main; | ||
let selText = sel.empty || sel.to > sel.from + 100 ? "" : state.sliceDoc(sel.from, sel.to); | ||
return fallback && !selText ? fallback : new StringQuery(selText.replace(/\n/g, "\\n"), "", (fallback === null || fallback === void 0 ? void 0 : fallback.caseInsensitive) || false); | ||
let caseInsensitive = (_a = fallback === null || fallback === void 0 ? void 0 : fallback.caseInsensitive) !== null && _a !== void 0 ? _a : !state.facet(searchConfigFacet).matchCase; | ||
return fallback && !selText ? fallback : new StringQuery(selText.replace(/\n/g, "\\n"), "", caseInsensitive); | ||
} | ||
@@ -833,3 +839,5 @@ /** | ||
return false; | ||
panel.dom.querySelector("[name=search]").focus(); | ||
let searchInput = panel.dom.querySelector("[name=search]"); | ||
searchInput.focus(); | ||
searchInput.select(); | ||
} | ||
@@ -836,0 +844,0 @@ else { |
{ | ||
"name": "@codemirror/search", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"description": "Search functionality for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
89321
2211