Convert input to textarea

Signed-off-by: RMidhunSuresh <hi@midhun.dev>
This commit is contained in:
RMidhunSuresh 2021-10-29 15:11:12 +05:30
parent abb802b881
commit 16bec0a656

View file

@ -28,11 +28,11 @@ export class MessageComposer extends TemplateView {
} }
render(t, vm) { render(t, vm) {
this._input = t.input({ this._input = t.textarea({
placeholder: vm.isEncrypted ? "Send an encrypted message…" : "Send a message…",
enterkeyhint: 'send', enterkeyhint: 'send',
onKeydown: e => this._onKeyDown(e), onKeydown: e => this._onKeyDown(e),
onInput: () => vm.setInput(this._input.value), onInput: () => vm.setInput(this._input.value),
placeholder: vm.isEncrypted ? "Send an encrypted message…" : "Send a message…"
}); });
this._focusInput = () => this._input.focus(); this._focusInput = () => this._input.focus();
this.value.on("focus", this._focusInput); this.value.on("focus", this._focusInput);
@ -86,7 +86,7 @@ export class MessageComposer extends TemplateView {
} }
_onKeyDown(event) { _onKeyDown(event) {
if (event.key === "Enter") { if (event.key === "Enter" && !event.shiftKey) {
this._trySend(); this._trySend();
} }
} }