Files
outline/app/editor/menus/tableRow.tsx
Tom Moor 1a386c9900 feat: Add table sorting controls (#6678)
* wip

* refactor

* fix: Missing shadow styling
2024-03-14 19:21:56 -07:00

44 lines
993 B
TypeScript

import {
TrashIcon,
InsertAboveIcon,
InsertBelowIcon,
MoreIcon,
} from "outline-icons";
import { EditorState } from "prosemirror-state";
import * as React from "react";
import { MenuItem } from "@shared/editor/types";
import { Dictionary } from "~/hooks/useDictionary";
export default function tableRowMenuItems(
state: EditorState,
index: number,
dictionary: Dictionary
): MenuItem[] {
return [
{
icon: <MoreIcon />,
children: [
{
name: "addRowAfter",
label: dictionary.addRowBefore,
icon: <InsertAboveIcon />,
attrs: { index: index - 1 },
visible: index !== 0,
},
{
name: "addRowAfter",
label: dictionary.addRowAfter,
icon: <InsertBelowIcon />,
attrs: { index },
},
{
name: "deleteRow",
label: dictionary.deleteRow,
dangerous: true,
icon: <TrashIcon />,
},
],
},
];
}