mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Implement render flags
This commit is contained in:
parent
46b69b3873
commit
dee22f7120
@ -56,7 +56,7 @@ export class MessageComposer extends TemplateView {
|
|||||||
className: "cancel",
|
className: "cancel",
|
||||||
onClick: () => this._clearReplyingTo()
|
onClick: () => this._clearReplyingTo()
|
||||||
}, "Close"),
|
}, "Close"),
|
||||||
t.view(new View(rvm, false, "div"))
|
t.view(new View(rvm, { interactive: false }, "div"))
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
const input = t.div({className: "MessageComposer_input"}, [
|
const input = t.div({className: "MessageComposer_input"}, [
|
||||||
|
@ -24,12 +24,13 @@ import {Menu} from "../../../general/Menu.js";
|
|||||||
import {ReactionsView} from "./ReactionsView.js";
|
import {ReactionsView} from "./ReactionsView.js";
|
||||||
|
|
||||||
export class BaseMessageView extends TemplateView {
|
export class BaseMessageView extends TemplateView {
|
||||||
constructor(value, interactive = true, tagName = "li") {
|
constructor(value, renderFlags, tagName = "li") {
|
||||||
super(value);
|
super(value);
|
||||||
this._menuPopup = null;
|
this._menuPopup = null;
|
||||||
this._tagName = tagName;
|
this._tagName = tagName;
|
||||||
// TODO An enum could be nice to make code easier to read at call sites.
|
// 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) {
|
render(t, vm) {
|
||||||
@ -54,7 +55,7 @@ export class BaseMessageView extends TemplateView {
|
|||||||
if (isContinuation && wasContinuation === false) {
|
if (isContinuation && wasContinuation === false) {
|
||||||
li.removeChild(li.querySelector(".Timeline_messageAvatar"));
|
li.removeChild(li.querySelector(".Timeline_messageAvatar"));
|
||||||
li.removeChild(li.querySelector(".Timeline_messageSender"));
|
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 avatar = tag.a({href: vm.memberPanelLink, className: "Timeline_messageAvatar"}, [renderStaticAvatar(vm, 30)]);
|
||||||
const sender = tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName);
|
const sender = tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName);
|
||||||
li.insertBefore(avatar, li.firstChild);
|
li.insertBefore(avatar, li.firstChild);
|
||||||
|
@ -26,7 +26,7 @@ export class ReplyPreviewView extends TemplateView {
|
|||||||
_renderReplyPreview(t, vm) {
|
_renderReplyPreview(t, vm) {
|
||||||
// todo: this should probably be called viewClassForTile instead
|
// todo: this should probably be called viewClassForTile instead
|
||||||
const viewClass = viewClassForEntry(vm);
|
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);
|
const rendered = view.render(t, vm);
|
||||||
return this._renderReplyHeader(t, vm, [rendered]);
|
return this._renderReplyHeader(t, vm, [rendered]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user