File dropdown not visible at the bottom of the page (#6647)

* File dropdown not visible at the bottom of the page

* Added CHANGELOG
This commit is contained in:
Marc Farré 2023-11-08 18:20:38 +01:00 committed by GitHub
parent 27f56c37f9
commit 04ace80394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 97 additions and 163 deletions

File diff suppressed because it is too large Load Diff

View File

@ -545,6 +545,21 @@ humhub.module('file', function (module, require, $) {
upload.finish();
});
// Bootstrap 3 drop-down menu auto dropup according to screen position
// Must be removed when Humhub uses Bootstrap 4+
var dropdownButtonSelector = '.upload-buttons > .btn-group';
$(document).on("shown.bs.dropdown", dropdownButtonSelector, function () {
var $ul = $(this).children(".dropdown-menu");
var $button = $(this).children(".dropdown-toggle");
var ulOffset = $ul.offset();
var spaceUp = (ulOffset.top - $button.height() - $ul.height()) - $(window).scrollTop();
var spaceDown = $(window).scrollTop() + $(window).height() - (ulOffset.top + $ul.height());
if (spaceDown < 0 && (spaceUp >= 0 || spaceUp > spaceDown))
$(this).addClass("dropup");
}).on("hidden.bs.dropdown", dropdownButtonSelector, function () {
$(this).removeClass("dropup");
});
};
var upload = function (evt) {