Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda