Open yisibl opened 5 months ago
Chrome is working on improving the ability to copy SVG to the clipboard, can you reuse the Async Clipboard API and add image/svg+xml? We need to test that it doesn't crash before shipping.
image/svg+xml
https://github.com/felixfbecker/svg-screenshots/commit/961256599ec8b1098fb7df898b0b7a728dfaef9c
await navigator.clipboard.writeText(svgString) // const plainTextBlob = new Blob([svgString], { type: 'text/plain' }) // Copying image/svg+xml is not yet supported in Chrome and crashes the tab // await navigator.clipboard.write([ // new ClipboardItem({ // [blob.type]: blob, // 'text/plain': plainTextBlob, // }), // ])
Now you can use ClipboardItem.supports('image/svg+xml') to detect if SVG is supported.
ClipboardItem.supports('image/svg+xml')
Chrome is working on improving the ability to copy SVG to the clipboard, can you reuse the Async Clipboard API and add
image/svg+xml
? We need to test that it doesn't crash before shipping.https://github.com/felixfbecker/svg-screenshots/commit/961256599ec8b1098fb7df898b0b7a728dfaef9c
Now you can use
ClipboardItem.supports('image/svg+xml')
to detect if SVG is supported.