commit: 1a38e0273ee68dc8fe2f46d8b35b7a2d26d36ea7
parent 14fdd34964723fcae499e02918b8a5b6f1549ea6
Author: Henry Jameson <me@hjkos.com>
Date: Fri, 11 Oct 2024 21:21:14 +0300
fix filename not applying
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js
@@ -689,7 +689,7 @@ export default {
// ## Export and Import
const styleExporter = newExporter({
- filename: name.value || 'pleroma_theme',
+ filename: () => exports.name.value ?? 'pleroma_theme',
mime: 'text/plain',
extension: 'piss',
getExportedObject: () => exportStyleData.value
diff --git a/src/services/export_import/export_import.js b/src/services/export_import/export_import.js
@@ -16,7 +16,8 @@ export const newExporter = ({
// Create an invisible link with a data url and simulate a click
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.style.display = 'none'