From bc6dd1656dcdbbc0236f81b2f2b10215e499d5ef Mon Sep 17 00:00:00 2001 From: Prathamesh Chavan Date: Sun, 20 Aug 2023 12:00:34 +0530 Subject: [PATCH 1/3] Fixed Collision detection for Selector dropdowns --- ui/editor/components/color-selector.tsx | 148 ++++++++++++------------ 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/ui/editor/components/color-selector.tsx b/ui/editor/components/color-selector.tsx index 16d132032..d7262de01 100644 --- a/ui/editor/components/color-selector.tsx +++ b/ui/editor/components/color-selector.tsx @@ -1,6 +1,7 @@ import { Editor } from "@tiptap/core"; import { Check, ChevronDown } from "lucide-react"; import { Dispatch, FC, SetStateAction } from "react"; +import * as Popover from "@radix-ui/react-popover"; export interface BubbleColorMenuItem { name: string; @@ -105,83 +106,88 @@ export const ColorSelector: FC = ({ ); return ( -
- + + - {isOpen && ( -
-
Color
- {TEXT_COLORS.map(({ name, color }, index) => ( -
- {name} - - {editor.isActive("textStyle", { color }) && ( - - )} - - ))} +
+
+ A +
+ {name} +
+ {editor.isActive("textStyle", { color }) && ( + + )} + + ))} -
- Background -
+
+ Background +
- {HIGHLIGHT_COLORS.map(({ name, color }, index) => ( - - ))} - - )} - +
+
+ A +
+ {name} +
+ {editor.isActive("highlight", { color }) && ( + + )} + + ))} + + + + + ); }; From 98e9b4e02ab0fb7e5f9083c0b5bbf880e970c552 Mon Sep 17 00:00:00 2001 From: Prathamesh Chavan Date: Sun, 20 Aug 2023 18:45:29 +0530 Subject: [PATCH 2/3] Fixed Popover content not interactive --- ui/editor/components/color-selector.tsx | 111 +++++++++++------------- 1 file changed, 53 insertions(+), 58 deletions(-) diff --git a/ui/editor/components/color-selector.tsx b/ui/editor/components/color-selector.tsx index d7262de01..2ae9cf449 100644 --- a/ui/editor/components/color-selector.tsx +++ b/ui/editor/components/color-selector.tsx @@ -125,68 +125,63 @@ export const ColorSelector: FC = ({ - - -
-
Color
- {TEXT_COLORS.map(({ name, color }, index) => ( - - ))} - -
- Background + A +
+ {name} + {editor.isActive("textStyle", { color }) && ( + + )} + + ))} + +
+ Background +
- {HIGHLIGHT_COLORS.map(({ name, color }, index) => ( - - ))} -
-
-
+ A + + {name} + + {editor.isActive("highlight", { color }) && ( + + )} + + ))} + ); From 6d8c774aa783e9b5e0cd164a976ddc855b4e2ef8 Mon Sep 17 00:00:00 2001 From: Steven Tey Date: Fri, 25 Aug 2023 22:02:24 -0500 Subject: [PATCH 3/3] added radix popover to node selector as well --- ui/editor/components/color-selector.tsx | 5 +++- ui/editor/components/node-selector.tsx | 31 ++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ui/editor/components/color-selector.tsx b/ui/editor/components/color-selector.tsx index 2ae9cf449..60cafa68a 100644 --- a/ui/editor/components/color-selector.tsx +++ b/ui/editor/components/color-selector.tsx @@ -125,7 +125,10 @@ export const ColorSelector: FC = ({ - +
Color
{TEXT_COLORS.map(({ name, color }, index) => ( + +
+ setIsOpen(!isOpen)} + > + {activeItem?.name} + + - {isOpen && ( -
+ {items.map((item, index) => ( ))} -
- )} -
+
+ + ); };