Fix exported SVG for SVG viewers

* `sans-serif` breaks certain SVG viewers
* set single font: Arial (hopefully best choice)
* set absolute width and height
* remove react id attributes (saves 10%)

Fixes #1144
This commit is contained in:
David Kaltschmidt
2016-04-12 18:05:48 +02:00
parent dc0165ab0a
commit 78500062ff

View File

@@ -25,6 +25,7 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) {
}
});
targetEl.setAttribute('style', computedStyleStr);
targetEl.removeAttribute('data-reactid');
}
function traverse(obj) {
@@ -60,7 +61,11 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) {
}
// set font
target.setAttribute('style', 'font-family: "Roboto", sans-serif;');
target.setAttribute('style', 'font-family: Arial;');
// set view box
target.setAttribute('width', svg.clientWidth);
target.setAttribute('height', svg.clientHeight);
}
function download(source, name) {