2
0

🐛 (editor) Fix condition item drag and drop

This commit is contained in:
Baptiste Arnaud
2022-12-23 10:12:39 +01:00
parent 1a3869ae6d
commit 4109e63b7b
4 changed files with 113 additions and 89 deletions

View File

@ -1,26 +0,0 @@
import { Flex, FlexProps, useColorModeValue } from '@chakra-ui/react'
import { Item } from 'models'
import React, { ReactNode } from 'react'
type Props = {
item: Item
} & FlexProps
export const ItemNodeOverlay = ({ item, ...props }: Props) => {
return (
<Flex
px="4"
py="2"
rounded="md"
bgColor={useColorModeValue('white', 'gray.850')}
borderWidth="1px"
borderColor={useColorModeValue('gray.200', 'gray.700')}
w="212px"
pointerEvents="none"
shadow="lg"
{...props}
>
{(item.content ?? 'Click to edit') as ReactNode}
</Flex>
)
}

View File

@ -17,7 +17,6 @@ import { BlockIndices, BlockWithItems, LogicBlockType, Item } from 'models'
import React, { useEffect, useRef, useState } from 'react'
import { ItemNode } from './ItemNode'
import { SourceEndpoint } from '../../Endpoints'
import { ItemNodeOverlay } from './ItemNodeOverlay'
import { PlaceholderNode } from '../PlaceholderNode'
type Props = {
@ -164,7 +163,11 @@ export const ItemNodesList = ({
w="220px"
transformOrigin="0 0 0"
>
<ItemNodeOverlay item={draggedItem} />
<ItemNode
item={draggedItem}
indices={{ groupIndex, blockIndex, itemIndex: 0 }}
connectionDisabled
/>
</Flex>
</Portal>
)}