- commit
- 92c782547e47eaa8216d1f792b9a0d1e4cbb8902
- parent
- 78db3410636c877607cd3493bcd7a7efaec89528
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-05-07 05:03
restore scroll position on setText
Diffstat
M | static/pad.js | 4 | ++++ |
1 files changed, 4 insertions, 0 deletions
diff --git a/static/pad.js b/static/pad.js
@@ -18,9 +18,13 @@ document.title += ' - ' + location.hash.slice(1); 18 18 19 19 var setText = function(text, start, end) { 20 20 if (text !== el.value) { -1 21 var scrollTop = el.scrollTop; 21 22 el.value = text; 22 23 el.selectionStart = start; 23 24 el.selectionEnd = end; -1 25 requestAnimationFrame(function() { -1 26 el.scrollTop = scrollTop; -1 27 }); 24 28 old = text; 25 29 } 26 30 };