-
Notifications
You must be signed in to change notification settings - Fork 40
/
TableView.tsx
35 lines (31 loc) · 1.1 KB
/
TableView.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { NodeViewContent, NodeViewWrapper } from "@tiptap/react";
import { HiPlus } from "react-icons/hi2";
import props from "./types";
const TableView: React.FC<props> = ({ editor }) => {
return (
<NodeViewWrapper>
<div className="flex" autoCorrect="false" autoCapitalize="false">
<div>
<NodeViewContent />
<button
className="absolute w-[calc(100%-30px)] cursor-pointer border border-black/70 text-sm text-center bg-white border-dashed mt-1 py-1 opacity-0 hover:opacity-100 select-none"
onClick={() => {
editor.commands.addRowAfter();
}}
>
<HiPlus size={17} className="inline" />
</button>
</div>
<button
className="block border border-black/70 text-sm text-center bg-white border-dashed opacity-0 hover:opacity-100 ml-1 px-1 select-none"
onClick={() => {
editor.commands.addColumnAfter();
}}
>
<HiPlus size={17} className="inline" />
</button>
</div>
</NodeViewWrapper>
);
};
export default TableView;