From 5e7902f9bf6b0d97dc01b66122fde4bfebf5c6e4 Mon Sep 17 00:00:00 2001 From: Hebi Li Date: Wed, 28 Jun 2023 12:38:23 -0700 Subject: [PATCH] refine editor toolbar appearance --- ui/src/components/nodes/Rich.tsx | 157 ++++++++++++++++--------------- 1 file changed, 80 insertions(+), 77 deletions(-) diff --git a/ui/src/components/nodes/Rich.tsx b/ui/src/components/nodes/Rich.tsx index a6e7db17..44b8c052 100644 --- a/ui/src/components/nodes/Rich.tsx +++ b/ui/src/components/nodes/Rich.tsx @@ -36,21 +36,11 @@ import Ansi from "ansi-to-react"; import Box from "@mui/material/Box"; import InputBase from "@mui/material/InputBase"; -import CircularProgress from "@mui/material/CircularProgress"; import Tooltip from "@mui/material/Tooltip"; import IconButton from "@mui/material/IconButton"; -import PlayArrowIcon from "@mui/icons-material/PlayArrow"; -import Stack from "@mui/material/Stack"; -import Button from "@mui/material/Button"; -import CircleIcon from "@mui/icons-material/Circle"; -import CheckCircleIcon from "@mui/icons-material/CheckCircle"; -import Grid from "@mui/material/Grid"; -import PlayCircleOutlineIcon from "@mui/icons-material/PlayCircleOutline"; import DeleteIcon from "@mui/icons-material/Delete"; -import ViewComfyIcon from "@mui/icons-material/ViewComfy"; -import RectangleIcon from "@mui/icons-material/Rectangle"; -import DisabledByDefaultIcon from "@mui/icons-material/DisabledByDefault"; import DragIndicatorIcon from "@mui/icons-material/DragIndicator"; +import FormatColorResetIcon from "@mui/icons-material/FormatColorReset"; import { BoldExtension, @@ -99,6 +89,11 @@ import { useUpdateReason, FloatingWrapper, useMention, + ToggleBoldButton, + ToggleItalicButton, + ToggleUnderlineButton, + ToggleCodeButton, + ToggleStrikeButton, } from "@remirror/react"; import { FloatingToolbar, useExtensionEvent } from "@remirror/react"; import { TableExtension } from "@remirror/extension-react-tables"; @@ -260,7 +255,7 @@ function useUpdatePositionerOnMove() { return; } -const FloatingLinkToolbar = ({ children }) => { +const EditorToolbar = () => { const { isEditing, linkPositioner, @@ -280,50 +275,69 @@ const FloatingLinkToolbar = ({ children }) => { clickEdit(); }, [clickEdit]); - const linkEditButtons = activeLink ? ( - - - - - ) : ( - - - - ); - return ( <> {!isEditing && ( // By default, MUI's Popper creates a Portal, which is a ROOT html // elements that prevents paning on reactflow canvas. Therefore, we // disable the portal behavior. - - {linkEditButtons} - {children} - - )} - {!isEditing && empty && ( - - {linkEditButtons} - {children} + + + + + + + {activeLink && ( + + )} + {activeLink && ( + + )} + {!activeLink && ( + + )} + + + + + + + {/* */} + {/* */} + {/* */} )} @@ -384,14 +398,24 @@ export const SetHighlightButton: React.FC< - color === null ? :{" "} - - + color ? ( + + A + + ) : ( + + ) } /> ); @@ -616,28 +640,7 @@ const MyEditor = ({ ]} /> - {!isGuest && ( - - - - - {/* */} - - {/* */} - - - - - - - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - - )} + {!isGuest && } {/* */}