mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
Rename 'disabled' to 'interactive' in BaseMessageView
This commit is contained in:
parent
8956f6ecf4
commit
f0b6384ad7
@ -45,7 +45,7 @@ export class MessageComposer extends TemplateView {
|
|||||||
className: "cancel",
|
className: "cancel",
|
||||||
onClick: () => this._clearReplyingTo()
|
onClick: () => this._clearReplyingTo()
|
||||||
}, "Close"),
|
}, "Close"),
|
||||||
t.view(new View(rvm, true, "div"))
|
t.view(new View(rvm, false, "div"))
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
const input = t.div({className: "MessageComposer_input"}, [
|
const input = t.div({className: "MessageComposer_input"}, [
|
||||||
|
@ -24,12 +24,12 @@ 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, disabled = false, tagName = "li") {
|
constructor(value, interactive = true, 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._disabled = disabled;
|
this._interactive = interactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
@ -38,13 +38,13 @@ export class BaseMessageView extends TemplateView {
|
|||||||
own: vm.isOwn,
|
own: vm.isOwn,
|
||||||
unsent: vm.isUnsent,
|
unsent: vm.isUnsent,
|
||||||
unverified: vm.isUnverified,
|
unverified: vm.isUnverified,
|
||||||
disabled: this._disabled,
|
disabled: !this._interactive,
|
||||||
continuation: vm => vm.isContinuation,
|
continuation: vm => vm.isContinuation,
|
||||||
}}, [
|
}}, [
|
||||||
// dynamically added and removed nodes are handled below
|
// dynamically added and removed nodes are handled below
|
||||||
this.renderMessageBody(t, vm),
|
this.renderMessageBody(t, vm),
|
||||||
// should be after body as it is overlayed on top
|
// should be after body as it is overlayed on top
|
||||||
this._disabled ? [] : t.button({className: "Timeline_messageOptions"}, "⋯"),
|
this._interactive ? t.button({className: "Timeline_messageOptions"}, "⋯") : [],
|
||||||
]);
|
]);
|
||||||
// given that there can be many tiles, we don't add
|
// given that there can be many tiles, we don't add
|
||||||
// unneeded DOM nodes in case of a continuation, and we add it
|
// unneeded DOM nodes in case of a continuation, and we add it
|
||||||
@ -52,10 +52,10 @@ export class BaseMessageView extends TemplateView {
|
|||||||
// as the avatar or sender doesn't need any bindings or event handlers.
|
// as the avatar or sender doesn't need any bindings or event handlers.
|
||||||
// don't use `t` from within the side-effect callback
|
// don't use `t` from within the side-effect callback
|
||||||
t.mapSideEffect(vm => vm.isContinuation, (isContinuation, wasContinuation) => {
|
t.mapSideEffect(vm => vm.isContinuation, (isContinuation, wasContinuation) => {
|
||||||
if (isContinuation && !this._disabled && wasContinuation === false) {
|
if (isContinuation && this._interactive && 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._disabled) {
|
} else if (!isContinuation || !this._interactive) {
|
||||||
li.insertBefore(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild);
|
li.insertBefore(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild);
|
||||||
li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), li.firstChild);
|
li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), li.firstChild);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ export class BaseMessageView extends TemplateView {
|
|||||||
// but that adds a comment node to all messages without reactions
|
// but that adds a comment node to all messages without reactions
|
||||||
let reactionsView = null;
|
let reactionsView = null;
|
||||||
t.mapSideEffect(vm => vm.reactions, reactions => {
|
t.mapSideEffect(vm => vm.reactions, reactions => {
|
||||||
if (reactions && !this._disabled && !reactionsView) {
|
if (reactions && this._interactive && !reactionsView) {
|
||||||
reactionsView = new ReactionsView(vm.reactions);
|
reactionsView = new ReactionsView(vm.reactions);
|
||||||
this.addSubView(reactionsView);
|
this.addSubView(reactionsView);
|
||||||
li.appendChild(mountView(reactionsView));
|
li.appendChild(mountView(reactionsView));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user