fix lookup-widget position in scrolling page (#979)

This commit is contained in:
an-lee
2024-08-16 15:33:10 +08:00
committed by GitHub
parent b80c955c9d
commit 99b9b36920

View File

@@ -51,7 +51,16 @@ export const LookupWidget = () => {
.closest("[data-source-id]")
?.getAttribute("data-source-id");
setSelected({ word, context, position, sourceType, sourceId });
setSelected({
word,
context,
position: {
x: position.x,
y: position.y + window.scrollY + 10,
},
sourceType,
sourceId,
});
setOpen(true);
};