diff --git a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx index 89337b2a3..a4198247b 100644 --- a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx +++ b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx @@ -23,9 +23,7 @@ import { cn } from '@/lib/utils'; const UNDRAGGABLE_KEYS = [KEYS.column, KEYS.tr, KEYS.td]; -export const BlockDraggable: RenderNodeWrapper = (props) => { - const { editor, element, path } = props; - +export const BlockDraggable: RenderNodeWrapper = ({ editor, element, path }) => { const enabled = React.useMemo(() => { if (path.length === 1 && !isType(editor, element, UNDRAGGABLE_KEYS)) { return true; @@ -60,6 +58,7 @@ export const BlockDraggable: RenderNodeWrapper = (props) => { if (!enabled) return; + // Return a function that renders the Draggable component return (props) => ; }; @@ -201,7 +200,7 @@ const DropLine = React.memo(function DropLine({ className={cn( 'slate-dropLine', 'absolute inset-x-0 h-0.5 opacity-100 transition-opacity', - 'bg-brand/50', + 'bg-primary/50', dropLine === 'top' && '-top-px', dropLine === 'bottom' && '-bottom-px', className diff --git a/apps/web/src/components/ui/report/elements/BlockList.tsx b/apps/web/src/components/ui/report/elements/BlockList.tsx new file mode 100644 index 000000000..6ff35bea1 --- /dev/null +++ b/apps/web/src/components/ui/report/elements/BlockList.tsx @@ -0,0 +1,71 @@ +'use client'; + +import React from 'react'; + +import type { TListElement } from 'platejs'; + +import { isOrderedList } from '@platejs/list'; +import { useTodoListElement, useTodoListElementState } from '@platejs/list/react'; +import { type PlateElementProps, type RenderNodeWrapper, useReadOnly } from 'platejs/react'; + +import { Checkbox } from '@/components/ui/checkbox'; +import { cn } from '@/lib/utils'; + +const config: Record< + string, + { + Li: React.FC; + Marker: React.FC; + } +> = { + todo: { + Li: TodoLi, + Marker: TodoMarker + } +}; + +export const BlockList: RenderNodeWrapper = (props) => { + if (!props.element.listStyleType) return; + + return (props) => ; +}; + +function List(props: PlateElementProps) { + const { listStart, listStyleType } = props.element as TListElement; + const { Li, Marker } = config[listStyleType] ?? {}; + const List = isOrderedList(props.element) ? 'ol' : 'ul'; + + return ( + + {Marker && } + {Li ?
  • :
  • {props.children}
  • } +
    + ); +} + +function TodoMarker(props: PlateElementProps) { + const state = useTodoListElementState({ element: props.element }); + const { checkboxProps } = useTodoListElement(state); + const readOnly = useReadOnly(); + + return ( +
    + +
    + ); +} + +function TodoLi(props: PlateElementProps) { + return ( +
  • + {props.children} +
  • + ); +} diff --git a/apps/web/src/components/ui/report/elements/ColumnNode.tsx b/apps/web/src/components/ui/report/elements/ColumnNode.tsx index 35f4a6ef9..d43d23fd0 100644 --- a/apps/web/src/components/ui/report/elements/ColumnNode.tsx +++ b/apps/web/src/components/ui/report/elements/ColumnNode.tsx @@ -115,7 +115,7 @@ function DropLine() {