Files
outline/app/editor/menus/readOnly.tsx
Tom Moor 084490ba6b chore: Remove React in scope requirement (#9261)
* Add rules

* codemod: update-react-imports

* Update babelrc
2025-05-20 19:26:11 -04:00

26 lines
701 B
TypeScript

import { CommentIcon } from "outline-icons";
import { EditorState } from "prosemirror-state";
import { isMarkActive } from "@shared/editor/queries/isMarkActive";
import { MenuItem } from "@shared/editor/types";
import { Dictionary } from "~/hooks/useDictionary";
export default function readOnlyMenuItems(
state: EditorState,
canUpdate: boolean,
dictionary: Dictionary
): MenuItem[] {
const { schema } = state;
const isEmpty = state.selection.empty;
return [
{
visible: canUpdate && !isEmpty,
name: "comment",
tooltip: dictionary.comment,
label: dictionary.comment,
icon: <CommentIcon />,
active: isMarkActive(schema.marks.comment),
},
];
}