diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 2ea1a9ea9..80fa22db0 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -117,7 +117,7 @@ export const openMenuPanel = (options: { setPosition(menuElement, cellRect.left, cellRect.bottom, cellRect.height); }, Constants.TIMEOUT_LOAD); // 等待加载 } else if (options.type === "relation") { - bindRelationEvent({protyle: options.protyle, data, menuElement, cellElements: options.cellElements}); + bindRelationEvent({menuElement, cellElements: options.cellElements}); } else if (options.type === "rollup") { bindRollupEvent({protyle: options.protyle, data, menuElement}); } diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts index 68d8aedba..91ba31859 100644 --- a/app/src/protyle/render/av/relation.ts +++ b/app/src/protyle/render/av/relation.ts @@ -7,6 +7,7 @@ import {transaction} from "../../wysiwyg/transaction"; import {updateCellsValue} from "./cell"; import {updateAttrViewCellAnimation} from "./action"; import {focusBlock} from "../../util/selection"; +import {setPosition} from "../../../util/setPosition"; const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => { fetchPost("/api/av/searchAttributeView", {keyword}, (response) => { @@ -214,8 +215,6 @@ const genSelectItemHTML = (type: "selected" | "empty" | "unselect", id?: string, }; export const bindRelationEvent = (options: { - protyle: IProtyle, - data: IAV, menuElement: HTMLElement, cellElements: HTMLElement[] }) => { @@ -251,6 +250,8 @@ export const bindRelationEvent = (options: { options.menuElement.innerHTML = `
${selectHTML || genSelectItemHTML("empty")} ${html || genSelectItemHTML("empty")}
`; + const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect(); + setPosition( options.menuElement, cellRect.left, cellRect.bottom, cellRect.height); }); };