Traté de almacenar la mancha de lienzo en el portapapeles del navegador
graphicDiv.addEventListener( 'click', (event) => { const canvas = <HTMLCanvasElement> document.getElementById('canvas'); canvas.toBlob((blob) => { if (blob) { let data = [new ClipboardItem({ [blob.type]: blob })]; navigator.clipboard.write(data).then( function () {}, function (err) {} ); } }); }, false );parece que algo anda mal ya que TS me da los siguientes errores
Argument of type '{ [x: string]: Blob; }' is not assignable to parameter of type 'Record<string, ClipboardItemData>'. 'string' index signatures are incompatible. Type 'Blob' is missing the following properties from type 'Promise<ClipboardItemDataType> error TS2339: Property 'write' does not exist on type 'Clipboard'. 102 let data = [new ClipboardItem({ [blob.type]: blob })]; ~~~~~¿Hay alguien más familiarizado con cómo almacenar el gráfico de canvas chartjs en el portapapeles?
https://www.w3.org/TR/clipboard-apis/#typedefdef-clipboarditemdata 6.4.2. Escribir en el portapapeles
Estos tipos de datos deben colocarse en el portapapeles con una descripción de tipo nativo correspondiente si se agregan a un objeto DataTransfer durante los eventos de copia y corte.
text/plain text/uri-list text/csv text/html image/svg+xml application/xml, text/xml application/json