Add an abstract exporter base class
parent
1ee6e42e27
commit
136b6db047
|
@ -0,0 +1,7 @@
|
||||||
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
import Room from 'matrix-js-sdk/src/models/room';
|
||||||
|
|
||||||
|
export abstract class Exporter {
|
||||||
|
constructor(protected res: MatrixEvent[], protected room: Room) {}
|
||||||
|
abstract export(): Promise<void>
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import { textForEvent } from "../../TextForEvent";
|
||||||
import { Room } from 'matrix-js-sdk/src/models/room';
|
import { Room } from 'matrix-js-sdk/src/models/room';
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { getUserNameColorClass } from "../FormattingUtils";
|
import { getUserNameColorClass } from "../FormattingUtils";
|
||||||
|
import { Exporter } from "./Exporter";
|
||||||
|
|
||||||
const css = `
|
const css = `
|
||||||
body {
|
body {
|
||||||
|
@ -273,16 +273,12 @@ div.mx_selected {
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export default class HTMLExporter extends Exporter {
|
||||||
export default class HTMLExporter {
|
|
||||||
protected zip: JSZip;
|
protected zip: JSZip;
|
||||||
protected res: MatrixEvent[];
|
|
||||||
protected room: Room;
|
|
||||||
protected avatars: Map<string, boolean>;
|
protected avatars: Map<string, boolean>;
|
||||||
|
|
||||||
constructor(res: MatrixEvent[], room: Room) {
|
constructor(res: MatrixEvent[], room: Room) {
|
||||||
this.res = res;
|
super(res, room);
|
||||||
this.room = room;
|
|
||||||
this.zip = new JSZip();
|
this.zip = new JSZip();
|
||||||
this.avatars = new Map<string, boolean>();
|
this.avatars = new Map<string, boolean>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue