mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
chore(code/find): reimplement replace all
This commit is contained in:
@@ -57,6 +57,18 @@ export class SearchHighlighter {
|
||||
});
|
||||
}
|
||||
|
||||
replaceAll(replacementText: string) {
|
||||
if (!this.parsedMatches.length) return;
|
||||
|
||||
this.view.dispatch({
|
||||
changes: this.parsedMatches.map(change => ({
|
||||
from: change.from,
|
||||
to: change.to,
|
||||
insert: replacementText
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
scrollToMatch(matchIndex: number) {
|
||||
if (this.parsedMatches.length <= matchIndex) {
|
||||
return;
|
||||
|
||||
@@ -198,6 +198,10 @@ export default class CodeMirror extends EditorView {
|
||||
this.searchPlugin?.replaceActiveMatch(replaceText);
|
||||
}
|
||||
|
||||
async replaceAll(replaceText: string) {
|
||||
this.searchPlugin?.replaceAll(replaceText);
|
||||
}
|
||||
|
||||
cleanSearch() {
|
||||
if (this.searchPlugin) {
|
||||
this.dispatch({
|
||||
|
||||
Reference in New Issue
Block a user