mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 16:49:58 +01:00
feat(breadcrumb_badges): display badge when editing is unlocked
This commit is contained in:
@@ -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 &&
|
||||
<Badge
|
||||
icon="bx bx-lock"
|
||||
if (isTemporarilyEditable) {
|
||||
return <Badge
|
||||
icon="bx bx-lock-open-alt"
|
||||
onClick={() => enableEditing(false)}
|
||||
>
|
||||
{t("breadcrumb_badges.read_only_temporarily_disabled")}
|
||||
</Badge>;
|
||||
} else if (isReadOnly) {
|
||||
return <Badge
|
||||
icon="bx bx-lock-alt"
|
||||
onClick={() => enableEditing()}>
|
||||
{isExplicitReadOnly ? t("breadcrumb_badges.read_only_explicit") : t("breadcrumb_badges.read_only_auto")}
|
||||
</Badge>
|
||||
);
|
||||
</Badge>;
|
||||
}
|
||||
}
|
||||
|
||||
function ShareBadge() {
|
||||
|
||||
Reference in New Issue
Block a user