immich/web/src/lib/utils/autogrow.ts
martin 3845fec280
refactor(web): descriptions (#6517)
* refactor: reusable autogrow

* fix: remove useless autogrow

* fix: correct size for album description

* fix: format

* fix: move to own file

* refactor: album description

* refactor: asset description

* simplify

* fix: style when no description provided

* fix: switching assets

* feat: update description with ctrl + enter

* fix: variable name

* fix: styling

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2024-01-21 22:47:55 -06:00

6 lines
202 B
TypeScript

export const autoGrowHeight = (textarea: HTMLTextAreaElement, height = 'auto') => {
textarea.scrollHeight;
textarea.style.height = height;
textarea.style.height = `${textarea.scrollHeight}px`;
};