Skip to content

Commit

Permalink
Fix bug where a long subject title could not be displayed in some cas…
Browse files Browse the repository at this point in the history
…es (#9416)
  • Loading branch information
alecpl committed Jul 27, 2024
1 parent cd92b26 commit fdeb137
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
- Fix invalid line break characters in multi-line text in Sieve scripts (#9543)
- Fix bug where "with attachment" filter could fail on some fts engines (#9514)
- Fix bug where an unhandled exception was caused by an invalid image attachment (#9475)
- Fix bug where a long subject title could not be displayed in some cases (#9416)

## Release 1.6.7

Expand Down
13 changes: 10 additions & 3 deletions program/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ function rcube_webmail() {

query[uid_param] = uid;
cols.subject = '<a href="' + this.url(action, query) + '" onclick="return rcube_event.keyboard_only(event)"'
+ ' onmouseover="rcube_webmail.long_subject_title(this,' + (message.depth + 1) + ')" tabindex="-1"><span>' + cols.subject + '</span></a>';
+ ' onmouseover="rcube_webmail.long_subject_title(this)" tabindex="-1"><span>' + cols.subject + '</span></a>';
}

// add each submitted col
Expand Down Expand Up @@ -10659,8 +10659,15 @@ function rcube_webmail() {
// some static methods
rcube_webmail.long_subject_title = function (elem, indent, text_elem) {
if (!elem.title) {
var $elem = $(text_elem || elem);
if ($elem.width() + (indent || 0) * 15 > $elem.parent().width()) {
var siblings_width = 0, $elem = $(text_elem || elem);

$elem.siblings().each(function () {
// Note: width() returns 0 for elements with icons in :before (Elastic)
siblings_width += $(this).width() + (parseFloat(window.getComputedStyle(this, ':before').width) || 0);
});

// Note: 3px to be on the safe side, but also specifically for Elastic
if ($elem.width() + siblings_width + (indent || 0) * 15 >= $elem.parent().width() - 3) {
elem.title = rcube_webmail.subject_text($elem[0]);
}
}
Expand Down

0 comments on commit fdeb137

Please sign in to comment.