DEV: Add unique filename for table exports (#19)

This commit is contained in:
Keegan George 2022-08-12 12:10:04 -07:00 committed by GitHub
parent 52b69453ba
commit f68a599e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -173,12 +173,18 @@ export default class SpreadsheetEditor extends Component {
} }
buildSpreadsheet(data, columns, opts = {}) { buildSpreadsheet(data, columns, opts = {}) {
const postNumber = this.args.model?.post_number;
const exportFileName = postNumber
? `post-${postNumber}-table-export`
: `post-table-export`;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
this.spreadsheet = jspreadsheet(this.spreadsheet, { this.spreadsheet = jspreadsheet(this.spreadsheet, {
data, data,
columns, columns,
defaultColAlign: "left", defaultColAlign: "left",
wordWrap: true, wordWrap: true,
csvFileName: exportFileName,
...opts, ...opts,
}); });
} }