mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	deactivate some buttons based on note type
This commit is contained in:
		
							parent
							
								
									51dfe8bb14
								
							
						
					
					
						commit
						ee1b377bc2
					
				| @ -25,12 +25,12 @@ const TPL = ` | |||||||
| 
 | 
 | ||||||
|     <div class="dropdown-menu dropdown-menu-right"> |     <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="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="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 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 import-files-button">Import files</a> | ||||||
|         <a class="dropdown-item export-note-button">Export note</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> | ||||||
| </div>`; | </div>`; | ||||||
| 
 | 
 | ||||||
| @ -42,6 +42,8 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { | |||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         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.$showSourceButton = this.$widget.find('.show-source-button'); | ||||||
|         this.$renderNoteButton = this.$widget.find('.render-note-button'); |         this.$renderNoteButton = this.$widget.find('.render-note-button'); | ||||||
| 
 | 
 | ||||||
| @ -63,8 +65,12 @@ export default class NoteActionsWidget extends NoteContextAwareWidget { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     refreshWithNote(note) { |     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.$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.$renderNoteButton.toggle(note.type === 'render'); | ||||||
| 
 | 
 | ||||||
|         this.$openNoteExternallyButton.toggle(utils.isElectron()); |         this.$openNoteExternallyButton.toggle(utils.isElectron()); | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ const TPL = `<div class="note-map-widget" style="position: relative;"> | |||||||
|             top: 10px;  |             top: 10px;  | ||||||
|             right: 10px;  |             right: 10px;  | ||||||
|             background-color: var(--accented-background-color); |             background-color: var(--accented-background-color); | ||||||
|             z-index: 1000; |             z-index: 10; /* should be below dropdown (note actions) */ | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         .map-type-switcher .bx { |         .map-type-switcher .bx { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam