diff --git a/src/components/timeline.vue b/src/components/timeline.vue
index 661dc22..6dd2444 100644
--- a/src/components/timeline.vue
+++ b/src/components/timeline.vue
@@ -29,10 +29,10 @@
:key="event.origin_server_ts"
:class="groupTimeline?'indent event':'event'"
:title="`${group[0].sender} at ${getTime(event.origin_server_ts)}`"
- @contextmenu.prevent="setReplyTo(event)"
+ @contextmenu.prevent.native="setReplyTo(event)"
:type="event.sender === user?'send':'receive'"
:event="event"
- :on-update="()=>onUpdate()"
+ :on-update="onUpdate"
/>
diff --git a/src/views/chat.vue b/src/views/chat.vue
index df6c343..faeaee0 100644
--- a/src/views/chat.vue
+++ b/src/views/chat.vue
@@ -7,16 +7,17 @@
-
+
@@ -28,6 +29,7 @@ import {matrix} from '@/main';
import splitArray from '@/lib/splitArray.js'
import timeline from '@/components/timeline';
import scrollHandler from '@/lib/scrollHandler';
+import {getUser} from "@/lib/matrixUtils";
export default {
name: 'chat',
@@ -48,8 +50,9 @@ export default {
if (this.$refs.timelineContainer.scrollTop < 400 && this.loadingStatus !== 'loading') this.loadEvents();
this.showScrollBtn = this.scroll.getScrollBottom() > 500;
},
- resize(height = this.$refs.newMessage.clientHeight){
+ resize(height = this.$refs.newMessage.$refs.newMessageBanner.clientHeight){
this.$refs.chatContainer.style.height = `calc(100% - ${height}px - 3.5rem)`;
+ this.manageScrollBottom();
},
isGroup(){
return Object.keys(this.room.currentState.members).length > 2;
@@ -61,9 +64,19 @@ export default {
this.loadingStatus = 'load more';
this.scroll.setScrollBottom(scrollBottom)
},
- getUser(userId){
- return matrix.client.getUser(userId);
+ setReplyTo(event){
+ this.replyTo=event;
+ this.$refs.newMessage.focusInput();
+ this.$nextTick(this.resize);
},
+ resetReplyTo(){
+ this.replyTo=undefined;
+ this.$nextTick(this.resize);
+ },
+ manageScrollBottom(){
+ if(this.scroll.getScrollBottom() < 400 && this.loadingStatus !== 'loading') this.scroll.scrollToBottom();
+ },
+ getUser,
splitArray
},
data(){
@@ -76,7 +89,7 @@ export default {
}
},
updated(){
- if(this.scroll.getScrollBottom() < 400 && this.loadingStatus !== 'loading') this.scroll.scrollToBottom();
+ this.manageScrollBottom();
},
mounted(){
this.scroll = new scrollHandler(this.$refs.timelineContainer);