diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index 1c1c17502..3b396e070 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -1,19 +1,20 @@ import { ConvertToAttachmentResponse } from "@triliumnext/commons"; -import appContext, { CommandNames } from "../../components/app_context"; -import FNote from "../../entities/fnote" -import dialog from "../../services/dialog"; -import { t } from "../../services/i18n" -import server from "../../services/server"; -import toast from "../../services/toast"; -import ws from "../../services/ws"; -import ActionButton from "../react/ActionButton" -import Dropdown from "../react/Dropdown"; import { FormDropdownDivider, FormListItem } from "../react/FormList"; import { isElectron as getIsElectron, isMac as getIsMac } from "../../services/utils"; import { ParentComponent } from "../react/react_utils"; +import { t } from "../../services/i18n" import { useContext } from "preact/hooks"; -import NoteContext from "../../components/note_context"; +import { useIsNoteReadOnly } from "../react/hooks"; +import ActionButton from "../react/ActionButton" +import appContext, { CommandNames } from "../../components/app_context"; import branches from "../../services/branches"; +import dialog from "../../services/dialog"; +import Dropdown from "../react/Dropdown"; +import FNote from "../../entities/fnote" +import NoteContext from "../../components/note_context"; +import server from "../../services/server"; +import toast from "../../services/toast"; +import ws from "../../services/ws"; interface NoteActionsProps { note?: FNote; @@ -52,6 +53,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not const isMac = getIsMac(); const hasSource = ["text", "code", "relationMap", "mermaid", "canvas", "mindMap"].includes(note.type); const isSearchOrBook = ["search", "book"].includes(note.type); + const {isReadOnly, enableEditing} = useIsNoteReadOnly(note, noteContext); return ( + iconAction> + + {isReadOnly && <> + enableEditing()}> + {t("read-only-info.edit-note")} + + + } + {canBeConvertedToAttachment && } {note.type === "render" && }