♻️(frontend) doc title as title for pdf export
Our pdf export was named impress-document.pdf, now it is named after the document title. We sanitize the title by removing special characters, replacing spaces with underscores and putting it in lowercase.
This commit is contained in:
@@ -57,7 +57,14 @@ export const ModalPDF = ({ onClose, templateOptions, pad }: ModalPDFProps) => {
|
||||
return;
|
||||
}
|
||||
|
||||
downloadFile(pdf, 'impress-document.pdf');
|
||||
// normalize title
|
||||
const title = pad.title
|
||||
.toLowerCase()
|
||||
.normalize('NFD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/\s/g, '-');
|
||||
|
||||
downloadFile(pdf, `${title}.pdf`);
|
||||
|
||||
toast(t('Your pdf was downloaded succesfully'), VariantType.SUCCESS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user