mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	more relation events, events are now not triggered on sync changes
This commit is contained in:
		| @@ -35,6 +35,10 @@ async function getNewNotePosition(parentNoteId, noteData) { | ||||
|     return newNotePos; | ||||
| } | ||||
|  | ||||
| async function triggerChildNoteCreated(childNote, parentNote) { | ||||
|     await eventService.emit(eventService.CHILD_NOTE_CREATED, { childNote, parentNote }); | ||||
| } | ||||
|  | ||||
| async function triggerNoteTitleChanged(note) { | ||||
|     await eventService.emit(eventService.NOTE_TITLE_CHANGED, note); | ||||
| } | ||||
| @@ -42,12 +46,10 @@ async function triggerNoteTitleChanged(note) { | ||||
| async function createNewNote(parentNoteId, noteData) { | ||||
|     const newNotePos = await getNewNotePosition(parentNoteId, noteData); | ||||
|  | ||||
|     if (parentNoteId !== 'root') { | ||||
|         const parent = await repository.getNote(parentNoteId); | ||||
|     const parentNote = await repository.getNote(parentNoteId); | ||||
|  | ||||
|         noteData.type = noteData.type || parent.type; | ||||
|         noteData.mime = noteData.mime || parent.mime; | ||||
|     } | ||||
|     noteData.type = noteData.type || parentNote.type; | ||||
|     noteData.mime = noteData.mime || parentNote.mime; | ||||
|  | ||||
|     const note = await new Note({ | ||||
|         title: noteData.title, | ||||
| @@ -66,6 +68,7 @@ async function createNewNote(parentNoteId, noteData) { | ||||
|     }).save(); | ||||
|  | ||||
|     await triggerNoteTitleChanged(note); | ||||
|     await triggerChildNoteCreated(note, parentNote); | ||||
|  | ||||
|     return { | ||||
|         note, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user