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.

fix: update htmlContent type and wrap button in div for manualClose (#16716)

Wu Tianwei6a0f1dad7fc9
diff --git a/web/app/components/base/popover/index.tsx b/web/app/components/base/popover/index.tsx
index 2ea5b972de7..2a831e0c243 100644
--- a/web/app/components/base/popover/index.tsx
+++ b/web/app/components/base/popover/index.tsx
@@ -9,7 +9,7 @@ export type HtmlContentProps = {
type IPopover = {
className?: string
- htmlContent: React.ReactNode<HtmlContentProps>
+ htmlContent: React.ReactNode
popupClassName?: string
trigger?: 'click' | 'hover'
position?: 'bottom' | 'br' | 'bl'
@@ -90,7 +90,7 @@ export default function CustomPopover({
>
{({ close }) => (
<div
- className={cn('w-fit min-w-[130px] overflow-hidden rounded-lg bg-components-panel-bg shadow-lg ring-1 ring-black ring-opacity-5', popupClassName)}
+ className={cn('w-fit min-w-[130px] overflow-hidden rounded-lg bg-components-panel-bg shadow-lg ring-1 ring-black/5', popupClassName)}
{...(trigger !== 'hover'
? {}
: {
@@ -99,7 +99,7 @@ export default function CustomPopover({
})
}
>
- {cloneElement(htmlContent as React.ReactNode<HtmlContentProps>, {
+ {cloneElement(htmlContent as React.ReactElement, {
onClose: () => onMouseLeave(open),
...(manualClose
? {
diff --git a/web/app/components/datasets/documents/detail/segment-add/index.tsx b/web/app/components/datasets/documents/detail/segment-add/index.tsx
index 1f93cbb0394..d41118ec028 100644
--- a/web/app/components/datasets/documents/detail/segment-add/index.tsx
+++ b/web/app/components/datasets/documents/detail/segment-add/index.tsx
@@ -103,13 +103,16 @@ const SegmentAdd: FC<ISegmentAddProps> = ({
manualClose
trigger='click'
htmlContent={
- <button
- type='button'
- className='system-md-regular flex w-full items-center rounded-lg px-2 py-1.5 text-text-secondary'
- onClick={showBatchModal}
- >
- {t('datasetDocuments.list.action.batchAdd')}
- </button>
+ // need to wrapper the button with div when manualClose is true
+ <div className='w-full p-1'>
+ <button
+ type='button'
+ className='system-md-regular flex w-full items-center rounded-lg px-2 py-1.5 text-text-secondary'
+ onClick={showBatchModal}
+ >
+ {t('datasetDocuments.list.action.batchAdd')}
+ </button>
+ </div>
}
btnElement={
<div className='flex items-center justify-center' >