Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: add keyboard shortcuts support for dialog confirmation (#15752)

诗浓e796937d0233
diff --git a/web/app/components/base/confirm/index.tsx b/web/app/components/base/confirm/index.tsx
index 813254cb3f3..62cf01cf191 100644
--- a/web/app/components/base/confirm/index.tsx
+++ b/web/app/components/base/confirm/index.tsx
@@ -46,13 +46,17 @@ function Confirm({
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Escape')
onCancel()
+ if (event.key === 'Enter' && isShow) {
+ event.preventDefault()
+ onConfirm()
+ }
}
document.addEventListener('keydown', handleKeyDown)
return () => {
document.removeEventListener('keydown', handleKeyDown)
}
- }, [onCancel])
+ }, [onCancel, onConfirm, isShow])
const handleClickOutside = (event: MouseEvent) => {
if (maskClosable && dialogRef.current && !dialogRef.current.contains(event.target as Node))