Composer / Embedded Message / Menu: Fix height
This commit is contained in:
parent
da6f094d41
commit
ff72279f1c
@ -340,6 +340,7 @@ const MessageContextMenu: FC<OwnProps> = ({
|
|||||||
getRootElement={getRootElement}
|
getRootElement={getRootElement}
|
||||||
getMenuElement={getMenuElement}
|
getMenuElement={getMenuElement}
|
||||||
getLayout={getLayout}
|
getLayout={getLayout}
|
||||||
|
withMaxHeight
|
||||||
className={buildClassName(
|
className={buildClassName(
|
||||||
'MessageContextMenu', 'fluid', withReactions && 'with-reactions',
|
'MessageContextMenu', 'fluid', withReactions && 'with-reactions',
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ interface DynamicPositionOptions {
|
|||||||
getRootElement: () => HTMLElement | null;
|
getRootElement: () => HTMLElement | null;
|
||||||
getMenuElement: () => HTMLElement | null;
|
getMenuElement: () => HTMLElement | null;
|
||||||
getLayout?: () => Layout;
|
getLayout?: () => Layout;
|
||||||
|
withMaxHeight?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MenuPositionOptions =
|
export type MenuPositionOptions =
|
||||||
@ -122,6 +123,7 @@ function processDynamically(
|
|||||||
getMenuElement,
|
getMenuElement,
|
||||||
getTriggerElement,
|
getTriggerElement,
|
||||||
getLayout,
|
getLayout,
|
||||||
|
withMaxHeight,
|
||||||
}: DynamicPositionOptions,
|
}: DynamicPositionOptions,
|
||||||
) {
|
) {
|
||||||
const triggerEl = getTriggerElement()!;
|
const triggerEl = getTriggerElement()!;
|
||||||
@ -214,10 +216,14 @@ function processDynamically(
|
|||||||
const transformOriginX = positionX === 'left' ? offsetX : menuRect.width + offsetX;
|
const transformOriginX = positionX === 'left' ? offsetX : menuRect.width + offsetX;
|
||||||
const transformOriginY = positionY === 'bottom' ? menuRect.height + offsetY : offsetY;
|
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`;
|
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 {
|
return {
|
||||||
positionX,
|
positionX,
|
||||||
positionY,
|
positionY,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user