fregante/fit-textarea

Use `rows`

Offen

#21 geöffnet am 22.07.2022

 (0 Kommentare) (1 Reaktion) (0 zugewiesene Personen)TypeScript (2 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (83 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

As suggested in https://github.com/fregante/fit-textarea/issues/17

Unlike now, fit-textarea should start being a little more stateful, like caching the line-height

  1. Use getComputedStyle($0).lineHeight to get the line height on first load
  2. If normal, estimate (with excess) and then detect the height change at the next rows increase
  3. if the scrollHeight is higher than the clientHeight, set the rows attribute to scrollHeight/lineHeight

This would fix https://github.com/fregante/fit-textarea/issues/17 permanently.

Note: v3 is deprecated and any work should start on top of v2

Contributor Guide