mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
🎨 The menu no longer extends beyond the window
fix https://github.com/siyuan-note/siyuan/issues/15400
This commit is contained in:
parent
ce37930cc9
commit
1a0599d858
1 changed files with 2 additions and 1 deletions
|
|
@ -98,7 +98,8 @@ export class Menu {
|
||||||
}
|
}
|
||||||
const menuRect = menuElement.getBoundingClientRect();
|
const menuRect = menuElement.getBoundingClientRect();
|
||||||
const itemsMenuRect = itemsMenuElement.getBoundingClientRect();
|
const itemsMenuRect = itemsMenuElement.getBoundingClientRect();
|
||||||
const availableHeight = (window.innerHeight - menuRect.top) - (menuRect.height - itemsMenuRect.height);
|
// 加 1px 是为了避免在特定情况下渲染出不应存在的滚动条而做的兼容处理
|
||||||
|
const availableHeight = (window.innerHeight - menuRect.top) - (menuRect.height - itemsMenuRect.height) + 1;
|
||||||
itemsMenuElement.style.maxHeight = Math.max(availableHeight, 0) + "px";
|
itemsMenuElement.style.maxHeight = Math.max(availableHeight, 0) + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue