mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-13 20:42:29 +08:00
add a text replacement feature to the find_widget
This commit is contained in:
parent
ce40c74e83
commit
2d9376a05c
@ -105,14 +105,14 @@ export default class FindInText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async replace(replaceText) {
|
async replace(replaceText) {
|
||||||
if (this.editingState.highlightedResult !== null) {
|
if (this.editingState !== undefined && this.editingState.highlightedResult !== null) {
|
||||||
const textEditor = await this.getTextEditor();
|
const textEditor = await this.getTextEditor();
|
||||||
textEditor.execute('replace', replaceText, this.editingState.highlightedResult);
|
textEditor.execute('replace', replaceText, this.editingState.highlightedResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async replaceAll(replaceText) {
|
async replaceAll(replaceText) {
|
||||||
if (this.editingState.results.length > 0) {
|
if (this.editingState !== undefined && this.editingState.results.length > 0) {
|
||||||
const textEditor = await this.getTextEditor();
|
const textEditor = await this.getTextEditor();
|
||||||
textEditor.execute('replaceAll', replaceText, this.editingState.results);
|
textEditor.execute('replaceAll', replaceText, this.editingState.results);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user