mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
pass features to tilesCreator (and all options really for comfort)
This commit is contained in:
parent
d5929d9ebe
commit
f86663fe7b
@ -209,7 +209,7 @@ export class RoomViewModel extends ErrorReportViewModel {
|
|||||||
|
|
||||||
_createTile(entry) {
|
_createTile(entry) {
|
||||||
if (this._tileOptions) {
|
if (this._tileOptions) {
|
||||||
const Tile = this._tileOptions.tileClassForEntry(entry);
|
const Tile = this._tileOptions.tileClassForEntry(entry, this._tileOptions);
|
||||||
if (Tile) {
|
if (Tile) {
|
||||||
return new Tile(entry, this._tileOptions);
|
return new Tile(entry, this._tileOptions);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_createTile(entry) {
|
_createTile(entry) {
|
||||||
const Tile = this._tileOptions.tileClassForEntry(entry);
|
const Tile = this._tileOptions.tileClassForEntry(entry, this._tileOptions);
|
||||||
if (Tile) {
|
if (Tile) {
|
||||||
return new Tile(entry, this._tileOptions);
|
return new Tile(entry, this._tileOptions);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
if (action?.shouldReplace || !this._replyTile) {
|
if (action?.shouldReplace || !this._replyTile) {
|
||||||
this.disposeTracked(this._replyTile);
|
this.disposeTracked(this._replyTile);
|
||||||
const tileClassForEntry = this._options.tileClassForEntry;
|
const tileClassForEntry = this._options.tileClassForEntry;
|
||||||
const ReplyTile = tileClassForEntry(replyEntry);
|
const ReplyTile = tileClassForEntry(replyEntry, this._options);
|
||||||
if (ReplyTile) {
|
if (ReplyTile) {
|
||||||
this._replyTile = new ReplyTile(replyEntry, this._options);
|
this._replyTile = new ReplyTile(replyEntry, this._options);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ export type Options = ViewModelOptions & {
|
|||||||
};
|
};
|
||||||
export type TileConstructor = new (entry: TimelineEntry, options: Options) => ITile;
|
export type TileConstructor = new (entry: TimelineEntry, options: Options) => ITile;
|
||||||
|
|
||||||
export function tileClassForEntry(entry: TimelineEntry): TileConstructor | undefined {
|
export function tileClassForEntry(entry: TimelineEntry, options: Options): TileConstructor | undefined {
|
||||||
if (entry.isGap) {
|
if (entry.isGap) {
|
||||||
return GapTile;
|
return GapTile;
|
||||||
} else if (entry.isPending && entry.pendingEvent.isMissingAttachments) {
|
} else if (entry.isPending && entry.pendingEvent.isMissingAttachments) {
|
||||||
|
Loading…
Reference in New Issue
Block a user