Commit 97530776 authored by StyleZhang's avatar StyleZhang

fix

parent 22e7393b
......@@ -340,11 +340,12 @@ export const useWorkflow = () => {
return
const newNodes = produce(nodes, (draft) => {
draft.forEach(node => node.data.selected = false)
const selectedNode = draft.find(node => node.id === nodeId)!
if (!cancelSelection && selectedNode)
selectedNode.data.selected = true
draft.forEach((node) => {
if (node.id === nodeId)
node.data.selected = !cancelSelection
else
node.data.selected = false
})
})
setNodes(newNodes)
handleSyncWorkflowDraft()
......
......@@ -5,6 +5,7 @@ import {
useMemo,
} from 'react'
import useSWR from 'swr'
import { setAutoFreeze } from 'immer'
import { useKeyPress } from 'ahooks'
import ReactFlow, {
Background,
......@@ -65,6 +66,14 @@ const Workflow: FC<WorkflowProps> = memo(({
const showFeaturesPanel = useStore(state => state.showFeaturesPanel)
const runningStatus = useStore(s => s.runningStatus)
useEffect(() => {
setAutoFreeze(false)
return () => {
setAutoFreeze(true)
}
}, [])
const {
handleSyncWorkflowDraft,
......
......@@ -50,7 +50,7 @@ export const NodeTargetHandle = ({
type='target'
position={Position.Left}
className={`
!w-4 !h-4 !bg-transparent !rounded-none !outline-none !border-none !translate-y-0 z-[1]
!w-4 !h-4 !bg-transparent !rounded-none !outline-none !border-none z-[1]
after:absolute after:w-0.5 after:h-2 after:left-1.5 after:top-1 after:bg-primary-500
${!connected && 'after:opacity-0'}
${data.type === BlockEnum.Start && 'opacity-0'}
......@@ -111,7 +111,7 @@ export const NodeSourceHandle = ({
type='source'
position={Position.Right}
className={`
!w-4 !h-4 !bg-transparent !rounded-none !outline-none !border-none !translate-y-0 z-[1]
!w-4 !h-4 !bg-transparent !rounded-none !outline-none !border-none z-[1]
after:absolute after:w-0.5 after:h-2 after:right-1.5 after:top-1 after:bg-primary-500
${!connected && 'after:opacity-0'}
${handleClassName}
......
......@@ -54,7 +54,7 @@ const BaseNode: FC<BaseNodeProps> = ({
<NodeTargetHandle
id={id}
data={data}
handleClassName='!top-4 !-left-[9px]'
handleClassName='!top-4 !-left-[9px] !translate-y-0'
handleId='target'
/>
)
......@@ -64,7 +64,7 @@ const BaseNode: FC<BaseNodeProps> = ({
<NodeSourceHandle
id={id}
data={data}
handleClassName='!top-4 !-right-[9px]'
handleClassName='!top-4 !-right-[9px] !translate-y-0'
handleId='source'
/>
)
......
......@@ -9,7 +9,7 @@ import { Variable02 } from '@/app/components/base/icons/src/vender/solid/develop
const i18nPrefix = 'workflow.nodes.ifElse'
const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
const { id, data } = props
const { data } = props
const { t } = useTranslation()
const { conditions, logical_operator } = data
......@@ -20,7 +20,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
<NodeSourceHandle
{...props}
handleId='true'
handleClassName='!top-1 !-right-[21px]'
handleClassName='!top-1/2 !-right-[21px] !-translate-y-1/2'
/>
</div>
<div className='mb-0.5 leading-4 text-[10px] font-medium text-gray-500 uppercase'>{t(`${i18nPrefix}.conditions`)}</div>
......@@ -44,7 +44,7 @@ const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
<NodeSourceHandle
{...props}
handleId='false'
handleClassName='!top-1 !-right-[21px]'
handleClassName='!top-1/2 !-right-[21px] !-translate-y-1/2'
/>
</div>
</div>
......
......@@ -45,7 +45,7 @@ const Node: FC<NodeProps<QuestionClassifierNodeType>> = (props) => {
/>
<NodeSourceHandle
{...props}
handleId={topic.name}
handleId={topic.id}
handleClassName='!top-1/2 !-translate-y-1/2 !-right-[21px]'
/>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment