mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	cssClass label cannot be applied on the root widget because of note splits, fixes #3032
This commit is contained in:
		| @@ -1,4 +1,6 @@ | ||||
| import FlexContainer from "./containers/flex_container.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import attributeService from "../services/attributes.js"; | ||||
|  | ||||
| export default class NoteWrapperWidget extends FlexContainer { | ||||
|     constructor() { | ||||
| @@ -33,17 +35,33 @@ export default class NoteWrapperWidget extends FlexContainer { | ||||
|     } | ||||
|  | ||||
|     refresh() { | ||||
|         this.$widget.removeClass(); | ||||
|  | ||||
|         const note = this.noteContext?.note; | ||||
|         if (!note) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         this.$widget.toggleClass("full-content-width", | ||||
|             ['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note?.type) | ||||
|             ['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note.type) | ||||
|             || !!note?.hasLabel('fullContentWidth') | ||||
|         ); | ||||
|  | ||||
|         this.$widget.addClass(note.getCssClass()); | ||||
|  | ||||
|         this.$widget.addClass(utils.getNoteTypeClass(note.type)); | ||||
|         this.$widget.addClass(utils.getMimeTypeClass(note.mime)); | ||||
|  | ||||
|         this.$widget.toggleClass("protected", note.isProtected); | ||||
|     } | ||||
|  | ||||
|     async entitiesReloadedEvent({loadResults}) { | ||||
|         // listening on changes of note.type | ||||
|         if (loadResults.isNoteReloaded(this.noteContext?.noteId)) { | ||||
|         // listening on changes of note.type and CSS class | ||||
|  | ||||
|         const noteId = this.noteContext?.noteId; | ||||
|         if (loadResults.isNoteReloaded(noteId) | ||||
|             || loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) { | ||||
|  | ||||
|             this.refresh(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user