12 lines
422 B
TypeScript
12 lines
422 B
TypeScript
export const getComposerHeight = (
|
|
scrollHeight: number,
|
|
lineHeight: number,
|
|
padding: number,
|
|
borders: number,
|
|
borderBox: boolean,
|
|
): number => {
|
|
const contentHeight = Math.min(Math.max(scrollHeight - padding, lineHeight * 2), lineHeight * 10);
|
|
// A stable CSS-pixel boundary avoids 47.999… / 48.01 oscillations.
|
|
return Math.round(contentHeight + (borderBox ? padding + borders : 0));
|
|
};
|