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

147
Views
JavaScript $ReadOnlyArray<Decorador compuesto>

Estoy tratando de hacer funcionar un código que resaltará los enlaces automáticamente en un editor de texto enriquecido. Este no es mi propio código escrito, es del borrador js y lo proporcionan muchas páginas web diferentes porque es absolutamente básico cómo debería funcionar. Mi principal problema es que cuando defino el linkDecorator del tipo CompositeDecorator, el compilador me dice que el linkDecorator es $ReadOnlyArray, que no puede manejar la entrada proporcionada. No tengo absolutamente ninguna idea de lo que estoy haciendo mal porque para las personas en aproximadamente 10 sitios web diferentes, este código funciona exactamente bien. Incluso en un compilador en línea donde puede compilar el código usted mismo, funciona. Además, prácticamente el programa no arrojará errores, sino que simplemente no hará nada más después de esta línea.

¡¡¡Gracias de antemano por cualquier ayuda!!!

 function findLinkEntities(contentBlock, callback, contentState){ contentBlock.findEntityRanges((character) => { const entityKey = character.getEntity(); return( entityKey !== null && contentState.getEntity(entityKey).getElementById() === 'LINK' ) }, callback); } const Link = (props) => { const { url,linkText} = props.contentState .getEntity(props.entityKey) .getData() return ( <a style={{color: '#006cb7', textDecoration: 'underline'}} href={url}> {linkText || props.children} </a> ) } const linkDecorator = new CompositeDecorator([ { strategy: findLinkEntities, component: Link, } ])
about 4 years ago · Juan Pablo Isaza
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!