Keep scroll position when scrolling up
This commit is contained in:
parent
dbe95fcc13
commit
499beb0257
@ -186,6 +186,16 @@ export default {
|
||||
}
|
||||
|
||||
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
|
||||
if (this.channel.historyLoading) {
|
||||
const heightOld = el.scrollHeight - el.scrollTop;
|
||||
|
||||
this.isWaitingForNextTick = true;
|
||||
this.$nextTick(() => {
|
||||
this.isWaitingForNextTick = false;
|
||||
el.scrollTop = el.scrollHeight - heightOld;
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const socket = require("../socket");
|
||||
const {findChannel} = require("../vue");
|
||||
const {vueApp, findChannel} = require("../vue");
|
||||
|
||||
socket.on("more", function(data) {
|
||||
const channel = findChannel(data.chan);
|
||||
@ -12,5 +12,8 @@ socket.on("more", function(data) {
|
||||
|
||||
channel.channel.moreHistoryAvailable = data.moreHistoryAvailable;
|
||||
channel.channel.messages.unshift(...data.messages);
|
||||
|
||||
vueApp.$nextTick(() => {
|
||||
channel.channel.historyLoading = false;
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user