Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/selectors/color-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const ColorSelector = ({ open, onOpenChange }: ColorSelectorProps) => {
</PopoverTrigger>
<PopoverContent
sideOffset={5}
className="my-1 rounded-tl-lg border border-border bg-muted px-1 py-2 transition-all [&::-webkit-scrollbar]:w-[0.4rem] scrollbar-gutter-stable [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-track]:bg-transparent flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto p-1 shadow-xl"
className="my-1 rounded-tl-lg border border-border bg-muted px-1 py-2 transition-all [&::-webkit-scrollbar]:w-[0.4rem] [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-track]:bg-transparent flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto p-1 shadow-xl"
align="start"
>
<div className="flex flex-col">
Expand Down
73 changes: 50 additions & 23 deletions components/table-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {
X,
} from "lucide-react";
import { Button } from "./ui/button";

import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useHoverTooltip } from "@/hooks/useHoverTooltip";
interface TableControlsProps {
editor: Editor;
}
Expand Down Expand Up @@ -49,7 +54,7 @@ export const TableControls = ({ editor }: TableControlsProps) => {

const menuRef = useRef<HTMLDivElement>(null);
const pillRef = useRef<HTMLDivElement>(null);

const tooltip = useHoverTooltip();
const focusCell = useCallback(
(cell: HTMLElement) => {
try {
Expand Down Expand Up @@ -231,30 +236,52 @@ export const TableControls = ({ editor }: TableControlsProps) => {
const pill = (
<div
ref={pillRef}
className="fixed flex items-center gap-0.5 bg-muted border border-border rounded-tl-md shadow-md px-0.5 py-0.5 z-[9998]"
className="fixed flex items-center gap-0.5 bg-muted border border-border rounded-tl-lg shadow-md px-0.5 py-0.5 z-[9998]"
style={{ left: pillX, top: pillY }}
onMouseDown={(e) => e.stopPropagation()}
>
<Button
variant="ghost"
title="Add row below"
aria-label="Add row below"
onClick={quickAdd}
className=" w-6 h-6 "
size="icon"
>
<Plus className="w-3.5 h-3.5 " />
</Button>
<Button
variant="ghost"
title="Cell options"
aria-label="Cell options"
onClick={openMenu}
className=" w-6 h-6"
size="icon"
>
<ChevronDown className="w-3.5 h-3.5" />
</Button>
<Tooltip disableHoverableContent delayDuration={100}>
<TooltipTrigger asChild>
<Button
variant="ghost"
aria-label="Add row below"
onClick={quickAdd}
className=" w-6 h-6 "
size="icon"
>
<Plus className="w-3.5 h-3.5 " />
</Button>
</TooltipTrigger>
<TooltipContent
side="bottom"
alignOffset={0}
align="end"
className=" text-xs py-0.5 px-1.5"
>
Add row below
</TooltipContent>
</Tooltip>
<Tooltip disableHoverableContent delayDuration={100}>
<TooltipTrigger asChild>
<Button
variant="ghost"
aria-label="Cell options"
onClick={openMenu}
className=" w-6 h-6 !rounded-none"
size="icon"
>
<ChevronDown className="w-3.5 h-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent
side="bottom"
alignOffset={0}
align="end"
className=" text-xs py-0.5 px-1.5"
>
Cell options
</TooltipContent>
</Tooltip>
</div>
);

Expand Down