From 0b84524807120ac4107b5dc43a6edaf8cfc4b001 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 8 Sep 2023 00:43:18 +0200 Subject: [PATCH] fix refreshing note actions on note/tab switch, closes #4247 --- src/public/app/widgets/buttons/note_actions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/public/app/widgets/buttons/note_actions.js b/src/public/app/widgets/buttons/note_actions.js index cfdbcc512..a985261ae 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