diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2017-10-06 14:31:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 14:31:16 +0200 |
commit | b3e39bf57ecf0f92357b1f15051cf2e9d3f1b267 (patch) | |
tree | 1ee866a8fadd2a273dfd626bf4d05b818aac5f4c | |
parent | f5bdd8edc8354f028dab2588670d82d0ab53ea8c (diff) | |
parent | 9c46b347b8118a127ca965106f66bb4d4d43f427 (diff) | |
download | Shaarli-b3e39bf57ecf0f92357b1f15051cf2e9d3f1b267.tar.gz Shaarli-b3e39bf57ecf0f92357b1f15051cf2e9d3f1b267.tar.zst Shaarli-b3e39bf57ecf0f92357b1f15051cf2e9d3f1b267.zip |
Merge pull request #980 from ArthurHoaro/hotfix/textarea-resize-jumpy
Fix jumpy textarea with long content in post edit
-rw-r--r-- | tpl/default/js/shaarli.js | 6 |
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 () { |