mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	show "reset to default icon" button only when there is an explicit icon
This commit is contained in:
		| @@ -142,17 +142,17 @@ export default class NoteIconWidget extends TabAwareWidget { | |||||||
|     async renderDropdown(categoryId, search) { |     async renderDropdown(categoryId, search) { | ||||||
|         this.$iconList.empty(); |         this.$iconList.empty(); | ||||||
|  |  | ||||||
|         this.$iconList.append( |         if (this.getIconLabels().length > 0) { | ||||||
|             $(`<div style="text-align: center">`) |             this.$iconList.append( | ||||||
|                 .append( |                 $(`<div style="text-align: center">`) | ||||||
|                     $('<button class="btn btn-sm">Reset to default icon</button>') |                     .append( | ||||||
|                         .on('click', () => |                         $('<button class="btn btn-sm">Reset to default icon</button>') | ||||||
|                             this.note.getOwnedLabels() |                             .on('click', () => this.getIconLabels() | ||||||
|                                 .filter(label => ['workspaceIconClass', 'iconClass'].includes(label.name)) |  | ||||||
|                                 .forEach(label => attributeService.removeAttributeById(this.noteId, label.attributeId)) |                                 .forEach(label => attributeService.removeAttributeById(this.noteId, label.attributeId)) | ||||||
|                         ) |                             ) | ||||||
|                 ) |                     ) | ||||||
|         ); |             ); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         const {icons} = (await import('./icon_list.js')).default; |         const {icons} = (await import('./icon_list.js')).default; | ||||||
|  |  | ||||||
| @@ -173,6 +173,11 @@ export default class NoteIconWidget extends TabAwareWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     getIconLabels() { | ||||||
|  |         return this.note.getOwnedLabels() | ||||||
|  |             .filter(label => ['workspaceIconClass', 'iconClass'].includes(label.name)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     getIconClass(icon) { |     getIconClass(icon) { | ||||||
|         if (icon.type_of_icon === 'LOGO') { |         if (icon.type_of_icon === 'LOGO') { | ||||||
|             return "bx bxl-" + icon.name; |             return "bx bxl-" + icon.name; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user