Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
¿Cómo selecciono una dirección URL completa en contenteditable?

en contenteditable, los enlaces no funcionan, por lo que creo que la mejor solución es al menos poder seleccionar una URL completa con uno o dos clics cuando el cursor está en cualquier parte de la URL, luego hacer clic derecho y ir al sitio ¿Hay una solución javascript para esto, algo similar a la pulsación prolongada, selección y pegado del teléfono Android?

<div contenteditable="true">some text here, then the complete url https://gizmodo.com/e-ink-kaleido-3-gallery-3-foldable-color-e-readers-1848842166 but i just want to select the url with one or two clicks, how? </div>

contentable:

un poco de texto aquí, luego la URL completa https://gizmodo.com/e-ink-kaleido-3-gallery-3-foldable-color-e-readers-1848842166 pero solo quiero seleccionar la URL con uno o dos clics , ¿cómo?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede reemplazar las cadenas de URL con anchor tags y adjuntar un oyente onclick para navegar a la URL al hacer clic:

 text.innerHTML = text.textContent.replace(/https*:\/\/[^\s]+/gmi, (match) => `<a style="cursor:pointer" href="${match}">${match}</a>`); [...text.children].forEach(a => a.onclick = (e) => window.open(a.href)) text.onblur = e => { e.target.innerHTML = e.target.textContent.replace(/https*:\/\/[^\s]+/gmi, (match) => `<a style="cursor:pointer" href="${match}">${match}</a>`); [...text.children].forEach(a => a.onclick = (e) => window.open(a.href)) }
 <div id="text" contenteditable="true">some text here, then the complete url https://gizmodo.com/e-ink-kaleido-3-gallery-3-foldable-color-e-readers-1848842166 i just want to select the url with one or two clicks, how? Another url here: https://gizmodo.com/e-ink-kaleido-3-gallery-3-foldable-color-e-readers-1848842166 </div>

( Se impide la navegación en el iframe del fragmento, pero debería funcionar en una ventana normal )

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!