mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	fix runOnNoteContentChange event
This commit is contained in:
		
							parent
							
								
									78d83b8826
								
							
						
					
					
						commit
						35338e9ec6
					
				| @ -9,6 +9,7 @@ const ENTITY_DELETED = "ENTITY_DELETED"; | ||||
| const ENTITY_CHANGE_SYNCED = "ENTITY_CHANGE_SYNCED"; | ||||
| const ENTITY_DELETE_SYNCED = "ENTITY_DELETE_SYNCED"; | ||||
| const CHILD_NOTE_CREATED = "CHILD_NOTE_CREATED"; | ||||
| const NOTE_CONTENT_CHANGE = "NOTE_CONTENT_CHANGED"; | ||||
| 
 | ||||
| const eventListeners = {}; | ||||
| 
 | ||||
| @ -69,5 +70,6 @@ module.exports = { | ||||
|     ENTITY_DELETED, | ||||
|     ENTITY_CHANGE_SYNCED, | ||||
|     ENTITY_DELETE_SYNCED, | ||||
|     CHILD_NOTE_CREATED | ||||
|     CHILD_NOTE_CREATED, | ||||
|     NOTE_CONTENT_CHANGE | ||||
| }; | ||||
|  | ||||
| @ -59,9 +59,7 @@ eventService.subscribe([ eventService.ENTITY_CHANGED, eventService.ENTITY_DELETE | ||||
| }); | ||||
| 
 | ||||
| eventService.subscribe(eventService.ENTITY_CHANGED, ({entityName, entity}) => { | ||||
|     if (entityName === 'note_contents') { // FIXME
 | ||||
|         runAttachedRelations(entity, 'runOnNoteContentChange', entity); | ||||
|     } else if (entityName === 'branches') { | ||||
|     if (entityName === 'branches') { | ||||
|         const parentNote = becca.getNote(entity.parentNoteId); | ||||
| 
 | ||||
|         if (parentNote?.hasLabel("sorted")) { | ||||
| @ -70,6 +68,10 @@ eventService.subscribe(eventService.ENTITY_CHANGED, ({entityName, entity}) => { | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| eventService.subscribe(eventService.NOTE_CONTENT_CHANGE, ({entity}) => { | ||||
|     runAttachedRelations(entity, 'runOnNoteContentChange', entity); | ||||
| }); | ||||
| 
 | ||||
| eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) => { | ||||
|     if (entityName === 'attributes') { | ||||
|         runAttachedRelations(entity.getNote(), 'runOnAttributeCreation', entity); | ||||
|  | ||||
| @ -229,8 +229,7 @@ function createNewNote(params) { | ||||
|             entity: note | ||||
|         }); | ||||
| 
 | ||||
|         eventService.emit(eventService.ENTITY_CREATED, { // FIXME
 | ||||
|             entityName: 'note_contents', | ||||
|         eventService.emit(eventService.NOTE_CONTENT_CHANGE, { | ||||
|             entity: note | ||||
|         }); | ||||
| 
 | ||||
| @ -571,10 +570,7 @@ function downloadImages(noteId, content) { | ||||
| 
 | ||||
|                     asyncPostProcessContent(origNote, updatedContent); | ||||
| 
 | ||||
|                     eventService.emit(eventService.ENTITY_CHANGED, { | ||||
|                         entityName: 'note_contents', // FIXME
 | ||||
|                         entity: origNote | ||||
|                     }); | ||||
|                     eventService.emit(eventService.NOTE_CONTENT_CHANGE, { entity: origNote }); | ||||
| 
 | ||||
|                     console.log(`Fixed the image links for note '${noteId}' to the offline saved.`); | ||||
|                 } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam