FIX: prevents msg-actions to show hover text (#19952)

This case was possible in restrained space when the top of the message was not visible in the viewport.
This commit is contained in:
Joffrey JAFFEUX 2023-01-23 15:59:12 +01:00 committed by Bianca Nenciu
parent a0f61f4a25
commit 482739c171

View File

@ -4,8 +4,7 @@ import { createPopper } from "@popperjs/core";
import { schedule } from "@ember/runloop";
import { inject as service } from "@ember/service";
const MSG_ACTIONS_HORIZONTAL_PADDING = 2;
const MSG_ACTIONS_VERTICAL_PADDING = -28;
const MSG_ACTIONS_VERTICAL_PADDING = -10;
export default Component.extend({
tagName: "",
@ -28,27 +27,13 @@ export default Component.extend({
`.chat-message-actions-container[data-id="${this.message.id}"] .chat-message-actions`
),
{
placement: "right-start",
placement: "top-end",
modifiers: [
{ name: "hide", enabled: true },
{
name: "eventListeners",
options: {
scroll: false,
},
},
{ name: "eventListeners", options: { scroll: false } },
{
name: "offset",
options: {
offset: ({ popper, placement }) => {
return [
MSG_ACTIONS_VERTICAL_PADDING,
-(placement.includes("left") || placement.includes("right")
? popper.width + MSG_ACTIONS_HORIZONTAL_PADDING
: popper.height),
];
},
},
options: { offset: [0, MSG_ACTIONS_VERTICAL_PADDING] },
},
],
}