mirror of
https://github.com/zadam/trilium.git
synced 2025-12-15 03:44:23 +01:00
fix(breadcrumb_badges): doesn't refresh when switching editability
This commit is contained in:
parent
cfbd2bf53a
commit
01978dabf0
@ -845,6 +845,8 @@ export function useGlobalShortcut(keyboardShortcut: string | null | undefined, h
|
|||||||
*/
|
*/
|
||||||
export function useIsNoteReadOnly(note: FNote | null | undefined, noteContext: NoteContext | undefined) {
|
export function useIsNoteReadOnly(note: FNote | null | undefined, noteContext: NoteContext | undefined) {
|
||||||
const [ isReadOnly, setIsReadOnly ] = useState<boolean | undefined>(undefined);
|
const [ isReadOnly, setIsReadOnly ] = useState<boolean | undefined>(undefined);
|
||||||
|
const [ readOnlyAttr ] = useNoteLabelBoolean(note, "readOnly");
|
||||||
|
const [ autoReadOnlyDisabledAttr ] = useNoteLabelBoolean(note, "autoReadOnlyDisabled");
|
||||||
|
|
||||||
const enableEditing = useCallback((enabled = true) => {
|
const enableEditing = useCallback((enabled = true) => {
|
||||||
if (noteContext?.viewScope) {
|
if (noteContext?.viewScope) {
|
||||||
@ -859,7 +861,7 @@ export function useIsNoteReadOnly(note: FNote | null | undefined, noteContext: N
|
|||||||
setIsReadOnly(readOnly);
|
setIsReadOnly(readOnly);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [ note, noteContext, noteContext?.viewScope ]);
|
}, [ note, noteContext, noteContext?.viewScope, readOnlyAttr, autoReadOnlyDisabledAttr ]);
|
||||||
|
|
||||||
useTriliumEvent("readOnlyTemporarilyDisabled", ({noteContext: eventNoteContext}) => {
|
useTriliumEvent("readOnlyTemporarilyDisabled", ({noteContext: eventNoteContext}) => {
|
||||||
if (noteContext?.ntxId === eventNoteContext.ntxId) {
|
if (noteContext?.ntxId === eventNoteContext.ntxId) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user