mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 21:30:53 +08:00
fix(react/floating_buttons): react to note type/mime changes
This commit is contained in:
parent
0c0504ffd1
commit
03a7fe1282
1 changed files with 6 additions and 0 deletions
|
|
@ -196,6 +196,7 @@ export function useNoteContext() {
|
|||
const [ noteContext, setNoteContext ] = useState<NoteContext>();
|
||||
const [ notePath, setNotePath ] = useState<string | null | undefined>();
|
||||
const [ note, setNote ] = useState<FNote | null | undefined>();
|
||||
const [ refreshCounter, setRefreshCounter ] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
setNote(noteContext?.note);
|
||||
|
|
@ -208,6 +209,11 @@ export function useNoteContext() {
|
|||
useTriliumEvent("frocaReloaded", () => {
|
||||
setNote(noteContext?.note);
|
||||
});
|
||||
useTriliumEvent("noteTypeMimeChanged", ({ noteId }) => {
|
||||
if (noteId === note?.noteId) {
|
||||
setRefreshCounter(refreshCounter + 1);
|
||||
}
|
||||
});
|
||||
|
||||
const parentComponent = useContext(ParentComponent) as ReactWrappedWidget;
|
||||
useDebugValue(() => `notePath=${notePath}, ntxId=${noteContext?.ntxId}`);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue