Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
use el portapapeles del navegador para almacenar la imagen/png de la mancha de lienzo

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!