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

350
Visualizações
How to disable image pasting in ngx-editor?

I was trying to use ngx-editor for rich text editor but I want to disable the property of pasting images in the editor. Although I have removed the insert image button from the toolbar it is still pasting the images in the editor.

Link to ngx-editor doc: https://sibiraj-s.github.io/ngx-editor/#/

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

@HostListener('paste', ['$event'])
private pasteFromClipboard(event: KeyboardEvent): void {
  event.preventDefault();
    
  if (this.insertClipboardImage(event)) {
    return;
  }
}

private insertClipboardImage(event): File | null{
  const pastedImage = getPastedImage(event);

  if (!pastedImage)
    return null;

  return pastedImage;
}

private getPastedImage(event): File | null {
  if (event.clipboardData) {
    if (event.clipboardData.files && event.clipboardData.files.length && isImageFile(event.clipboardData.files[0])) {
      return event.clipboardData.files[0];
    }
  }

  return null;
}

private isImageFile(file: File): boolean {
  return file.type.search(/^image\//i) === 0;
}
over 4 years ago · Santiago Trujillo Relatório
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