mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Merge pull request 'fix bug 75333' (#358) from fix/bug-75333 into hotfix/v9.0.3
This commit is contained in:
@ -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');
|
||||
|
||||
@ -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');
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user