diff --git a/app/components/Tooltip.tsx b/app/components/Tooltip.tsx index 4d554c33f5..c155ed58e0 100644 --- a/app/components/Tooltip.tsx +++ b/app/components/Tooltip.tsx @@ -12,6 +12,8 @@ export type Props = Omit & { content?: React.ReactChild | React.ReactChild[]; /** A keyboard shortcut to display next to the content */ shortcut?: React.ReactNode; + /** Whether to show the shortcut on a new line */ + shortcutOnNewline?: boolean; }; /** @@ -21,7 +23,13 @@ export type Props = Omit & { * Wrap this component in a TooltipProvider to allow multiple tooltips to share the same * singleton instance (delay, animation, etc). */ -function Tooltip({ shortcut, content: tooltip, delay = 500, ...rest }: Props) { +function Tooltip({ + shortcut, + shortcutOnNewline, + content: tooltip, + delay = 500, + ...rest +}: Props) { const isMobile = useMobile(); const singleton = useTooltipContext(); @@ -34,7 +42,8 @@ function Tooltip({ shortcut, content: tooltip, delay = 500, ...rest }: Props) { if (shortcut) { content = ( <> - {tooltip}{" "} + {tooltip} + {shortcutOnNewline ?
: " "} {typeof shortcut === "string" ? ( shortcut .split("+") diff --git a/app/editor/components/Tooltip.tsx b/app/editor/components/Tooltip.tsx index 06a9b76b63..95c54284ea 100644 --- a/app/editor/components/Tooltip.tsx +++ b/app/editor/components/Tooltip.tsx @@ -12,6 +12,7 @@ const WrappedTooltip: React.FC = ({ delay={150} content={content} placement="top" + shortcutOnNewline {...rest} > {children} diff --git a/app/editor/menus/formatting.tsx b/app/editor/menus/formatting.tsx index a3963ab0c9..283cd9b3ee 100644 --- a/app/editor/menus/formatting.tsx +++ b/app/editor/menus/formatting.tsx @@ -252,6 +252,7 @@ export default function formattingMenuItems( name: "copyToClipboard", icon: , tooltip: dictionary.copy, + shortcut: `${metaDisplay}+C`, visible: isCode && !isCodeBlock && (!isMobile || !isEmpty), }, ];