From ee093a21c83770a47193d13869ca2dfd0c0263d8 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 27 Mar 2026 16:01:40 +0800 Subject: [PATCH] fix: click file missing --- .../__tests__/component.spec.tsx | 4 +++- .../plugins/file-reference-block/component.tsx | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/__tests__/component.spec.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/__tests__/component.spec.tsx index b363789d4d..ed4063f26b 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/__tests__/component.spec.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/__tests__/component.spec.tsx @@ -77,7 +77,9 @@ describe('FileReferenceBlock', () => { ) await act(async () => { - fireEvent.mouseDown(screen.getByText('contract.pdf')) + const target = screen.getByText('contract.pdf') + fireEvent.mouseDown(target) + fireEvent.click(target) }) expect(await screen.findByText('workflow.skillEditor.referenceFiles')).toBeInTheDocument() diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx index 973dfe9134..20e26f66d6 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/component.tsx @@ -163,7 +163,21 @@ const FileReferenceBlock = ({ nodeKey, resourceId }: FileReferenceBlockProps) => const fileBlock = ( { + if (!nextOpen && eventDetails.reason === 'focus-out') + return + + if ( + !nextOpen + && eventDetails.reason === 'outside-press' + && eventDetails.event.target instanceof Node + && ref.current?.contains(eventDetails.event.target) + ) { + return + } + + setOpen(nextOpen) + }} >