File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export async function prompt2(specs, opts={}) {
6060 <div style="margin:0.5rem 0; margin-top:${ i == 0 ? 0 : 1 } rem; font-size:85%;">${ spec . label } </div>
6161 <div style="display:flex;">
6262 <div style="flex-grow:1;">
63- <textarea data-spec-key="${ sanitizeHtml ( key ) } " data-height="fit-content" style="width:100%; ${ spec . height === "fit-content" ? "" : `height:${ spec . height } ` } ; min-height:4rem; border: 1px solid lightgrey; border-radius: 3px;" type="text" placeholder="${ sanitizeHtml ( spec . placeholder ) } ">${ sanitizeHtml ( spec . defaultValue ) } </textarea>
63+ <textarea data-spec-key="${ sanitizeHtml ( key ) } " data-height="fit-content" style="width:100%; ${ spec . height === "fit-content" ? "" : `height:${ spec . height } ` } ; min-height:${ spec . minHeight ?? " 4rem" } ; border: 1px solid lightgrey; border-radius: 3px;" type="text" placeholder="${ sanitizeHtml ( spec . placeholder ) } ">${ sanitizeHtml ( spec . defaultValue ) } </textarea>
6464 </div>
6565 </div>
6666 </section>` ;
@@ -91,7 +91,10 @@ export async function prompt2(specs, opts={}) {
9191 document . body . appendChild ( ctn ) ;
9292
9393 setTimeout ( ( ) => { // settimeout to ensure rendered
94- ctn . querySelectorAll ( "textarea[data-height=fit-content]" ) . forEach ( el => el . style . height = Math . max ( 70 , ( el . scrollHeight + 5 ) ) + "px" ) ;
94+ ctn . querySelectorAll ( "textarea[data-height=fit-content]" ) . forEach ( el => {
95+ let minHeight = el . offsetHeight ; // textareas will always have min-height set, so we can use that via offsetHeight
96+ el . style . height = Math . max ( minHeight , ( el . scrollHeight + 5 ) ) + "px" ;
97+ } ) ;
9598 } , 10 ) ;
9699
97100 let values = await new Promise ( ( resolve ) => {
You can’t perform that action at this time.
0 commit comments