fix # issues for SVGs

Closes #640
main
Mike Fix 6 years ago
parent 1b4cab0ece
commit 794a50d3f3

@ -180,7 +180,13 @@ class Editor extends React.Component {
return ( return (
domtoimage domtoimage
.toSvg(node, config) .toSvg(node, config)
.then(dataUrl => dataUrl.replace(/ /g, ' ')) .then(dataUrl =>
dataUrl
.replace(/ /g, ' ')
// https://github.com/tsayen/dom-to-image/blob/fae625bce0970b3a039671ea7f338d05ecb3d0e8/src/dom-to-image.js#L551
.replace(/%23/g, '#')
.replace(/%0A/, '\n')
)
// https://stackoverflow.com/questions/7604436/xmlparseentityref-no-name-warnings-while-loading-xml-into-a-php-file // 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(dataUrl => dataUrl.replace(/&(?!#?[a-z0-9]+;)/g, '&'))
.then(uri => uri.slice(uri.indexOf(',') + 1)) .then(uri => uri.slice(uri.indexOf(',') + 1))

Loading…
Cancel
Save