also apply custom tiles in reply preview in composer

This commit is contained in:
Bruno Windels 2022-04-08 15:16:22 +02:00
parent d21d10e4f2
commit cf780ce259
2 changed files with 7 additions and 7 deletions

View file

@ -17,11 +17,11 @@ limitations under the License.
import {TemplateView} from "../../general/TemplateView";
import {Popup} from "../../general/Popup.js";
import {Menu} from "../../general/Menu.js";
import {viewClassForTile} from "./common"
export class MessageComposer extends TemplateView {
constructor(viewModel) {
constructor(viewModel, viewClassForTile) {
super(viewModel);
this._viewClassForTile = viewClassForTile;
this._input = null;
this._attachmentPopup = null;
this._focusInput = null;
@ -45,8 +45,8 @@ export class MessageComposer extends TemplateView {
this._focusInput = () => this._input.focus();
this.value.on("focus", this._focusInput);
const replyPreview = t.map(vm => vm.replyViewModel, (rvm, t) => {
const View = rvm && viewClassForTile(rvm);
if (!View) { return null; }
const TileView = rvm && this._viewClassForTile(rvm);
if (!TileView) { return null; }
return t.div({
className: "MessageComposer_replyPreview"
}, [
@ -55,8 +55,8 @@ export class MessageComposer extends TemplateView {
className: "cancel",
onClick: () => this._clearReplyingTo()
}, "Close"),
t.view(new View(rvm, { interactive: false }, "div"))
])
t.view(new TileView(rvm, this._viewClassForTile, { interactive: false }, "div"))
]);
});
const input = t.div({className: "MessageComposer_input"}, [
this._input,

View file

@ -34,7 +34,7 @@ export class RoomView extends TemplateView {
render(t, vm) {
let bottomView;
if (vm.composerViewModel.kind === "composer") {
bottomView = new MessageComposer(vm.composerViewModel);
bottomView = new MessageComposer(vm.composerViewModel, this._viewClassForTile);
} else if (vm.composerViewModel.kind === "archived") {
bottomView = new RoomArchivedView(vm.composerViewModel);
}