Fix double input submit

This commit is contained in:
Pavel Djundik 2018-07-10 10:45:54 +03:00 committed by Pavel Djundik
parent 084e01cf46
commit 0a774758b9
3 changed files with 15 additions and 15 deletions

View file

@ -93,6 +93,19 @@ export default {
network: Object,
channel: Object,
},
watch: {
"channel.messages"() {
const el = this.$refs.chat;
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
return;
}
this.$nextTick(() => {
el.scrollTop = el.scrollHeight;
});
},
},
created() {
if (window.IntersectionObserver) {
this.historyObserver = new window.IntersectionObserver(loadMoreHistory, {
@ -114,19 +127,6 @@ export default {
this.historyObserver.disconnect();
}
},
watch: {
"channel.messages": function() {
const el = this.$refs.chat;
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
return;
}
this.$nextTick(() => {
el.scrollTop = el.scrollHeight;
});
}
},
methods: {
onShowMoreClick() {
let lastMessage = this.channel.messages[0];

View file

@ -13,7 +13,7 @@
:aria-label="getInputPlaceholder(channel)"
:disabled="!$root.connected"
class="mousetrap"
@keyup.enter="onSubmit"
@keypress.enter.prevent="onSubmit"
/>
<span
v-if="$root.connected"

View file

@ -12,7 +12,7 @@
<span class="content">
<span
v-for="(param, id) in message.params"
:key="id">{{ param }}</span>
:key="id">{{ param }} </span>
</span>
</template>
<template v-else-if="isAction()">