Skip to content

Commit

Permalink
style: ignore prettier style in HistoryListPanel.vue to have a simple…
Browse files Browse the repository at this point in the history
…r csv escape function

Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou committed Jul 16, 2023
1 parent 584a357 commit a93ee6b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/components/panels/HistoryListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1011,19 +1011,14 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
})
}
// escape fields with the csvSeperator in the content
// prettier-ignore
const csvContent =
'data:text/csv;charset=utf-8,' +
content
.map((entry) =>
entry
.map((field) => {
if (field.indexOf(csvSeperator) === -1) return field
return `"${field}"`
})
.join(csvSeperator)
)
.join('\n')
content.map((entry) =>
entry.map((field) => (field.indexOf(csvSeperator) === -1 ? field : `"${field}"`)).join(csvSeperator)
).join('\n')
const link = document.createElement('a')
link.setAttribute('href', encodeURI(csvContent))
link.setAttribute('download', 'print_history.csv')
Expand Down

0 comments on commit a93ee6b

Please sign in to comment.