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

201
Vistas
JavaScript detect enter event in WYSIWYG tool vs. a textarea

I am working on a plugin for Slack and making good progress. For the Slack input bar (shown below) I can now "convert" recognized words in user's text into links by addEventListener for a click to the submit button.

enter image description here

enter image description here

Then (based on the HTML structure of the Slack entry tool), I can capture the <p> elementNode containing the user text this way:

// don't laugh, it works reliably
e.target.parentElement.parentElement.parentElement.parentElement.parentElement.childNodes[1].firstChild.firstChild.firstChild

and convert it upon submission.

Since the element is a <p> and the user is using a WYSIWYG editor, I need to also capture <Enter>, but I can't bind it to the <p> element since that doesn't have an onkeypress event (like a textarea).

Is there a way to capture the <Enter> event when in the wysiwyg so behave the same as the click event on the button? I know there are many JavaScript event features I'm not yet aware of.

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