From abe8df4ecacc3e6a90d6532e8f65819e0844abf8 Mon Sep 17 00:00:00 2001
From: "M. Palanikannan" <73993394+Palanikannan1437@users.noreply.github.com>
Date: Sat, 2 Sep 2023 00:45:34 +0530
Subject: [PATCH] added table-icons for left,right columns and top,bottom rows
(#2061)
---
.../table-menu/InsertBottomTableIcon.tsx | 15 +++++++++++
.../tiptap/table-menu/InsertLeftTableIcon.tsx | 14 +++++++++++
.../table-menu/InsertRightTableIcon.tsx | 15 +++++++++++
.../tiptap/table-menu/InsertTopTableIcon.tsx | 14 +++++++++++
.../components/tiptap/table-menu/index.tsx | 25 +++++++++++++++----
5 files changed, 78 insertions(+), 5 deletions(-)
create mode 100644 apps/app/components/tiptap/table-menu/InsertBottomTableIcon.tsx
create mode 100644 apps/app/components/tiptap/table-menu/InsertLeftTableIcon.tsx
create mode 100644 apps/app/components/tiptap/table-menu/InsertRightTableIcon.tsx
create mode 100644 apps/app/components/tiptap/table-menu/InsertTopTableIcon.tsx
diff --git a/apps/app/components/tiptap/table-menu/InsertBottomTableIcon.tsx b/apps/app/components/tiptap/table-menu/InsertBottomTableIcon.tsx
new file mode 100644
index 000000000..b3f99855e
--- /dev/null
+++ b/apps/app/components/tiptap/table-menu/InsertBottomTableIcon.tsx
@@ -0,0 +1,15 @@
+const InsertBottomTableIcon = (props: any) => (
+
+)
+
+export default InsertBottomTableIcon;
diff --git a/apps/app/components/tiptap/table-menu/InsertLeftTableIcon.tsx b/apps/app/components/tiptap/table-menu/InsertLeftTableIcon.tsx
new file mode 100644
index 000000000..8a92705d8
--- /dev/null
+++ b/apps/app/components/tiptap/table-menu/InsertLeftTableIcon.tsx
@@ -0,0 +1,14 @@
+const InsertLeftTableIcon = (props: any) => (
+
+)
+export default InsertLeftTableIcon
diff --git a/apps/app/components/tiptap/table-menu/InsertRightTableIcon.tsx b/apps/app/components/tiptap/table-menu/InsertRightTableIcon.tsx
new file mode 100644
index 000000000..04348ece1
--- /dev/null
+++ b/apps/app/components/tiptap/table-menu/InsertRightTableIcon.tsx
@@ -0,0 +1,15 @@
+const InsertRightTableIcon = (props: any) => (
+
+)
+
+export default InsertRightTableIcon
diff --git a/apps/app/components/tiptap/table-menu/InsertTopTableIcon.tsx b/apps/app/components/tiptap/table-menu/InsertTopTableIcon.tsx
new file mode 100644
index 000000000..14036f998
--- /dev/null
+++ b/apps/app/components/tiptap/table-menu/InsertTopTableIcon.tsx
@@ -0,0 +1,14 @@
+const InsertTopTableIcon = (props: any) => (
+
+)
+export default InsertTopTableIcon;
diff --git a/apps/app/components/tiptap/table-menu/index.tsx b/apps/app/components/tiptap/table-menu/index.tsx
index 0da68410e..e6513fc43 100644
--- a/apps/app/components/tiptap/table-menu/index.tsx
+++ b/apps/app/components/tiptap/table-menu/index.tsx
@@ -2,6 +2,10 @@ import { useState, useEffect } from "react";
import { Rows, Columns, ToggleRight } from "lucide-react";
import { cn } from "../utils";
import { Tooltip } from "components/ui";
+import InsertLeftTableIcon from "./InsertLeftTableIcon";
+import InsertRightTableIcon from "./InsertRightTableIcon";
+import InsertTopTableIcon from "./InsertTopTableIcon";
+import InsertBottomTableIcon from "./InsertBottomTableIcon";
interface TableMenuItem {
command: () => void;
@@ -24,13 +28,25 @@ export const TableMenu = ({ editor }: { editor: any }) => {
const items: TableMenuItem[] = [
{
command: () => editor.chain().focus().addColumnBefore().run(),
- icon: Columns,
+ icon: InsertLeftTableIcon,
+ key: "insert-column-left",
+ name: "Insert 1 column left",
+ },
+ {
+ command: () => editor.chain().focus().addColumnAfter().run(),
+ icon: InsertRightTableIcon,
key: "insert-column-right",
name: "Insert 1 column right",
},
+ {
+ command: () => editor.chain().focus().addRowBefore().run(),
+ icon: InsertTopTableIcon,
+ key: "insert-row-above",
+ name: "Insert 1 row above",
+ },
{
command: () => editor.chain().focus().addRowAfter().run(),
- icon: Rows,
+ icon: InsertBottomTableIcon,
key: "insert-row-below",
name: "Insert 1 row below",
},
@@ -99,9 +115,8 @@ export const TableMenu = ({ editor }: { editor: any }) => {
return (