diff --git a/apps/web/src/app/test/report-playground/ReportPlayground.tsx b/apps/web/src/app/test/report-playground/ReportPlayground.tsx index 8ebd2bb2b..6c8f26e6a 100644 --- a/apps/web/src/app/test/report-playground/ReportPlayground.tsx +++ b/apps/web/src/app/test/report-playground/ReportPlayground.tsx @@ -207,7 +207,7 @@ const value: ReportElements = [ children: [ { text: 'This is a todo list', - subscript: true + subscript: false } ], indent: 1, diff --git a/apps/web/src/components/ui/report/config/icons.tsx b/apps/web/src/components/ui/report/config/icons.tsx index 6d648f74b..86d0289a2 100644 --- a/apps/web/src/components/ui/report/config/icons.tsx +++ b/apps/web/src/components/ui/report/config/icons.tsx @@ -203,6 +203,7 @@ export const NodeTypeIcons = { indent: IndentIncrease, outdent: IndentDecrease, download: Download, + turnInto: Pilcrow, // Tools equation: Equation, diff --git a/apps/web/src/components/ui/report/config/labels.tsx b/apps/web/src/components/ui/report/config/labels.tsx index 873b72b2e..5f3507bc9 100644 --- a/apps/web/src/components/ui/report/config/labels.tsx +++ b/apps/web/src/components/ui/report/config/labels.tsx @@ -124,6 +124,21 @@ export const NodeTypeLabels = { keyboard: '⌘+⇧+Z', keywords: [] }, + delete: { + label: 'Delete', + keyboard: '⌘+⌫', + keywords: [] + }, + duplicate: { + label: 'Duplicate', + keyboard: undefined, + keywords: [] + }, + askAI: { + label: 'Ask AI', + keyboard: undefined, + keywords: [] + }, link: { label: 'Link', keyboard: '⌘+K', @@ -161,13 +176,18 @@ export const NodeTypeLabels = { keyboard: undefined, keywords: [] }, - insert: { - label: 'Insert', + align: { + label: 'Align', keyboard: undefined, keywords: [] }, - align: { - label: 'Align', + indentation: { + label: 'Indentation', + keyboard: undefined, + keywords: ['indent', 'outdent'] + }, + insert: { + label: 'Insert', keyboard: undefined, keywords: [] }, diff --git a/apps/web/src/components/ui/report/elements/AlignToolbarButton.tsx b/apps/web/src/components/ui/report/elements/AlignToolbarButton.tsx index 6fa89c76e..bada71c62 100644 --- a/apps/web/src/components/ui/report/elements/AlignToolbarButton.tsx +++ b/apps/web/src/components/ui/report/elements/AlignToolbarButton.tsx @@ -19,6 +19,7 @@ import { } from '@/components/ui/dropdown-menu'; import { ToolbarButton } from '@/components/ui/toolbar/Toolbar'; +import { Tooltip } from '../../tooltip'; const items = [ { @@ -69,13 +70,15 @@ export function AlignToolbarButton(props: DropdownMenuProps) { tf.textAlign.setNodes(value as Alignment); editor.tf.focus(); }}> - {items.map(({ icon: Icon, value: itemValue }) => ( - - - + {items.map(({ icon: Icon, label, value: itemValue }) => ( + + + + + ))} diff --git a/apps/web/src/components/ui/report/elements/BlockContextMenu.tsx b/apps/web/src/components/ui/report/elements/BlockContextMenu.tsx index 1c723c025..4a57410de 100644 --- a/apps/web/src/components/ui/report/elements/BlockContextMenu.tsx +++ b/apps/web/src/components/ui/report/elements/BlockContextMenu.tsx @@ -16,6 +16,7 @@ import { ContextMenuContent, ContextMenuGroup, ContextMenuItem, + ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, @@ -23,10 +24,33 @@ import { } from '@/components/ui/context-menu'; import { useIsTouchDevice } from '@/hooks/useIsTouchDevice'; import { THEME_RESET_STYLE } from '@/styles/theme-reset'; +import { NodeTypeIcons } from '../config/icons'; +import { NodeTypeLabels } from '../config/labels'; + +// Helper function to render menu item content +const MenuItemContent = ({ + icon, + labelKey +}: { + icon: React.ComponentType; + labelKey: keyof typeof NodeTypeLabels; +}) => { + const label = NodeTypeLabels[labelKey]; + const Icon = icon; + return ( + <> +
+ +
+ {label.label} + {label.keyboard && {label.keyboard}} + + ); +}; type Value = 'askAI' | null; -export function BlockContextMenu({ children }: { children: React.ReactNode }) { +function BlockContextMenuComponent({ children }: { children: React.ReactNode }) { const { api, editor } = useEditorPlugin(BlockMenuPlugin); const [value, setValue] = React.useState(null); const isTouch = useIsTouchDevice(); @@ -88,7 +112,7 @@ export function BlockContextMenu({ children }: { children: React.ReactNode }) { y: event.clientY }); }}> -
{children}
+
{children}
- { setValue('askAI'); }}> - Ask AI - + + */} { editor.getTransforms(BlockSelectionPlugin).blockSelection.removeNodes(); editor.tf.focus(); }}> - Delete + { editor.getTransforms(BlockSelectionPlugin).blockSelection.duplicate(); }}> - Duplicate - {/* ⌘ + D */} + - Turn into + + + - handleTurnInto(KEYS.p)}>Paragraph + handleTurnInto(KEYS.p)}> + + - handleTurnInto(KEYS.h1)}>Heading 1 - handleTurnInto(KEYS.h2)}>Heading 2 - handleTurnInto(KEYS.h3)}>Heading 3 + handleTurnInto(KEYS.h1)}> + + + handleTurnInto(KEYS.h2)}> + + + handleTurnInto(KEYS.h3)}> + + handleTurnInto(KEYS.blockquote)}> - Blockquote + - editor.getTransforms(BlockSelectionPlugin).blockSelection.setIndent(1)}> - Indent - - editor.getTransforms(BlockSelectionPlugin).blockSelection.setIndent(-1)}> - Outdent - - Align + + + - handleAlign('left')}>Left - handleAlign('center')}>Center - handleAlign('right')}>Right + + editor.getTransforms(BlockSelectionPlugin).blockSelection.setIndent(1) + }> + + + + editor.getTransforms(BlockSelectionPlugin).blockSelection.setIndent(-1) + }> + + + + + + + + + + handleAlign('left')}> + + + handleAlign('center')}> + + + handleAlign('right')}> + + @@ -161,3 +213,5 @@ export function BlockContextMenu({ children }: { children: React.ReactNode }) { ); } + +export const BlockContextMenu = React.memo(BlockContextMenuComponent);