Nicer indentation
This commit is contained in:
parent
544761329c
commit
ccd02c48b3
1 changed files with 8 additions and 8 deletions
|
@ -28,21 +28,21 @@ export default class JSONExporter extends Exporter {
|
||||||
const exporter = this.client.getUserId();
|
const exporter = this.client.getUserId();
|
||||||
const exporterName = this.room?.getMember(exporter)?.rawDisplayName || exporter;
|
const exporterName = this.room?.getMember(exporter)?.rawDisplayName || exporter;
|
||||||
return `{
|
return `{
|
||||||
"room_name": "${this.room.name}",
|
"room_name": "${this.room.name}",
|
||||||
"room_creator": "${creatorName}",
|
"room_creator": "${creatorName}",
|
||||||
"topic": "${topic}",
|
"topic": "${topic}",
|
||||||
"export_date": "${exportDate}",
|
"export_date": "${exportDate}",
|
||||||
"exported_by": "${exporterName}",
|
"exported_by": "${exporterName}",
|
||||||
"messages": [
|
"messages": [
|
||||||
${json}
|
${json}
|
||||||
]
|
]
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
|
||||||
protected indentEachLine(string: string) {
|
protected indentEachLine(string: string) {
|
||||||
const indent = ' ';
|
const indent = ' ';
|
||||||
const regex = /^(?!\s*$)/gm;
|
const regex = /^(?!\s*$)/gm;
|
||||||
return string.replace(regex, indent.repeat(1));
|
return string.replace(regex, indent.repeat(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onBeforeUnload = (e: BeforeUnloadEvent) => {
|
protected onBeforeUnload = (e: BeforeUnloadEvent) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue