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

127
Views
Adición de caracteres al final de una línea

Basado en el siguiente código y descripción aquí:

Agregue viñetas a cada nueva línea dentro de un área de texto

 const bullet = "\u002a"; const bulletWithSpace = `${bullet} `; const enter = 13; const handleInput = (event) => { const { keyCode, target } = event; const { selectionStart, value } = target; if (keyCode === enter) { //console.log('debug'); target.value = [...value] .map((c, i) => i === selectionStart - 1 ? `\n${bulletWithSpace}` : c ) .join(''); //console.log(target.value); target.selectionStart = selectionStart+bulletWithSpace.length; target.selectionEnd = selectionStart+bulletWithSpace.length; } if (value[0] !== bullet) { target.value = `${bulletWithSpace}${value}`; } }

¿Cómo se puede modificar esto para que funcione de manera opuesta?

En lugar de agregar el objetivo a la primera posición de cada nueva línea. Cambie la posición de destino hasta el final.

Nota: reemplacé la viñeta unicode a * para probar

El código original hace esto:

 * text * new line

Cambiando el código para hacer en su lugar:

 text * new line * * = bullet in my example code
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cambié su código y puede ver el ejemplo de trabajo en https://nexuscode.online/editor/R0iIh4wDkO

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!