diff --git a/components/Editor.js b/components/Editor.js index fb16717..622e29e 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -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))