Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
deactivate some buttons based on note type
zadamee1b377bc28f
diff --git a/src/public/app/widgets/buttons/note_actions.js b/src/public/app/widgets/buttons/note_actions.jsindex 5c62e990c0..87c20d386a 100644--- a/src/public/app/widgets/buttons/note_actions.js+++ b/src/public/app/widgets/buttons/note_actions.js@@ -25,12 +25,12 @@ const TPL = `<div class="dropdown-menu dropdown-menu-right"><a data-trigger-command="renderActiveNote" class="dropdown-item render-note-button"><kbd data-command="renderActiveNote"></kbd> Re-render note</a>- <a data-trigger-command="findInText" class="dropdown-item">Search in note <kbd data-command="findInText"></a>+ <a data-trigger-command="findInText" class="dropdown-item find-in-text-button">Search in note <kbd data-command="findInText"></a><a data-trigger-command="showNoteSource" class="dropdown-item show-source-button"><kbd data-command="showNoteSource"></kbd> Note source</a><a data-trigger-command="openNoteExternally" class="dropdown-item open-note-externally-button"><kbd data-command="openNoteExternally"></kbd> Open note externally</a><a class="dropdown-item import-files-button">Import files</a><a class="dropdown-item export-note-button">Export note</a>- <a data-trigger-command="printActiveNote" class="dropdown-item print-note-button"><kbd data-command="printActiveNote"></kbd> Print note</a>+ <a data-trigger-command="printActiveNote" class="dropdown-item print-active-note-button"><kbd data-command="printActiveNote"></kbd> Print note</a></div></div>`;@@ -42,6 +42,8 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {doRender() {this.$widget = $(TPL);+ this.$findInTextButton = this.$widget.find('.find-in-text-button');+ this.$printActiveNoteButton = this.$widget.find('.print-active-note-button');this.$showSourceButton = this.$widget.find('.show-source-button');this.$renderNoteButton = this.$widget.find('.render-note-button');@@ -63,8 +65,12 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {}refreshWithNote(note) {+ this.toggleDisabled(this.$findInTextButton, ['text', 'code', 'book', 'search'].includes(note.type));+this.toggleDisabled(this.$showSourceButton, ['text', 'relation-map', 'search', 'code'].includes(note.type));+ this.toggleDisabled(this.$printActiveNoteButton, ['text', 'code'].includes(note.type));+this.$renderNoteButton.toggle(note.type === 'render');this.$openNoteExternallyButton.toggle(utils.isElectron());diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.jsindex 3f5d7bbe6b..8e596a9c51 100644--- a/src/public/app/widgets/note_map.js+++ b/src/public/app/widgets/note_map.js@@ -17,7 +17,7 @@ const TPL = `<div class="note-map-widget" style="position: relative;">top: 10px;right: 10px;background-color: var(--accented-background-color);- z-index: 1000;+ z-index: 10; /* should be below dropdown (note actions) */}.map-type-switcher .bx {