fix runOnNoteContentChange event

This commit is contained in:
zadam
2023-05-05 15:40:44 +02:00
parent 78d83b8826
commit 35338e9ec6
3 changed files with 10 additions and 10 deletions

View File

@@ -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);