fix bug 75333

This commit is contained in:
konstantin.kireyev
2025-07-01 17:05:44 +05:00
parent 67e81b1fcd
commit e9f57e16c5
2 changed files with 22 additions and 5 deletions

View File

@ -134,13 +134,24 @@ Menu.prototype.showUnderElem = function(el, data, align) {
let $el = $('#'+this.id);
const $rel = $(el);
// const $rel.width();
const pos = $rel.offset();
pos.top += $rel.height() + 2;
const $dd = $el.find('.dropdown-menu');
if ( align == 'right' )
pos.left -= $dd.outerWidth() - $rel.outerWidth();
let topPos = pos.top + $rel.outerHeight() + 2;
const dropdownHeight = $dd.outerHeight();
const viewportHeight = $(window).height();
const scrollTop = $(window).scrollTop();
if ((topPos + dropdownHeight) > (viewportHeight + scrollTop)) {
topPos = pos.top - dropdownHeight - 2;
}
pos.top = topPos;
if (align === 'right') {
pos.left = pos.left - ($dd.outerWidth() - $rel.outerWidth());
}
$el.css(pos);
$dd.dropdown('toggle');

View File

@ -330,6 +330,12 @@
function addContextMenuEventListener(collection, model, view, actionList) {
$(`#${model.uid}-more-btn`, view).click((e) => {
e.stopPropagation();
if (Menu.opened) {
Menu.closeAll();
return;
}
ppmenu.actionlist = actionList;
ppmenu.showUnderElem(e.currentTarget, model, $('body').hasClass('rtl') ? 'left' : 'right');
})