Skip to content

Build your personal knowledge base with Trilium Notes

refactor(code/find): integrate search into find plugin

Elian Doranba2dae4c6127
diff --git a/packages/codemirror/src/find_replace.ts b/packages/codemirror/src/find_replace.ts
index f72c9f1b19..c1f4410a7d 100644
--- a/packages/codemirror/src/find_replace.ts
+++ b/packages/codemirror/src/find_replace.ts
@@ -34,6 +34,7 @@ export class SearchHighlighter {
decoration: searchMatchDecoration,
});
this.updateSearchData(this.view);
+ this.scrollToMatchNearestSelection();
}
updateSearchData(view: EditorView) {
diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts
index 3d3f93477c..64f333d808 100644
--- a/packages/codemirror/src/index.ts
+++ b/packages/codemirror/src/index.ts
@@ -181,9 +181,6 @@ export default class CodeMirror extends EditorView {
await new Promise(requestAnimationFrame);
const instance = this.plugin(plugin);
instance?.searchFor(searchTerm, matchCase, wholeWord);
- if (instance) {
- instance.scrollToMatchNearestSelection();
- }
return {
totalFound: instance?.totalFound ?? 0,