mirror of
https://github.com/nextcloud/spreed.git
synced 2025-08-16 15:27:59 +00:00
fix(chat): remove 'message-height-changed' event
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
This commit is contained in:
@ -5,8 +5,6 @@
|
||||
|
||||
<template>
|
||||
<div ref="messageMain"
|
||||
v-element-size="[onResize, { width: 0, height: 22.5 }]"
|
||||
v-intersection-observer="onIntersectionObserver"
|
||||
class="message-main">
|
||||
<!-- System or deleted message body content -->
|
||||
<div v-if="isSystemMessage || isDeletedMessage"
|
||||
@ -130,7 +128,6 @@
|
||||
import { showError, showSuccess } from '@nextcloud/dialogs'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import moment from '@nextcloud/moment'
|
||||
import { vElementSize as ElementSize, vIntersectionObserver as IntersectionObserver } from '@vueuse/components'
|
||||
import emojiRegex from 'emoji-regex'
|
||||
import { inject, toRefs } from 'vue'
|
||||
import NcButton from '@nextcloud/vue/components/NcButton'
|
||||
@ -181,11 +178,6 @@ export default {
|
||||
ReloadIcon,
|
||||
},
|
||||
|
||||
directives: {
|
||||
IntersectionObserver,
|
||||
ElementSize,
|
||||
},
|
||||
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
@ -238,8 +230,6 @@ export default {
|
||||
showReloadButton: false,
|
||||
currentCodeBlock: null,
|
||||
copyButtonOffset: 0,
|
||||
isVisible: false,
|
||||
previousSize: { width: 0, height: 22.5 }, // default height of one-line message body without widgets
|
||||
}
|
||||
},
|
||||
|
||||
@ -491,29 +481,6 @@ export default {
|
||||
this.isEditing = value
|
||||
}
|
||||
},
|
||||
|
||||
onIntersectionObserver([{ isIntersecting }]) {
|
||||
this.isVisible = isIntersecting
|
||||
},
|
||||
|
||||
onResize({ width, height }) {
|
||||
const oldWidth = this.previousSize?.width
|
||||
const oldHeight = this.previousSize?.height
|
||||
this.previousSize = { width, height }
|
||||
|
||||
if (!this.isVisible) {
|
||||
return
|
||||
}
|
||||
if (oldWidth && oldWidth !== width) {
|
||||
// Resizing messages list
|
||||
return
|
||||
}
|
||||
if (height === 0) {
|
||||
// component is unmounted
|
||||
return
|
||||
}
|
||||
EventBus.emit('message-height-changed', { heightDiff: height - oldHeight })
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -329,7 +329,6 @@ export default {
|
||||
EventBus.on('scroll-chat-to-bottom', this.scrollToBottom)
|
||||
EventBus.on('focus-message', this.focusMessage)
|
||||
EventBus.on('route-change', this.onRouteChange)
|
||||
EventBus.on('message-height-changed', this.onMessageHeightChanged)
|
||||
window.addEventListener('focus', this.onWindowFocus)
|
||||
|
||||
this.resizeObserver = new ResizeObserver(this.updateSize)
|
||||
@ -344,7 +343,6 @@ export default {
|
||||
EventBus.off('scroll-chat-to-bottom', this.scrollToBottom)
|
||||
EventBus.off('focus-message', this.focusMessage)
|
||||
EventBus.off('route-change', this.onRouteChange)
|
||||
EventBus.off('message-height-changed', this.onMessageHeightChanged)
|
||||
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect()
|
||||
@ -1088,11 +1086,6 @@ export default {
|
||||
return group.isSystemMessagesGroup ? MessagesSystemGroup : MessagesGroup
|
||||
},
|
||||
|
||||
onMessageHeightChanged({ heightDiff }) {
|
||||
// scroll down by the height difference
|
||||
this.$refs.scroller.scrollTop += heightDiff
|
||||
},
|
||||
|
||||
updateTasksCount() {
|
||||
if (!this.$refs.scroller) {
|
||||
return
|
||||
|
@ -31,7 +31,6 @@ export type Events = {
|
||||
'focus-message': number // TODO: listener method can receive ...[messageId, smooth, highlightAnimation]
|
||||
'forbidden-route': { error: string }
|
||||
'joined-conversation': { token: string }
|
||||
'message-height-changed': { heightDiff: number }
|
||||
'poll-drafts-open': { token: string, selector?: string }
|
||||
'poll-editor-open': { token: string, id: number | null, fromDrafts: boolean, action?: string, selector?: string }
|
||||
'refresh-peer-list': void
|
||||
|
Reference in New Issue
Block a user