fix tab characters in SVG

- closes #586
main
Mike Fix 6 years ago
parent 38665cc34d
commit bb36e0062b

@ -175,12 +175,16 @@ class Editor extends React.Component {
try {
if (type === 'blob') {
if (format === 'svg') {
return domtoimage
.toSvg(node, config)
.then(dataUrl => dataUrl.replace(/ /g, ' '))
.then(uri => uri.slice(uri.indexOf(',') + 1))
.then(data => new Blob([data], { type: 'image/svg+xml' }))
.then(data => window.URL.createObjectURL(data))
return (
domtoimage
.toSvg(node, config)
.then(dataUrl => dataUrl.replace(/ /g, ' '))
// https://stackoverflow.com/questions/7604436/xmlparseentityref-no-name-warnings-while-loading-xml-into-a-php-file
.then(dataUrl => dataUrl.replace(/&(?!#?[a-z0-9]+;)/g, '&'))
.then(uri => uri.slice(uri.indexOf(',') + 1))
.then(data => new Blob([data], { type: 'image/svg+xml' }))
.then(data => window.URL.createObjectURL(data))
)
}
return await domtoimage.toBlob(node, config).then(blob => window.URL.createObjectURL(blob))

Loading…
Cancel
Save