fix: Forge — preserver scroll position pendant autoHeight (empeche saut du curseur)
This commit is contained in:
@@ -1337,11 +1337,14 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
|||||||
|
|
||||||
// ---- Auto-height textarea (fill available space, grow beyond) ----
|
// ---- Auto-height textarea (fill available space, grow beyond) ----
|
||||||
function autoHeight() {
|
function autoHeight() {
|
||||||
|
var st = ta.scrollTop;
|
||||||
ta.style.height = 'auto';
|
ta.style.height = 'auto';
|
||||||
var contentH = ta.scrollHeight;
|
var contentH = ta.scrollHeight;
|
||||||
// Minimum: fill the editor-wrap's visible area minus padding
|
// Minimum: fill the editor-wrap's visible area minus padding
|
||||||
var wrapH = editorWrap.clientHeight - 48;
|
var wrapH = editorWrap.clientHeight - 48;
|
||||||
ta.style.height = Math.max(contentH, wrapH) + 'px';
|
ta.style.height = Math.max(contentH, wrapH) + 'px';
|
||||||
|
// Restore scroll position: prevent cursor jump on every keystroke
|
||||||
|
ta.scrollTop = st;
|
||||||
}
|
}
|
||||||
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