aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-10-01 11:49:17 +0200
committerArthurHoaro <arthur@hoa.ro>2017-10-01 11:49:17 +0200
commit9c46b347b8118a127ca965106f66bb4d4d43f427 (patch)
tree0e883caed0b43bbab60faa59d1340a0495857b8f
parenta59bbf50d7530d7e82a91896a210b9da49cb1568 (diff)
downloadShaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.tar.gz
Shaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.tar.zst
Shaarli-9c46b347b8118a127ca965106f66bb4d4d43f427.zip
Fix jumpy textarea with long content in post edit
We manually reset the scroll position, to avoid height = 'auto' jump to the top Fixes #971
-rw-r--r--tpl/default/js/shaarli.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js
index 1c66ebbd..55656f80 100644
--- a/tpl/default/js/shaarli.js
+++ b/tpl/default/js/shaarli.js
@@ -275,8 +275,14 @@ window.onload = function () {
275 }; 275 };
276 function init () { 276 function init () {
277 function resize () { 277 function resize () {
278 /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */
279 var scrollTop = window.pageYOffset ||
280 (document.documentElement || document.body.parentNode || document.body).scrollTop;
281
278 description.style.height = 'auto'; 282 description.style.height = 'auto';
279 description.style.height = description.scrollHeight+10+'px'; 283 description.style.height = description.scrollHeight+10+'px';
284
285 window.scrollTo(0, scrollTop);
280 } 286 }
281 /* 0-timeout to get the already changed text */ 287 /* 0-timeout to get the already changed text */
282 function delayedResize () { 288 function delayedResize () {