Composer / Embedded Message / Menu: Fix height

This commit is contained in:
Alexander Zinchuk 2024-09-11 02:07:12 +02:00
parent da6f094d41
commit ff72279f1c
2 changed files with 9 additions and 2 deletions

View File

@ -340,6 +340,7 @@ const MessageContextMenu: FC<OwnProps> = ({
getRootElement={getRootElement}
getMenuElement={getMenuElement}
getLayout={getLayout}
withMaxHeight
className={buildClassName(
'MessageContextMenu', 'fluid', withReactions && 'with-reactions',
)}

View File

@ -23,6 +23,7 @@ interface DynamicPositionOptions {
getRootElement: () => HTMLElement | null;
getMenuElement: () => HTMLElement | null;
getLayout?: () => Layout;
withMaxHeight?: boolean;
}
export type MenuPositionOptions =
@ -122,6 +123,7 @@ function processDynamically(
getMenuElement,
getTriggerElement,
getLayout,
withMaxHeight,
}: DynamicPositionOptions,
) {
const triggerEl = getTriggerElement()!;
@ -214,10 +216,14 @@ function processDynamically(
const transformOriginX = positionX === 'left' ? offsetX : menuRect.width + offsetX;
const transformOriginY = positionY === 'bottom' ? menuRect.height + offsetY : offsetY;
const menuMaxHeight = rootRect.height - MENU_POSITION_BOTTOM_MARGIN - (marginTop || 0);
const bubbleStyle = `max-height: ${menuMaxHeight}px;`;
const style = `left: ${left}px; top: ${top}px`;
let bubbleStyle;
if (withMaxHeight) {
const menuMaxHeight = rootRect.height - MENU_POSITION_BOTTOM_MARGIN - (marginTop || 0);
bubbleStyle = `max-height: ${menuMaxHeight}px;`;
}
return {
positionX,
positionY,