Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
c439952a
Unverified
Commit
c439952a
authored
Mar 06, 2024
by
Rhon Joe
Committed by
GitHub
Mar 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(web): chat input auto resize by window (#2696)
parent
2f28afeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
index.tsx
web/app/components/base/chat/chat/index.tsx
+12
-3
No files found.
web/app/components/base/chat/chat/index.tsx
View file @
c439952a
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
}
from
'react'
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
useThrottleEffect
}
from
'ahooks'
import
{
useThrottleEffect
}
from
'ahooks'
import
{
debounce
}
from
'lodash-es'
import
type
{
import
type
{
ChatConfig
,
ChatConfig
,
ChatItem
,
ChatItem
,
...
@@ -81,16 +82,24 @@ const Chat: FC<ChatProps> = ({
...
@@ -81,16 +82,24 @@ const Chat: FC<ChatProps> = ({
chatContainerRef
.
current
.
scrollTop
=
chatContainerRef
.
current
.
scrollHeight
chatContainerRef
.
current
.
scrollTop
=
chatContainerRef
.
current
.
scrollHeight
}
}
useThrottleEffect
(()
=>
{
const
handleWindowResize
=
()
=>
{
handleScrolltoBottom
()
if
(
chatContainerRef
.
current
&&
chatFooterRef
.
current
)
if
(
chatContainerRef
.
current
&&
chatFooterRef
.
current
)
chatFooterRef
.
current
.
style
.
width
=
`
${
chatContainerRef
.
current
.
clientWidth
}
px`
chatFooterRef
.
current
.
style
.
width
=
`
${
chatContainerRef
.
current
.
clientWidth
}
px`
if
(
chatContainerInnerRef
.
current
&&
chatFooterInnerRef
.
current
)
if
(
chatContainerInnerRef
.
current
&&
chatFooterInnerRef
.
current
)
chatFooterInnerRef
.
current
.
style
.
width
=
`
${
chatContainerInnerRef
.
current
.
clientWidth
}
px`
chatFooterInnerRef
.
current
.
style
.
width
=
`
${
chatContainerInnerRef
.
current
.
clientWidth
}
px`
}
useThrottleEffect
(()
=>
{
handleScrolltoBottom
()
handleWindowResize
()
},
[
chatList
],
{
wait
:
500
})
},
[
chatList
],
{
wait
:
500
})
useEffect
(()
=>
{
window
.
addEventListener
(
'resize'
,
debounce
(
handleWindowResize
))
return
()
=>
window
.
removeEventListener
(
'resize'
,
handleWindowResize
)
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
chatFooterRef
.
current
&&
chatContainerRef
.
current
)
{
if
(
chatFooterRef
.
current
&&
chatContainerRef
.
current
)
{
const
resizeObserver
=
new
ResizeObserver
((
entries
)
=>
{
const
resizeObserver
=
new
ResizeObserver
((
entries
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment