yt-chat-components 1.7.3 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-chat-components",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "main": "build/static/js/bundle.min.js",
5
5
  "module": "build/static/js/bundle.min.js",
6
6
  "types": "build/static/js/index.d.ts",
@@ -193,6 +193,7 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
193
193
  const {registerChatMethods} = React.useContext(MethodContext) || {};
194
194
  let voiceChunks = []; // 临时存储录制的语音片段
195
195
  // 滚动事件处理,选择文件时,文件内容超出显示框时,显示左右箭头
196
+ const messageContainerRef = useRef<HTMLDivElement>(null);
196
197
 
197
198
  useImperativeHandle(ref, () => ({
198
199
  handleCallButtonClick:handleCallButtonClick
@@ -1248,6 +1249,10 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
1248
1249
  } else {
1249
1250
  handleSendMessage()
1250
1251
  }
1252
+ setTimeout(() => {
1253
+ const container = messageContainerRef.current;
1254
+ messageContainerRef.current.scrollTop = container.scrollHeight + 72;
1255
+ }, 200);
1251
1256
  }}
1252
1257
  onStartRecordClick={startConnectAndRecord}
1253
1258
  onStopRecordClick={stopRecord}
@@ -1548,6 +1553,7 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
1548
1553
  <div
1549
1554
  className="cl-messages_container"
1550
1555
  style={isMobile ? {paddingLeft: '0', paddingRight: '0'} : {}}
1556
+ ref={messageContainerRef}
1551
1557
  // style={{ maxWidth: '100%', minHeight:'300px', height:'700px', paddingBottom: '56px' }}
1552
1558
  >
1553
1559
  {