From d7b510978e544ced79d8878160e0634aadeddeb2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 10 Jan 2019 10:14:51 +0100 Subject: [PATCH] Fix regressions in attachment rename and attachment title attribute setting --- program/js/app.js | 23 ++++++----------------- program/steps/mail/compose.inc | 3 +-- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 28ff113b9..ee028b933 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -5416,10 +5416,8 @@ function rcube_webmail() + (this.env.cancelicon ? ''+label+'' : '' + label + '') + '' + att.html; } - li.attr('id', name) - .addClass(att.classname) - .html(att.html) - .on('mouseover', function() { rcube_webmail.long_subject_title_ex(this); }); + li.attr('id', name).addClass(att.classname).html(att.html) + .find('.attachment-name').on('mouseover', function() { rcube_webmail.long_subject_title_ex(this); }); // replace indicator's li if (upload_id && (indicator = document.getElementById(upload_id))) { @@ -5508,24 +5506,14 @@ function rcube_webmail() // update attachments list with the new name this.rename_attachment_handler = function(id, name) { - var attachment = this.env.attachments ? this.env.attachments[id] : null, - item = $('#' + id + ' > a.filename'), - link = $(''); + var attachment = this.env.attachments ? this.env.attachments[id] : null; if (!attachment || !name) return; attachment.name = name; - // update attachments list - if (item.length == 1) { - // create a new element with new attachment name and cloned size - link.text(name).append($('span', item).clone()); - // update attachment name element - item.html(link.html()); - // reset parent's title which may contain the old name - item.parent().attr('title', ''); - } + $('#' + id + ' .attachment-name').text(name).attr('title', ''); }; // send remote request to add a new contact @@ -10122,6 +10110,7 @@ rcube_webmail.long_subject_title_ex = function(elem) if (!elem.title) { var $elem = $(elem), txt = $.trim($elem.text()), + indent = $('span.branch', $elem).width() || 0, tmp = $('').text(txt) .css({position: 'absolute', 'float': 'left', visibility: 'hidden', 'font-size': $elem.css('font-size'), 'font-weight': $elem.css('font-weight')}) @@ -10129,7 +10118,7 @@ rcube_webmail.long_subject_title_ex = function(elem) w = tmp.width(); tmp.remove(); - if (w + $('span.branch', $elem).width() * 15 > $elem.width()) + if (w + indent * 15 > $elem.width()) elem.title = rcube_webmail.subject_text(elem); } }; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index e0187b98f..b00936d6e 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1187,7 +1187,7 @@ function rcmail_compose_attachment_list($attrib) continue; } - $link_content = sprintf('%s (%s)', + $link_content = sprintf('%s (%s)', rcube::Q($a_prop['name']), $RCMAIL->show_bytes($a_prop['size'])); $content_link = html::a(array( @@ -1208,7 +1208,6 @@ function rcmail_compose_attachment_list($attrib) $out .= html::tag('li', array( 'id' => 'rcmfile'.$id, 'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']), - 'onmouseover' => "rcube_webmail.long_subject_title_ex(this, 0)", ), $COMPOSE['icon_pos'] == 'left' ? $delete_link.$content_link : $content_link.$delete_link );