This commit is contained in:
Jaiwanth 2021-07-21 11:48:37 +05:30
parent 1ed316851a
commit 6dd3631a17
5 changed files with 22 additions and 23 deletions

View file

@ -125,7 +125,6 @@ export function presentableTextForFile(content: IContent, withSize = true): stri
interface IProps extends IBodyProps {
/* whether or not to show the default placeholder for the file. Defaults to true. */
showGenericPlaceholder: boolean;
forExport?: boolean;
}
interface IState {

View file

@ -63,7 +63,7 @@ export default class HTMLExporter extends Exporter {
name={this.room.name}
title={this.room.name}
url={blob ? avatarPath : null}
resizeMethod={"crop"}
resizeMethod="crop"
/>
);
return renderToStaticMarkup(avatar);
@ -232,7 +232,7 @@ export default class HTMLExporter extends Exporter {
return renderToStaticMarkup(dateSeparator);
}
protected _wantsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
protected needsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
if (prevEvent == null) return true;
return wantsDateSeparator(prevEvent.getDate(), event.getDate());
}
@ -341,8 +341,8 @@ export default class HTMLExporter extends Exporter {
if (this.cancelled) return this.cleanUp();
if (!haveTileForEvent(event)) continue;
content += this._wantsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
const shouldBeJoined = !this._wantsDateSeparator(event, prevEvent)
content += this.needsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
const shouldBeJoined = !this.needsDateSeparator(event, prevEvent)
&& shouldFormContinuation(prevEvent, event, false);
const body = await this.createMessageBody(event, shouldBeJoined);
this.totalSize += Buffer.byteLength(body);

View file

@ -59,7 +59,7 @@ export default class PlainTextExporter extends Exporter {
return `<${rplName}${rplSource}> ${rplText}`;
};
protected _textForEvent = async (mxEv: MatrixEvent) => {
protected plainTextForEvent = async (mxEv: MatrixEvent) => {
const senderDisplayName = mxEv.sender && mxEv.sender.name ? mxEv.sender.name : mxEv.getSender();
let mediaText = "";
if (this.isAttachment(mxEv)) {
@ -94,7 +94,7 @@ export default class PlainTextExporter extends Exporter {
this.updateProgress(`Processing event ${i + 1} out of ${events.length}`, false, true);
if (this.cancelled) return this.cleanUp();
if (!haveTileForEvent(event)) continue;
const textForEvent = await this._textForEvent(event);
const textForEvent = await this.plainTextForEvent(event);
content += textForEvent && `${new Date(event.getTs()).toLocaleString()} - ${textForEvent}\n`;
}
return content;