Implement render flags
This commit is contained in:
parent
46b69b3873
commit
dee22f7120
3 changed files with 6 additions and 5 deletions
|
@ -56,7 +56,7 @@ export class MessageComposer extends TemplateView {
|
|||
className: "cancel",
|
||||
onClick: () => this._clearReplyingTo()
|
||||
}, "Close"),
|
||||
t.view(new View(rvm, false, "div"))
|
||||
t.view(new View(rvm, { interactive: false }, "div"))
|
||||
])
|
||||
});
|
||||
const input = t.div({className: "MessageComposer_input"}, [
|
||||
|
|
|
@ -24,12 +24,13 @@ import {Menu} from "../../../general/Menu.js";
|
|||
import {ReactionsView} from "./ReactionsView.js";
|
||||
|
||||
export class BaseMessageView extends TemplateView {
|
||||
constructor(value, interactive = true, tagName = "li") {
|
||||
constructor(value, renderFlags, 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._interactive = interactive;
|
||||
this._interactive = renderFlags?.interactive ?? true;
|
||||
this._isReplyPreview = renderFlags?.reply;
|
||||
}
|
||||
|
||||
render(t, vm) {
|
||||
|
@ -54,7 +55,7 @@ export class BaseMessageView extends TemplateView {
|
|||
if (isContinuation && wasContinuation === false) {
|
||||
li.removeChild(li.querySelector(".Timeline_messageAvatar"));
|
||||
li.removeChild(li.querySelector(".Timeline_messageSender"));
|
||||
} else if (!isContinuation && this._interactive) {
|
||||
} else if (!isContinuation && !this._isReplyPreview) {
|
||||
const avatar = tag.a({href: vm.memberPanelLink, className: "Timeline_messageAvatar"}, [renderStaticAvatar(vm, 30)]);
|
||||
const sender = tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName);
|
||||
li.insertBefore(avatar, li.firstChild);
|
||||
|
|
|
@ -26,7 +26,7 @@ export class ReplyPreviewView extends TemplateView {
|
|||
_renderReplyPreview(t, vm) {
|
||||
// todo: this should probably be called viewClassForTile instead
|
||||
const viewClass = viewClassForEntry(vm);
|
||||
const view = new viewClass(vm, false)
|
||||
const view = new viewClass(vm, { reply: true, interactive: false });
|
||||
const rendered = view.render(t, vm);
|
||||
return this._renderReplyHeader(t, vm, [rendered]);
|
||||
}
|
||||
|
|
Reference in a new issue