aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenu.tsx
diff options
context:
space:
mode:
authorAubrey Li <Aubrey-Li>2022-04-14 17:43:09 -0400
committerAubrey Li <Aubrey-Li>2022-04-14 17:43:09 -0400
commitcf379920876cafa84b0f342dbd981d60a66b6b4a (patch)
tree3059e2cbc4028abe0b308c5a0fc59744b60faeb5 /src/client/views/linking/LinkMenu.tsx
parent98567999b9882ed093bb0d750504a1bd10aa9a94 (diff)
parent9ec7503370229c17cf8a0d3cf77571010db04a9b (diff)
Merge remote-tracking branch 'origin/presentation_group_test' into presentation_upgrade
Diffstat (limited to 'src/client/views/linking/LinkMenu.tsx')
-rw-r--r--src/client/views/linking/LinkMenu.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/views/linking/LinkMenu.tsx b/src/client/views/linking/LinkMenu.tsx
index 53fe3f682..bc922be36 100644
--- a/src/client/views/linking/LinkMenu.tsx
+++ b/src/client/views/linking/LinkMenu.tsx
@@ -12,7 +12,8 @@ import React = require("react");
interface Props {
docView: DocumentView;
- changeFlyout: () => void;
+ position?: { x?: number, y?: number };
+ itemHandler?: (doc: Doc) => void;
}
/**
@@ -25,7 +26,7 @@ export class LinkMenu extends React.Component<Props> {
@observable _linkMenuRef = React.createRef<HTMLDivElement>();
@computed get position() {
- return ((dv) => ({ x: dv?.left || 0, y: dv?.top || 0, r: dv?.right || 0, b: dv?.bottom || 0 }))(this.props.docView.getBounds());
+ return this.props.position ?? (dv => ({ x: dv?.left || 0, y: (dv?.bottom || 0) + 15 }))(this.props.docView.getBounds());
}
componentDidMount() { document.addEventListener("pointerdown", this.onPointerDown); }
@@ -48,19 +49,20 @@ export class LinkMenu extends React.Component<Props> {
const linkItems = Array.from(groups.entries()).map(group =>
<LinkMenuGroup
key={group[0]}
+ itemHandler={this.props.itemHandler}
docView={this.props.docView}
sourceDoc={this.props.docView.props.Document}
group={group[1]}
groupType={group[0]}
showEditor={action(linkDoc => this._editingLink = linkDoc)} />);
- return linkItems.length ? linkItems : [<p key="">No links have been created yet. Drag the linking button onto another document to create a link.</p>];
+ return linkItems.length ? linkItems : this.props.position ? [<></>] : [<p key="">No links have been created yet. Drag the linking button onto another document to create a link.</p>];
}
render() {
const sourceDoc = this.props.docView.props.Document;
return <div className="linkMenu" ref={this._linkMenuRef}
- style={{ left: this.position.x, top: this.props.docView.topMost ? undefined : this.position.b + 15, bottom: this.props.docView.topMost ? 20 : undefined }}
+ style={{ left: this.position.x, top: this.props.docView.topMost ? undefined : this.position.y, bottom: this.props.docView.topMost ? 20 : undefined }}
>
{this._editingLink ?
<div className="linkMenu-listEditor">