mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 00:49:00 +01:00
fix(react/type_widgets): unable to switch view-mode for same note
This commit is contained in:
parent
e2ef58ed50
commit
5c21759de9
@ -136,7 +136,7 @@ function useNoteInfo() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(refresh, [ actualNote, noteContext]);
|
useEffect(refresh, [ actualNote, noteContext, noteContext?.viewScope?.viewMode ]);
|
||||||
useTriliumEvent("readOnlyTemporarilyDisabled", ({ noteContext: eventNoteContext }) => {
|
useTriliumEvent("readOnlyTemporarilyDisabled", ({ noteContext: eventNoteContext }) => {
|
||||||
if (eventNoteContext?.ntxId !== noteContext?.ntxId) return;
|
if (eventNoteContext?.ntxId !== noteContext?.ntxId) return;
|
||||||
refresh();
|
refresh();
|
||||||
|
|||||||
@ -239,6 +239,7 @@ export function useNoteContext() {
|
|||||||
const [ noteContext, setNoteContext ] = useState<NoteContext>();
|
const [ noteContext, setNoteContext ] = useState<NoteContext>();
|
||||||
const [ notePath, setNotePath ] = useState<string | null | undefined>();
|
const [ notePath, setNotePath ] = useState<string | null | undefined>();
|
||||||
const [ note, setNote ] = useState<FNote | null | undefined>();
|
const [ note, setNote ] = useState<FNote | null | undefined>();
|
||||||
|
const [ , setViewMode ] = useState<string>();
|
||||||
const [ refreshCounter, setRefreshCounter ] = useState(0);
|
const [ refreshCounter, setRefreshCounter ] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -248,6 +249,7 @@ export function useNoteContext() {
|
|||||||
useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => {
|
useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => {
|
||||||
setNoteContext(noteContext);
|
setNoteContext(noteContext);
|
||||||
setNotePath(noteContext.notePath);
|
setNotePath(noteContext.notePath);
|
||||||
|
setViewMode(noteContext.viewScope?.viewMode);
|
||||||
});
|
});
|
||||||
useTriliumEvent("frocaReloaded", () => {
|
useTriliumEvent("frocaReloaded", () => {
|
||||||
setNote(noteContext?.note);
|
setNote(noteContext?.note);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user