123456789101112131415161718192021222324 |
- import svgToEx from "svg-to-excalidraw";
- const heartSVG = `
- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
- <path d="M 10,30
- A 20,20 0,0,1 50,30
- A 20,20 0,0,1 90,30
- Q 90,60 50,90
- Q 10,60 10,30 z"/>
- </svg>
- `;
- const { hasErrors, errors, content } = svgToEx.convert(heartSVG);
- // SVG parsing errors are propagated through.
- if (hasErrors) {
- console.error(errors);
- return;
- }
- navigator.clipboard.writeText(content);
- // the heart excalidraw json is now copied to your clipboard.
- // Just Paste it into your Excalidraw session!
|