Skip to content

Build your personal knowledge base with Trilium Notes

fix refreshing note actions on note/tab switch, closes #4247

zadam0b8452480712
diff --git a/src/public/app/widgets/buttons/note_actions.js b/src/public/app/widgets/buttons/note_actions.js
index cfdbcc512f..a985261ae5 100644
--- a/src/public/app/widgets/buttons/note_actions.js
+++ b/src/public/app/widgets/buttons/note_actions.js
@@ -55,6 +55,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
+ this.$widget.on('show.bs.dropdown', () => this.refreshVisibility(this.note));
this.$convertNoteIntoAttachmentButton = this.$widget.find("[data-trigger-command='convertNoteIntoAttachment']");
this.$findInTextButton = this.$widget.find('.find-in-text-button');
@@ -92,7 +93,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
});
}
- async refreshWithNote(note) {
+ async refreshVisibility(note) {
this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment());
this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book'].includes(note.type));
@@ -103,11 +104,11 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
this.$renderNoteButton.toggle(note.type === 'render');
- this.toggleDisabled(this.$openNoteExternallyButton, utils.isElectron() && !['search'].includes(note.type));
+ this.toggleDisabled(this.$openNoteExternallyButton, utils.isElectron() && !['search', 'book'].includes(note.type));
this.toggleDisabled(this.$openNoteCustomButton,
utils.isElectron()
&& !utils.isMac() // no implementation for Mac yet
- && !['search'].includes(note.type)
+ && !['search', 'book'].includes(note.type)
);
// I don't want to handle all special notes like this, but intuitively user might want to export content of backend log