File tree 1 file changed +2
-6
lines changed 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -282,13 +282,9 @@ class ComboMarkdownEditor {
282
282
this . textareaInitalHeight = this . textarea . offsetHeight ;
283
283
}
284
284
const offset = this . textarea . offsetHeight - this . textarea . clientHeight ;
285
- if ( ! this . lastValue || Math . abs ( this . lastValue . length - this . textarea . value . length ) > 2 ) {
286
- // the value has changed a lot, so reset the height to calculate the real scroll height, it might cause UI flickering
285
+ if ( ! this . lastValue || ! this . textarea . value . startsWith ( this . lastValue ) ) {
286
+ // the value has changed a lot, so reset the height to calculate the real scroll height, it's slow and might cause slight flickering.
287
287
this . textarea . style . height = 'auto' ;
288
- } else {
289
- // try to shrink a little to see if a line is deleted (since the value doesn't change much), it won't cause UI flickering
290
- // the magic number is a general number which fits most line-height styles.
291
- this . textarea . style . height = `${ this . textarea . scrollHeight + offset - 40 } px` ;
292
288
}
293
289
// make sure the height is not smaller than the initial height
294
290
this . textarea . style . height = `${ Math . max ( this . textareaInitalHeight , this . textarea . scrollHeight + offset ) } px` ;
You can’t perform that action at this time.
0 commit comments