Skip to content

Build your personal knowledge base with Trilium Notes

add a text replacement feature to the find_widget

SiriusXT2d9376a05c1a
diff --git a/src/public/app/widgets/find_in_text.js b/src/public/app/widgets/find_in_text.js
index 369eb736ae..a3f142d4f5 100644
--- a/src/public/app/widgets/find_in_text.js
+++ b/src/public/app/widgets/find_in_text.js
@@ -105,14 +105,14 @@ export default class FindInText {
}
async replace(replaceText) {
- if (this.editingState.highlightedResult !== null) {
+ if (this.editingState !== undefined && this.editingState.highlightedResult !== null) {
const textEditor = await this.getTextEditor();
textEditor.execute('replace', replaceText, this.editingState.highlightedResult);
}
}
async replaceAll(replaceText) {
- if (this.editingState.results.length > 0) {
+ if (this.editingState !== undefined && this.editingState.results.length > 0) {
const textEditor = await this.getTextEditor();
textEditor.execute('replaceAll', replaceText, this.editingState.results);
}