mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 21:36:05 +01:00
added new runOnNoteDeletion, runOnBranchCreation, runOnBranchDeletion, #2898
This commit is contained in:
@@ -49,6 +49,7 @@ eventService.subscribe([ eventService.ENTITY_CHANGED, eventService.ENTITY_DELETE
|
||||
}
|
||||
}
|
||||
else if (entityName === 'notes') {
|
||||
// ENTITY_DELETED won't trigger anything since all branches/attributes are already deleted at this point
|
||||
runAttachedRelations(entity, 'runOnNoteChange', entity);
|
||||
}
|
||||
});
|
||||
@@ -94,6 +95,9 @@ eventService.subscribe(eventService.ENTITY_CREATED, ({ entityName, entity }) =>
|
||||
handleSortedAttribute(entity);
|
||||
}
|
||||
}
|
||||
else if (entityName === 'branches') {
|
||||
runAttachedRelations(entity.getNote(), 'runOnBranchCreation', entity);
|
||||
}
|
||||
else if (entityName === 'notes') {
|
||||
runAttachedRelations(entity, 'runOnNoteCreation', entity);
|
||||
}
|
||||
@@ -167,4 +171,12 @@ eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) =>
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (entityName === 'branches') {
|
||||
runAttachedRelations(entity.getNote(), 'runOnBranchDeletion', entity);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
runAttachedRelations
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user