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

109
Vistas
Wrapping Quill Link with a parent element

I need to customize the link tag to wrap a styling div around it like so:

<div class="custom-link">
  <a href="https://www.testurl.com">Test URL</a>
</div>

I initially tried to extend Quill's Link class and create a parent element that will wrap around it:

class CustomLink extends Link {
  static create(value) {
    const node = super.create(value);

    // Remove unnecessary attributes
    node.removeAttribute('rel');
    node.removeAttribute('target');

    // Create a wrapper node that will contain the link
    const wrapper = document.createElement('div');
    wrapper.setAttribute('class', 'custom-link');
    wrapper.appendChild(node);

    return wrapper;
  }

  static formats(domNode) {
    return super.formats(domNode.firstChild);
  }
}

But I still can't make it work like a regular Link class. Is there anything that I'm missing? Do I need to create a custom Blot in order to achieve this?

about 4 years ago · Juan Pablo Isaza
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