消除了两个空指针错误
This commit is contained in:
@@ -148,7 +148,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
|
|
||||||
const oldest = messagesList[0]
|
const oldest = messagesList[0]
|
||||||
setMessagesList(returnMsgs.concat(messagesList))
|
setMessagesList(returnMsgs.concat(messagesList))
|
||||||
setTimeout(() => chatPanelRef.current!.scrollTo({ top: $(`#chat_${target}_message_${oldest.id}`).get(0).offsetTop }), 200)
|
oldest && setTimeout(() => chatPanelRef.current!.scrollTo({ top: $(`#chat_${target}_message_${oldest.id}`).get(0).offsetTop }), 200)
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ customElements.define('chat-text', class extends HTMLElement {
|
|||||||
this.update()
|
this.update()
|
||||||
}
|
}
|
||||||
update() {
|
update() {
|
||||||
|
if (this.span == null) return
|
||||||
|
|
||||||
this.span.textContent = this.textContent
|
this.span.textContent = this.textContent
|
||||||
this.span.style.textDecoration = $(this).attr('underline') ? 'underline' : ''
|
this.span.style.textDecoration = $(this).attr('underline') ? 'underline' : ''
|
||||||
this.span.style.fontStyle = $(this).attr('em') ? 'italic' : ''
|
this.span.style.fontStyle = $(this).attr('em') ? 'italic' : ''
|
||||||
|
|||||||
Reference in New Issue
Block a user