Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2020-07-22 21:19:34 +0300
committerAleksander Machniak <alec@alec.pl>2020-07-22 21:20:06 +0300
commit7c20e7be23ecfb5d6692cb9c1f56884210fa0cc1 (patch)
tree13da7f44c7d91f81784d3057129e645b04d49880 /skins/elastic
parent60de69711b4ae6a422392743c7b949b815f2ce7d (diff)
Elastic: Fix redundant scrollbar in plain text editor on mail reply (#7500)
Diffstat (limited to 'skins/elastic')
-rw-r--r--skins/elastic/ui.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js
index 4dfce00b3..247aee666 100644
--- a/skins/elastic/ui.js
+++ b/skins/elastic/ui.js
@@ -3710,7 +3710,7 @@ function rcube_elastic_ui()
}
// make the textarea autoresizeable
- textarea_autoresize_init(editor);
+ textarea_autoresize_init(obj);
// sanity check
if (sw.length != 1) {
@@ -3746,28 +3746,33 @@ function rcube_elastic_ui()
// FIXME: Is there a better way to get initial height of the textarea?
// At this moment clientHeight/offsetHeight is 0.
min_height = ($(textarea)[0].rows || 5) * 21,
- resize = function(e) {
- if (this.scrollHeight - padding <= min_height) {
+ resize = function() {
+ // Wait until the textarea is visible
+ if (!textarea.scrollHeight) {
+ return setTimeout(resize, 250);
+ }
+
+ if (textarea.scrollHeight - padding <= min_height) {
return;
}
// To fix scroll-jump issue in Edge we'll find the scrolling parent
// and re-apply scrollTop value after we reset textarea height
var scroll_element, scroll_pos = 0;
- $(e.target).parents().each(function() {
- if (this.scrollTop > 0) {
- scroll_element = this;
- scroll_pos = this.scrollTop;
+ $(textarea).parents().each(function() {
+ if (textarea.scrollTop > 0) {
+ scroll_element = textarea;
+ scroll_pos = textarea.scrollTop;
return false;
}
});
- var oldHeight = $(this).outerHeight();
- $(this).outerHeight(0);
- var newHeight = Math.max(min_height, this.scrollHeight);
- $(this).outerHeight(oldHeight);
+ var oldHeight = $(textarea).outerHeight();
+ $(textarea).outerHeight(0);
+ var newHeight = Math.max(min_height, textarea.scrollHeight);
+ $(textarea).outerHeight(oldHeight);
if (newHeight !== oldHeight) {
- $(this).height(newHeight);
+ $(textarea).height(newHeight);
}
if (scroll_pos) {