diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx index eb13a760e2..83873dd9b3 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx @@ -20,11 +20,17 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => { const onDrop = async (event: SyntheticEvent) => { event.preventDefault() - console.log('drop', event) + const target = await getEventTarget(event) - const dragDestination = getFlatTreeItem(target.path) - console.log(getFlatTreeItem) - console.log('drop', target, dragDestination, dragSource) + let dragDestination: any + if(!target || !target.path) { + dragDestination = { + path: '/', + isDirectory: true + } + }else{ + dragDestination = getFlatTreeItem(target.path) + } if (dragDestination.isDirectory) { if (dragSource.isDirectory) { diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx index 29f5a87704..71898dab4c 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree.tsx @@ -102,10 +102,10 @@ export const FlatTree = (props: FlatTreeProps) => { } const handleContextMenu = async (e: any) => { - e.preventDefault() - e.stopPropagation() const target = await getEventTarget(e) if (target) { + e.preventDefault() + e.stopPropagation() props.handleContextMenu(e.pageX, e.pageY, target.path, target.content, target.type) } } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 1474c7bb71..1ea36d70c0 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -912,7 +912,7 @@ export function Workspace() { handleContextMenu(e.pageX, e.pageY, ROOT_PATH, 'workspace', 'workspace') }} > -