From 677859e3898bb68d3dc46347bfa91325d1dfeaa4 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 1 Aug 2025 23:10:29 -0600 Subject: [PATCH] simplified insert --- .../ui/report/elements/BlockDraggable.tsx | 60 ++++++++----------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx index 1587b8fb1..de19c0551 100644 --- a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx +++ b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx @@ -6,7 +6,7 @@ import { DndPlugin, useDraggable, useDropLine } from '@platejs/dnd'; import { expandListItemsWithChildren } from '@platejs/list'; import { BlockSelectionPlugin } from '@platejs/selection/react'; import { GripDots, Plus } from '@/components/ui/icons'; -import { type TElement, getPluginByType, isType, KEYS } from 'platejs'; +import { type Path, type TElement, getPluginByType, isType, KEYS } from 'platejs'; import { type PlateEditor, type PlateElementProps, @@ -22,6 +22,8 @@ import { useSelected } from 'platejs/react'; import { Button } from '@/components/ui/buttons'; import { Tooltip } from '@/components/ui/tooltip'; import { cn } from '@/lib/utils'; +import { useMemoizedFn } from '@/hooks/useMemoizedFn'; +import { insertBlock } from './transforms'; const UNDRAGGABLE_KEYS = [KEYS.column, KEYS.tr, KEYS.td]; @@ -135,7 +137,12 @@ function Draggable(props: PlateElementProps) { 'mr-1 flex items-center' )}>
- +