chore(react/type_widget): bring back read-only temporary disable

This commit is contained in:
Elian Doran
2025-09-20 11:55:43 +03:00
parent 91f21e149b
commit 4a4502dfea
3 changed files with 8 additions and 11 deletions

View File

@@ -65,12 +65,18 @@ function useNoteInfo() {
const [ note, setNote ] = useState<FNote | null | undefined>();
const [ type, setType ] = useState<ExtendedNoteType>();
useEffect(() => {
function refresh() {
getWidgetType(actualNote, noteContext).then(type => {
setNote(actualNote);
setType(type);
});
}, [ actualNote, noteContext ]);
}
useEffect(refresh, [ actualNote, noteContext]);
useTriliumEvent("readOnlyTemporarilyDisabled", ({ noteContext: eventNoteContext }) => {
if (eventNoteContext?.ntxId !== noteContext?.ntxId) return;
refresh();
});
return { note, type, noteContext, parentComponent };
}