fix filename not applying

This commit is contained in:
Henry Jameson 2024-10-11 21:21:14 +03:00
parent 14fdd34964
commit 1a38e0273e
2 changed files with 3 additions and 2 deletions

View file

@ -689,7 +689,7 @@ export default {
// ## Export and Import // ## Export and Import
const styleExporter = newExporter({ const styleExporter = newExporter({
filename: name.value || 'pleroma_theme', filename: () => exports.name.value ?? 'pleroma_theme',
mime: 'text/plain', mime: 'text/plain',
extension: 'piss', extension: 'piss',
getExportedObject: () => exportStyleData.value getExportedObject: () => exportStyleData.value

View file

@ -16,7 +16,8 @@ export const newExporter = ({
// Create an invisible link with a data url and simulate a click // Create an invisible link with a data url and simulate a click
const e = document.createElement('a') const e = document.createElement('a')
e.setAttribute('download', `${filename}.${extension}`) const realFilename = typeof filename === 'function' ? filename() : filename
e.setAttribute('download', `${realFilename}.${extension}`)
e.setAttribute('href', `data:${mime};base64, ${window.btoa(stringified)}`) e.setAttribute('href', `data:${mime};base64, ${window.btoa(stringified)}`)
e.style.display = 'none' e.style.display = 'none'