mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 17:11:43 +00:00
Merge branch 'master' of https://github.com/supertiger1234/Nertivia---Client
This commit is contained in:
commit
b6f94c2b49
1 changed files with 37 additions and 0 deletions
|
|
@ -31,15 +31,24 @@
|
||||||
<news v-else/>
|
<news v-else/>
|
||||||
<div class="chat-input-area" v-if="selectedChannelID">
|
<div class="chat-input-area" v-if="selectedChannelID">
|
||||||
<div class="message-area">
|
<div class="message-area">
|
||||||
|
|
||||||
<input type="file" ref="sendFileBrowse" @change="attachmentChange" class="hidden">
|
<input type="file" ref="sendFileBrowse" @change="attachmentChange" class="hidden">
|
||||||
<div class="attachment-button" @click="attachmentButton">
|
<div class="attachment-button" @click="attachmentButton">
|
||||||
<i class="material-icons">attach_file</i>
|
<i class="material-icons">attach_file</i>
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<textarea
|
||||||
class="chat-input"
|
class="chat-input"
|
||||||
|
rows="1"
|
||||||
ref="input-box"
|
ref="input-box"
|
||||||
placeholder="Message"
|
placeholder="Message"
|
||||||
@keydown="chatInput"
|
@keydown="chatInput"
|
||||||
|
|
||||||
|
@keyup="delayedResize"
|
||||||
|
@change="resize"
|
||||||
|
@input="onInput"
|
||||||
|
v-model="message"
|
||||||
|
></textarea>
|
||||||
|
<button :class="{'send-button': true, 'error-send-button': messageLength > 5000}" @click="sendMessage">Send</button>
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
@paste="onPaste"
|
@paste="onPaste"
|
||||||
v-model="message"
|
v-model="message"
|
||||||
|
|
@ -168,6 +177,28 @@ export default {
|
||||||
await typingService.post(this.selectedChannelID);
|
await typingService.post(this.selectedChannelID);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resize(event) {
|
||||||
|
let input = this.$refs["input-box"]
|
||||||
|
|
||||||
|
if(input.scrollHeight < 50) {
|
||||||
|
input.style.height = '1em'
|
||||||
|
} else {
|
||||||
|
input.style.height = 'auto';
|
||||||
|
input.style.height = `calc(${input.scrollHeight}px - 1em)`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delayedResize(event) {
|
||||||
|
this.resize(event)
|
||||||
|
},
|
||||||
|
async onInput(event){
|
||||||
|
this.delayedResize(event)
|
||||||
|
|
||||||
|
this.messageLength = this.message.length;
|
||||||
|
const value = event.target.value.trim();
|
||||||
|
if (value && this.postTimerID == null) {
|
||||||
|
this.postTimer()
|
||||||
|
|
||||||
async onInput(event) {
|
async onInput(event) {
|
||||||
this.messageLength = this.message.length;
|
this.messageLength = this.message.length;
|
||||||
const value = event.target.value.trim();
|
const value = event.target.value.trim();
|
||||||
|
|
@ -178,6 +209,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chatInput(event) {
|
chatInput(event) {
|
||||||
|
this.delayedResize(event)
|
||||||
|
|
||||||
// when enter is press
|
// when enter is press
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
// and the shift key is not held
|
// and the shift key is not held
|
||||||
|
|
@ -414,6 +447,7 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input {
|
.chat-input {
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
background: rgba(0, 0, 0, 0.158);
|
background: rgba(0, 0, 0, 0.158);
|
||||||
|
|
@ -428,6 +462,9 @@ export default {
|
||||||
outline: none;
|
outline: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
height: 1em;
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 30vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input:hover {
|
.chat-input:hover {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue