Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

62
Visualizações
clipboardItems.types not containing all data

I'm copying some text from a google doc to the clipboard and inspecting its content.

I've tried inspecting it by using the paste event and by using the clipboard API.

When inspecting with the paste event, it exposes 3 items, but when using the clipboard API, only two items are available.

Here's my code for clipboard API, this only prints two items:

navigator.clipboard.read().then(clipboardItems => {
    for (const clipboardItem of clipboardItems) {

        for (const type of clipboardItem.types) {
            clipboardItem.getType(type).then(blob => blob.text())
                .then(console.log);
        }

    }
})

And here's my code using the paste event. Three items are available.

target.addEventListener('paste', (event) => {
let items = event.clipboardData.items
for(let  i of  items){
if(i.kind==='string'){
i.getAsString(console.log)
}
}
    event.preventDefault();
});

Basically when using the paste event there's a new item of type application/x-vnd.google-docs-document-slice-clip+wrapped. Why doesn't it come up when using clipboard API?

This tool might be helpful to inspect the clipboard.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda