Split composer into preview and input

This commit is contained in:
Danila Fedorin 2021-07-22 13:37:35 -07:00
parent 013f187dc2
commit 1dcfdfc1d8

View File

@ -33,17 +33,17 @@ export class MessageComposer extends TemplateView {
onKeydown: e => this._onKeyDown(e), onKeydown: e => this._onKeyDown(e),
onInput: () => vm.setInput(this._input.value), onInput: () => vm.setInput(this._input.value),
}); });
return t.div({className: "MessageComposer"}, [ const replyPreview = t.map(vm => vm.replyViewModel, (rvm, t) => !rvm ? null :
t.map(vm => vm.replyViewModel, (rvm, t) => !rvm ? null : t.div({
t.div({ className: "MessageComposer_replyPreview"
className: "replyBox" }, [
}, [ t.span('Replying'),
t.span('Replying'), t.span({onClick: () => this._clearReplyingTo()}, 'Close'),
t.span({onClick: () => this._clearReplyingTo()}, 'Close'), // TODO need proper view, not just assumed TextMessageView
// TODO need proper view, not just assumed TextMessageView t.view(new TextMessageView(vm.replyViewModel, true, "div"))
t.view(new TextMessageView(vm.replyViewModel, true, "div")) ])
]) );
), const input = t.div({className: "MessageComposer_input"}, [
this._input, this._input,
t.button({ t.button({
className: "sendFile", className: "sendFile",
@ -57,6 +57,7 @@ export class MessageComposer extends TemplateView {
onClick: () => this._trySend(), onClick: () => this._trySend(),
}, vm.i18n`Send`), }, vm.i18n`Send`),
]); ]);
return t.div({ className: "MessageComposer" }, [replyPreview, input]);
} }
_clearReplyingTo() { _clearReplyingTo() {