mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Adding ability to copy to clipboard as SVG (#1250)
This commit is contained in:
parent
2de4fe29ad
commit
d5366db341
5 changed files with 55 additions and 7 deletions
|
@ -97,6 +97,14 @@ export async function copyCanvasToClipboardAsPng(canvas: HTMLCanvasElement) {
|
|||
});
|
||||
}
|
||||
|
||||
export async function copyCanvasToClipboardAsSvg(svgroot: SVGSVGElement) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(svgroot.outerHTML);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function copyTextToSystemClipboard(text: string | null) {
|
||||
let copied = false;
|
||||
if (probablySupportsClipboardWriteText) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue