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

260
Views
Ajuste dinámico del área de texto de Lightning-Input-Rich-Text

Estoy tratando de aumentar la altura del cuadro del área de texto después de que un usuario crea varios saltos de línea dentro del área de texto. Tengo problemas para encontrar una manera de apuntar al valor de la altura del área de texto para aumentarlo por salto de línea. Apreciaría cualquier ayuda. Gracias.

 import { LightningElement } from 'lwc'; export default class TextBoxSizing extends LightningElement { handleTextBoxChange(event){ let eventArr = []; let lineBreaks = 0; eventArr.push(...event.target.value); eventArr.forEach(e =>{ if(e == '/'){ lineBreaks++; if(lineBreaks > 5) { let lirt = this.template.querySelector('lightning-input-rich-text').height; //undefined console.log(lirt); } } }); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿Has visto ganchos para peinar ? Lea el artículo, lea la documentación para textarea , verifique si agrega TextBoxSizing.css con algo como

 :host { --sds-c-textarea-sizing-min-height: 10em; }

funciona bien

Si es así, el siguiente paso sería agregar una variable controlada por JavaScript a CSS. Hace un tiempo tuve una pregunta similar: https://salesforce.stackexchange.com/q/341324/799

¿Algo como esto?

ingrese la descripción de la imagen aquí

 <template> <lightning-card> <lightning-input-rich-text value={text}></lightning-input-rich-text> <lightning-input type="number" label="Wheee :)" value={lines} onchange={handleLines} min="1" max="99" variant="label-inline"> </lightning-input> </lightning-card> </template>
 import { LightningElement } from 'lwc'; export default class StackTextarea extends LightningElement { text = '<b>Hello!</b>'; lines = 1; connectedCallback() { this.resize(); } handleLines(event) { this.lines = event.target.value; this.resize(); } resize() { document.documentElement.style.setProperty('--rtf-size', (this.lines * 2) + 'em'); } }
 :host{ --sds-c-textarea-sizing-min-height: var(--rtf-size); }
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!