mirror of https://github.com/zulip/zulip.git
Don't collapse messages that would only be collapsed by a small amount
(imported from commit 56e8df87d3eae62080962474eae23ab75f009819)
This commit is contained in:
parent
1e34114439
commit
cce1213320
|
@ -401,9 +401,18 @@ MessageList.prototype = {
|
|||
|
||||
var content = $(elem).find(".message_content")[0];
|
||||
if (content !== undefined) {
|
||||
if( content.offsetHeight < content.scrollHeight ||
|
||||
content.offsetWidth < content.scrollWidth) {
|
||||
// We've limited the height of all elements in CSS.
|
||||
// If offsetHeight < scrollHeight, then our CSS height limit has taken
|
||||
// effect and we should show an expander button.
|
||||
// If offsetHeight is only slightly smaller than scrollHeight, then we
|
||||
// would only be collapsing by a small amount, which can be annoying.
|
||||
// Instead of showing an expander button, just expand that element instead
|
||||
// of keeping it collapsed. (This also solves a bug seen on some Mac
|
||||
// systems where offsetHeight == scrollHeight-1 for no apparent reason).
|
||||
if (content.offsetHeight+50 < content.scrollHeight) {
|
||||
$(elem).find(".message_expander").show();
|
||||
} else if (content.offsetHeight < content.scrollHeight) {
|
||||
$(content).addClass("expanded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue