[vue.auth.channel] fix textearea cleared when message received
This commit is contained in:
parent
17a3438e5b
commit
32863dbe26
|
@ -22,7 +22,7 @@
|
|||
</section>
|
||||
|
||||
<section class='message-input'>
|
||||
<textarea :value='message' :placeholder='`Message #${gs.room.get(`text`).name}`' @keydown='keydown' @keyup='keyup'></textarea>
|
||||
<textarea v-model='message' :placeholder='`Message #${gs.room.get(`text`).name}`' @keydown='keydown' @keyup='keyup'></textarea>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
@ -44,6 +44,10 @@ export default {
|
|||
|
||||
}; },
|
||||
|
||||
beforeMount(){
|
||||
console.warn('beforeMount');
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
/* (1) Auto-grow text area
|
||||
|
@ -70,23 +74,6 @@ export default {
|
|||
// register pressed keys
|
||||
this.pressed[e.keyCode] = true;
|
||||
|
||||
// if not ENTER OR SHIFT -> do nothing
|
||||
if( e.keyCode !== 13 || this.pressed[16] )
|
||||
return;
|
||||
|
||||
|
||||
|
||||
// bufferize message + remove trailing line
|
||||
let buffer = e.target.value.replace(/\n*$/, '');
|
||||
this.message = buffer;
|
||||
|
||||
// send message
|
||||
if( !gs.get.content.send_message(buffer) )
|
||||
return;
|
||||
|
||||
// empty message
|
||||
this.message = '';
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
@ -98,6 +85,21 @@ export default {
|
|||
// unregister pressed keys
|
||||
this.pressed[e.keyCode] = false;
|
||||
|
||||
// if not ENTER OR SHIFT -> do nothing
|
||||
if( e.keyCode !== 13 || this.pressed[16] )
|
||||
return;
|
||||
|
||||
// bufferize message + remove trailing line
|
||||
this.message = this.message.replace(/\n*$/, '');
|
||||
|
||||
// send message
|
||||
if( !gs.get.content.send_message(this.message) )
|
||||
return;
|
||||
|
||||
// empty message
|
||||
this.message = '';
|
||||
this.auto_grow(e);
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue