forked from mystiq/hydrogen-web
also apply custom tiles in reply preview in composer
This commit is contained in:
parent
d21d10e4f2
commit
cf780ce259
2 changed files with 7 additions and 7 deletions
|
@ -17,11 +17,11 @@ limitations under the License.
|
||||||
import {TemplateView} from "../../general/TemplateView";
|
import {TemplateView} from "../../general/TemplateView";
|
||||||
import {Popup} from "../../general/Popup.js";
|
import {Popup} from "../../general/Popup.js";
|
||||||
import {Menu} from "../../general/Menu.js";
|
import {Menu} from "../../general/Menu.js";
|
||||||
import {viewClassForTile} from "./common"
|
|
||||||
|
|
||||||
export class MessageComposer extends TemplateView {
|
export class MessageComposer extends TemplateView {
|
||||||
constructor(viewModel) {
|
constructor(viewModel, viewClassForTile) {
|
||||||
super(viewModel);
|
super(viewModel);
|
||||||
|
this._viewClassForTile = viewClassForTile;
|
||||||
this._input = null;
|
this._input = null;
|
||||||
this._attachmentPopup = null;
|
this._attachmentPopup = null;
|
||||||
this._focusInput = null;
|
this._focusInput = null;
|
||||||
|
@ -45,8 +45,8 @@ export class MessageComposer extends TemplateView {
|
||||||
this._focusInput = () => this._input.focus();
|
this._focusInput = () => this._input.focus();
|
||||||
this.value.on("focus", this._focusInput);
|
this.value.on("focus", this._focusInput);
|
||||||
const replyPreview = t.map(vm => vm.replyViewModel, (rvm, t) => {
|
const replyPreview = t.map(vm => vm.replyViewModel, (rvm, t) => {
|
||||||
const View = rvm && viewClassForTile(rvm);
|
const TileView = rvm && this._viewClassForTile(rvm);
|
||||||
if (!View) { return null; }
|
if (!TileView) { return null; }
|
||||||
return t.div({
|
return t.div({
|
||||||
className: "MessageComposer_replyPreview"
|
className: "MessageComposer_replyPreview"
|
||||||
}, [
|
}, [
|
||||||
|
@ -55,8 +55,8 @@ export class MessageComposer extends TemplateView {
|
||||||
className: "cancel",
|
className: "cancel",
|
||||||
onClick: () => this._clearReplyingTo()
|
onClick: () => this._clearReplyingTo()
|
||||||
}, "Close"),
|
}, "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"}, [
|
const input = t.div({className: "MessageComposer_input"}, [
|
||||||
this._input,
|
this._input,
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class RoomView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
let bottomView;
|
let bottomView;
|
||||||
if (vm.composerViewModel.kind === "composer") {
|
if (vm.composerViewModel.kind === "composer") {
|
||||||
bottomView = new MessageComposer(vm.composerViewModel);
|
bottomView = new MessageComposer(vm.composerViewModel, this._viewClassForTile);
|
||||||
} else if (vm.composerViewModel.kind === "archived") {
|
} else if (vm.composerViewModel.kind === "archived") {
|
||||||
bottomView = new RoomArchivedView(vm.composerViewModel);
|
bottomView = new RoomArchivedView(vm.composerViewModel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue