NextINpact / Next

17 stars 0 forks source link

Hauteur de la zone de nouveau commentaire #343

Open psychopatt opened 3 months ago

psychopatt commented 3 months ago

Il semble qu'il y a un petit souci avec le calcul de la hauteur... et ça affecte aussi la prévisualisation

https://github.com/NextINpact/Next/assets/66741203/5afe1b10-e2e1-49d8-819a-60028ffe8ec5

127-001 commented 3 months ago

Suggestion de remplacer le "CSS auto-resizing textarea trick" par deux lignes de javascript qui redimensionnent le textarea.

<textarea class="comment-textarea" oninput="ResizeMe(this)"></textarea>

.comment-textarea {
  resize: none;       /* stop manual resizing */
  overflow: auto;     /* show scrollbars if taller than max-height */

  height: 50px;       /* set initial height = min-height */
  min-height: 50px;
  max-height: 200px;
}

function ResizeMe(textarea) {
  // reset style height to trigger recalculation of scrollHeight
  textarea.style.height = textarea.style.minHeight;

  // set the new height equals to scroll height
  textarea.style.height = textarea.scrollHeight + "px";
}