lidia con los nombres de ciudadades con espacios a la hora de poner nombre a los archivos

pull/6/head
Borja Robert 2 years ago
parent 106077859a
commit 90d35f44f9

@ -15,7 +15,6 @@
} from '$lib/stores/store'; } from '$lib/stores/store';
/** @type {HTMLDivElement} */ let editor; /** @type {HTMLDivElement} */ let editor;
/** @type {HTMLDivElement} */ let editor2;
const handleSubmit = async () => { const handleSubmit = async () => {
console.log('submit'); console.log('submit');
@ -38,7 +37,10 @@
const image = res.toDataURL('image/png'); const image = res.toDataURL('image/png');
const link = document.createElement('a'); const link = document.createElement('a');
const city = $address.split('\n'); const city = $address.split('\n');
link.download = `${$date.split('T')[0]}-${city[city.length - 1]}-cartel.png`; link.download = `${$date.split('T')[0]}-${city[city.length - 1].replace(
' ',
'_'
)}-cartel.png`;
link.href = image; link.href = image;
link.click(); link.click();
} }

Loading…
Cancel
Save