Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion components/SvgConverter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ import { EditorPanelProps } from "@components/EditorPanel";
import Form from "@components/Form";
import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import { Alert, Badge, Heading, Pane } from "evergreen-ui";
import svgToDataUrl from "svg-to-dataurl";

const svgToDataUrl = (svgStr: string) => {
const encoded = encodeURIComponent(svgStr)
.replace(/'/g, "%27")
.replace(/"/g, "%22");

const header = "data:image/svg+xml,";
const dataUrl = header + encoded;

return dataUrl;
};

interface SvgConverterProps {
name: string;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"rust-keywords": "^1.1.0",
"sha1": "^1.1.1",
"stringify-object": "^3.3.0",
"svg-to-dataurl": "^1.0.0",
"svgo": "^1.3.2",
"tempy": "^1.0.1",
"text-encoding-utf-8": "^1.0.2",
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9429,11 +9429,6 @@ svg-parser@^2.0.2:
resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5"
integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==

svg-to-dataurl@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/svg-to-dataurl/-/svg-to-dataurl-1.0.0.tgz#343f21a5dc3e051ae413c590cf478b7cf7a5f070"
integrity sha512-WrPB9vdd4RO0BjcPN6NJ9ofj3Zt8de16TJZ+JVJ4LnE2OKNGz+HjgGv6rE5Hp3s+OnM56X9i64mfJDU9uf4ZqQ==

svgo@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167"
Expand Down