mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
chore(react/ribbon): simplify useNoteContext & handle setNoteContext
This commit is contained in:
@@ -202,17 +202,10 @@ export function useNoteContext() {
|
||||
setNote(noteContext?.note);
|
||||
}, [ notePath ]);
|
||||
|
||||
useTriliumEvent("activeContextChanged", ({ noteContext }) => {
|
||||
useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => {
|
||||
setNoteContext(noteContext);
|
||||
setNotePath(noteContext.notePath);
|
||||
});
|
||||
useTriliumEvent("noteSwitchedAndActivated", ({ noteContext }) => {
|
||||
setNoteContext(noteContext);
|
||||
});
|
||||
useTriliumEvent("noteSwitched", ({ notePath, noteContext }) => {
|
||||
setNoteContext(noteContext);
|
||||
setNotePath(notePath);
|
||||
});
|
||||
useTriliumEvent("frocaReloaded", () => {
|
||||
setNote(noteContext?.note);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user