fix: textarea fills full editor height when content is short
autoHeight() now uses Math.max(contentH, wrapH-48) so textarea fills available space even with short content, and grows beyond when content is long.
This commit is contained in:
@@ -1063,10 +1063,13 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
|||||||
autoHeight();
|
autoHeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---- Auto-height textarea ----
|
// ---- Auto-height textarea (fill available space, grow beyond) ----
|
||||||
function autoHeight() {
|
function autoHeight() {
|
||||||
ta.style.height = 'auto';
|
ta.style.height = 'auto';
|
||||||
ta.style.height = ta.scrollHeight + 'px';
|
var contentH = ta.scrollHeight;
|
||||||
|
// Minimum: fill the editor-wrap's visible area minus padding
|
||||||
|
var wrapH = editorWrap.clientHeight - 48;
|
||||||
|
ta.style.height = Math.max(contentH, wrapH) + 'px';
|
||||||
}
|
}
|
||||||
ta.addEventListener('mouseup', function() { setTimeout(showBubble, 50); });
|
ta.addEventListener('mouseup', function() { setTimeout(showBubble, 50); });
|
||||||
// Bubble follows cursor on any selection change (keyboard too)
|
// Bubble follows cursor on any selection change (keyboard too)
|
||||||
|
|||||||
Reference in New Issue
Block a user