diff options
Diffstat (limited to 'src/client/views/linking/LinkMenu.tsx')
-rw-r--r-- | src/client/views/linking/LinkMenu.tsx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/linking/LinkMenu.tsx b/src/client/views/linking/LinkMenu.tsx index 54b597f59..b32022024 100644 --- a/src/client/views/linking/LinkMenu.tsx +++ b/src/client/views/linking/LinkMenu.tsx @@ -3,7 +3,7 @@ import { observer } from "mobx-react"; import { Doc } from "../../../fields/Doc"; import { LinkManager } from "../../util/LinkManager"; import { DocumentLinksButton } from "../nodes/DocumentLinksButton"; -import { DocumentView } from "../nodes/DocumentView"; +import { DocumentView, DocumentViewSharedProps } from "../nodes/DocumentView"; import { LinkDocPreview } from "../nodes/LinkDocPreview"; import { LinkEditor } from "./LinkEditor"; import './LinkMenu.scss'; @@ -13,7 +13,7 @@ import React = require("react"); interface Props { docView: DocumentView; changeFlyout: () => void; - addDocTab: (document: Doc, where: string) => boolean; + docprops: DocumentViewSharedProps; } @observer @@ -67,18 +67,15 @@ export class LinkMenu extends React.Component<Props> { group={group[1]} groupType={group[0]} showEditor={action(linkDoc => this._editingLink = linkDoc)} - addDocTab={this.props.addDocTab} />); + docprops={this.props.docprops} />); return linkItems.length ? linkItems : [<p key="">No links have been created yet. Drag the linking button onto another document to create a link.</p>]; } @computed get position() { - const docView = this.props.docView; - const transform = (docView.props.ScreenToLocalTransform().scale(docView.props.ContentScaling())).inverse(); - const [sptX, sptY] = transform.transformPoint(0, 0); - const [bptX, bptY] = transform.transformPoint(docView.props.PanelWidth(), docView.props.PanelHeight()); - return { x: sptX, y: sptY, r: bptX, b: bptY }; + const docView = this.props.docView.getBounds(); + return { x: docView?.left || 0, y: docView?.top || 0, r: docView?.right || 0, b: docView?.bottom || 0 }; } render() { |