diff --git a/.changeset/quiet-squids-travel.md b/.changeset/quiet-squids-travel.md new file mode 100644 index 0000000000..c44f0e7bef --- /dev/null +++ b/.changeset/quiet-squids-travel.md @@ -0,0 +1,5 @@ +--- +"@udecode/plate-dnd": patch +--- + +Fix `handleRef` type diff --git a/packages/dnd/src/components/useDraggable.ts b/packages/dnd/src/components/useDraggable.ts index a39411a280..b9cee9cf21 100644 --- a/packages/dnd/src/components/useDraggable.ts +++ b/packages/dnd/src/components/useDraggable.ts @@ -1,16 +1,20 @@ import React from 'react'; import { TEditor, TElement } from '@udecode/plate-common'; -import { ConnectDragSource, DropTargetMonitor } from 'react-dnd'; +import { DropTargetMonitor } from 'react-dnd'; import { DragItemNode, DropLineDirection, useDndBlock } from '..'; +import type { ReactElement, RefObject } from 'react'; + export type DraggableState = { dropLine: DropLineDirection; isHovered: boolean; setIsHovered: (isHovered: boolean) => void; isDragging: boolean; nodeRef: React.RefObject; - dragRef: ConnectDragSource; + dragRef: ( + elementOrNode: RefObject | ReactElement | Element | null + ) => void; }; export const useDraggableState = (props: {