mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	promoted and inherited attributes should be shown grouped based on the owning note, #3761
This commit is contained in:
		
							parent
							
								
									6b1f9d3243
								
							
						
					
					
						commit
						cd72ea524e
					
				| @ -706,7 +706,14 @@ class FNote { | ||||
|             }); | ||||
| 
 | ||||
|         // attrs are not resorted if position changes after initial load
 | ||||
|         promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1); | ||||
|         promotedAttrs.sort((a, b) => { | ||||
|             if (a.noteId === b.noteId) { | ||||
|                 return a.position < b.position ? -1 : 1; | ||||
|             } else { | ||||
|                 // inherited promoted attributes should stay grouped: https://github.com/zadam/trilium/issues/3761
 | ||||
|                 return a.noteId < b.noteId ? -1 : 1; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         return promotedAttrs; | ||||
|     } | ||||
|  | ||||
| @ -92,7 +92,18 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget { | ||||
|     } | ||||
| 
 | ||||
|     getInheritedAttributes(note) { | ||||
|         return note.getAttributes().filter(attr => attr.noteId !== this.noteId); | ||||
|         const attrs = note.getAttributes().filter(attr => attr.noteId !== this.noteId); | ||||
| 
 | ||||
|         attrs.sort((a, b) => { | ||||
|             if (a.noteId === b.noteId) { | ||||
|                 return a.position < b.position ? -1 : 1; | ||||
|             } else { | ||||
|                 // inherited attributes should stay grouped: https://github.com/zadam/trilium/issues/3761
 | ||||
|                 return a.noteId < b.noteId ? -1 : 1; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         return attrs; | ||||
|     } | ||||
| 
 | ||||
|     entitiesReloadedEvent({loadResults}) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam