Skip to content

Build your personal knowledge base with Trilium Notes

use lazy title loading in bookmarks buttons to have decrypted title upon protected session start, #2393

zadame29aee1aae45
diff --git a/src/public/app/widgets/buttons/button_widget.js b/src/public/app/widgets/buttons/button_widget.js
index 0740aeca8d..d925f23578 100644
--- a/src/public/app/widgets/buttons/button_widget.js
+++ b/src/public/app/widgets/buttons/button_widget.js
@@ -44,7 +44,10 @@ export default class ButtonWidget extends NoteContextAwareWidget {
this.$widget.tooltip({
html: true,
title: () => {
- const title = this.settings.title;
+ const title = typeof this.settings.title === "function"
+ ? this.settings.title()
+ : this.settings.title;
+
const action = actions.find(act => act.actionName === this.settings.command);
if (action && action.effectiveShortcuts.length > 0) {
diff --git a/src/public/app/widgets/buttons/open_note_button_widget.js b/src/public/app/widgets/buttons/open_note_button_widget.js
index 8e68e4ebd1..d1a2063077 100644
--- a/src/public/app/widgets/buttons/open_note_button_widget.js
+++ b/src/public/app/widgets/buttons/open_note_button_widget.js
@@ -18,7 +18,12 @@ export default class OpenNoteButtonWidget extends ButtonWidget {
}
this.icon(note.getIcon());
- this.title(note.title);
+ this.title(() => {
+ const n = froca.getNoteFromCache(noteId);
+
+ // always fresh, always decoded (when protected session is available)
+ return n.title;
+ });
this.refreshIcon();
});