mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fixed triggers to sort children of notes with "sorted" label, closes #1126
This commit is contained in:
		| @@ -164,10 +164,16 @@ async function changeTitle(req) { | |||||||
|         return [400, `Note ${noteId} is not available for change`]; |         return [400, `Note ${noteId} is not available for change`]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     const noteTitleChanged = note.title !== title; | ||||||
|  |  | ||||||
|     note.title = title; |     note.title = title; | ||||||
|  |  | ||||||
|     await note.save(); |     await note.save(); | ||||||
|  |  | ||||||
|  |     if (noteTitleChanged) { | ||||||
|  |         await noteService.triggerNoteTitleChanged(note); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return note; |     return note; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -68,6 +68,9 @@ eventService.subscribe(eventService.ENTITY_CREATED, async ({ entityName, entity | |||||||
|  |  | ||||||
|             await note.setContent(await targetNote.getContent()); |             await note.setContent(await targetNote.getContent()); | ||||||
|         } |         } | ||||||
|  |         else if (entity.type === 'label' && entity.name === 'sorted') { | ||||||
|  |             await treeService.sortNotesAlphabetically(entity.noteId); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     else if (entityName === 'notes') { |     else if (entityName === 'notes') { | ||||||
|         await runAttachedRelations(entity, 'runOnNoteCreation', entity); |         await runAttachedRelations(entity, 'runOnNoteCreation', entity); | ||||||
|   | |||||||
| @@ -778,5 +778,6 @@ module.exports = { | |||||||
|     protectNoteRecursively, |     protectNoteRecursively, | ||||||
|     scanForLinks, |     scanForLinks, | ||||||
|     duplicateNote, |     duplicateNote, | ||||||
|     getUndeletedParentBranches |     getUndeletedParentBranches, | ||||||
|  |     triggerNoteTitleChanged | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user