fix drop context

flattentree
filip mertens 11 months ago
parent f00008ac41
commit 2b371bd562
  1. 14
      libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx
  2. 4
      libs/remix-ui/workspace/src/lib/components/flat-tree.tsx
  3. 2
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.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) {

@ -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)
}
}

@ -912,7 +912,7 @@ export function Workspace() {
handleContextMenu(e.pageX, e.pageY, ROOT_PATH, 'workspace', 'workspace')
}}
>
<div className="d-flex flex-column w-100 pb-4 mb-2 remixui_fileexplorer" data-id="remixUIWorkspaceExplorer" onClick={resetFocus}>
<div className="d-flex flex-column w-100 remixui_fileexplorer" data-id="remixUIWorkspaceExplorer" onClick={resetFocus}>
<div className='mb-1'>
<header>
<div className="mx-2 my-2 d-flex flex-column">

Loading…
Cancel
Save