diff --git a/package-lock.json b/package-lock.json index 442a8da2601..6e8eb3c861d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6023,9 +6023,9 @@ "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", "optional": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" } }, "fs.realpath": { @@ -6118,8 +6118,8 @@ "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "optional": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" + "ajv": "^4.9.1", + "har-schema": "^1.0.5" } }, "has-unicode": { @@ -6180,7 +6180,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-typedarray": { @@ -6272,7 +6272,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", "requires": { - "mime-db": "1.27.0" + "mime-db": "~1.27.0" } }, "minimatch": { @@ -6280,7 +6280,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "1.1.7" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -15940,6 +15940,11 @@ } } }, + "save-svg-as-png": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/save-svg-as-png/-/save-svg-as-png-1.4.6.tgz", + "integrity": "sha512-CeN0wtmKW02/qfTtXFfiCCniyGExRzPKpp2xOdY8cbLEeIQPWKhSCd1HUl/dGH7WDu2As6Wecs14rlV2Jaf9lg==" + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", diff --git a/package.json b/package.json index fc760b9d8b7..2c3d2c6450c 100644 --- a/package.json +++ b/package.json @@ -201,6 +201,7 @@ "route-parser": "0.0.5", "sass-loader": "^4.1.1", "sass-resources-loader": "^1.3.1", + "save-svg-as-png": "^1.4.6", "script-loader": "^0.7.0", "seamless-immutable": "^7.0.1", "seedrandom": "^2.4.3", diff --git a/src/shared/components/downloadControls/DownloadControls.tsx b/src/shared/components/downloadControls/DownloadControls.tsx index a1545109ff4..9977f12fc08 100644 --- a/src/shared/components/downloadControls/DownloadControls.tsx +++ b/src/shared/components/downloadControls/DownloadControls.tsx @@ -1,5 +1,4 @@ import * as React from "react"; -import SvgSaver from 'svgsaver'; import svgToPdfDownload from "shared/lib/svgToPdfDownload"; import FadeInteraction from "../fadeInteraction/FadeInteraction"; import {observer} from "mobx-react"; @@ -9,6 +8,7 @@ import fileDownload from 'react-file-download'; import DefaultTooltip from "../defaultTooltip/DefaultTooltip"; import classnames from "classnames"; import styles from "./DownloadControls.module.scss"; +import {saveSvg, saveSvgAsPng} from "save-svg-as-png"; type ButtonSpec = { key:string, content:JSX.Element, onClick:()=>void, disabled?: boolean }; @@ -53,7 +53,6 @@ function makeMenuItem(spec:ButtonSpec) { @observer export default class DownloadControls extends React.Component { - private svgsaver = new SvgSaver(); @observable private collapsed = true; @autobind @@ -61,7 +60,7 @@ export default class DownloadControls extends React.Component