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