diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 3dcd231bc..f5f96960a 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2133,6 +2133,7 @@
"breadcrumb_badges": {
"read_only_explicit": "Read-only",
"read_only_auto": "Auto read-only",
+ "read_only_temporarily_disabled": "Temporarily editable",
"shared_publicly": "Shared publicly",
"shared_locally": "Shared locally"
}
diff --git a/apps/client/src/widgets/BreadcrumbBadges.tsx b/apps/client/src/widgets/BreadcrumbBadges.tsx
index 3bb3c06b6..2f00771f8 100644
--- a/apps/client/src/widgets/BreadcrumbBadges.tsx
+++ b/apps/client/src/widgets/BreadcrumbBadges.tsx
@@ -20,14 +20,22 @@ function ReadOnlyBadge() {
const { note, noteContext } = useNoteContext();
const { isReadOnly, enableEditing } = useIsNoteReadOnly(note, noteContext);
const isExplicitReadOnly = note?.isLabelTruthy("readOnly");
+ const isTemporarilyEditable = noteContext?.viewScope?.readOnlyTemporarilyDisabled;
- return (isReadOnly &&
- enableEditing(false)}
+ >
+ {t("breadcrumb_badges.read_only_temporarily_disabled")}
+ ;
+ } else if (isReadOnly) {
+ return enableEditing()}>
{isExplicitReadOnly ? t("breadcrumb_badges.read_only_explicit") : t("breadcrumb_badges.read_only_auto")}
-
- );
+ ;
+ }
}
function ShareBadge() {
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index fbcd7095e..5fe9ed883 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -845,9 +845,9 @@ export function useGlobalShortcut(keyboardShortcut: string | null | undefined, h
export function useIsNoteReadOnly(note: FNote | null | undefined, noteContext: NoteContext | undefined) {
const [ isReadOnly, setIsReadOnly ] = useState(undefined);
- const enableEditing = useCallback(() => {
+ const enableEditing = useCallback((enabled = true) => {
if (noteContext?.viewScope) {
- noteContext.viewScope.readOnlyTemporarilyDisabled = true;
+ noteContext.viewScope.readOnlyTemporarilyDisabled = enabled;
appContext.triggerEvent("readOnlyTemporarilyDisabled", {noteContext});
}
}, [noteContext]);
@@ -862,7 +862,7 @@ export function useIsNoteReadOnly(note: FNote | null | undefined, noteContext: N
useTriliumEvent("readOnlyTemporarilyDisabled", ({noteContext: eventNoteContext}) => {
if (noteContext?.ntxId === eventNoteContext.ntxId) {
- setIsReadOnly(false);
+ setIsReadOnly(!noteContext.viewScope?.readOnlyTemporarilyDisabled);
}
});