mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 14:55:50 +01:00
chore(code/find): reimplement single replace
This commit is contained in:
@@ -46,6 +46,17 @@ export class SearchHighlighter {
|
||||
this.#scrollToMatchNearestSelection();
|
||||
}
|
||||
|
||||
replaceActiveMatch(replacementText: string) {
|
||||
if (!this.parsedMatches.length || this.currentFound === 0) return;
|
||||
|
||||
const matchIndex = this.currentFound - 1;
|
||||
const match = this.parsedMatches[matchIndex];
|
||||
|
||||
this.view.dispatch({
|
||||
changes: { from: match.from, to: match.to, insert: replacementText }
|
||||
});
|
||||
}
|
||||
|
||||
scrollToMatch(matchIndex: number) {
|
||||
if (this.parsedMatches.length <= matchIndex) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user