mirror of
https://github.com/zadam/trilium.git
synced 2025-10-08 14:42:29 +08:00
chore(react/ribbon): simplify useNoteContext & handle setNoteContext
This commit is contained in:
parent
066f3ea078
commit
82bdb76d75
1 changed files with 1 additions and 8 deletions
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue