Avoid inserting li tags outside a list

This commit is contained in:
Danila Fedorin 2021-07-22 12:51:24 -07:00
parent 66f686210f
commit 013f187dc2
2 changed files with 6 additions and 4 deletions

View file

@ -41,7 +41,7 @@ export class MessageComposer extends TemplateView {
t.span('Replying'),
t.span({onClick: () => this._clearReplyingTo()}, 'Close'),
// TODO need proper view, not just assumed TextMessageView
t.view(new TextMessageView(vm.replyViewModel, true))
t.view(new TextMessageView(vm.replyViewModel, true, "div"))
])
),
this._input,

View file

@ -24,20 +24,22 @@ import {Menu} from "../../../general/Menu.js";
import {ReactionsView} from "./ReactionsView.js";
export class BaseMessageView extends TemplateView {
constructor(value, disabled = false) {
constructor(value, disabled = false, tagName = "li") {
super(value);
this._menuPopup = null;
this._tagName = tagName;
// TODO An enum could be nice to make code
// easier to read at call sites.
this._disabled = disabled;
}
render(t, vm) {
const li = t.li({className: {
const li = t.el(this._tagName, {className: {
"Timeline_message": true,
own: vm.isOwn,
unsent: vm.isUnsent,
unverified: vm.isUnverified,
disabled: this._disabled,
continuation: vm => vm.isContinuation,
}}, [
// dynamically added and removed nodes are handled below
@ -115,8 +117,8 @@ export class BaseMessageView extends TemplateView {
const options = [];
if (vm.canReact && vm.shape !== "redacted") {
options.push(new QuickReactionsMenuOption(vm));
options.push(Menu.option(vm.i18n`Reply`, () => vm.startReply()));
}
options.push(Menu.option(vm.i18n`Reply`, () => vm.startReply()));
if (vm.canAbortSending) {
options.push(Menu.option(vm.i18n`Cancel`, () => vm.abortSending()));
} else if (vm.canRedact) {