aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenu.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-04-06 10:42:36 -0400
committerbobzel <zzzman@gmail.com>2022-04-06 10:42:36 -0400
commitaf8df1fc1af11318cadf1b71373bef776461a5cc (patch)
tree35cc41509dab9032c35708c561c0b341e4ece907 /src/client/views/linking/LinkMenu.tsx
parent8f6a065c192c091393e654bdac682c285a63ad8f (diff)
uses linkMenu in propertiesWindow now. updated linkMenu api, changed layout, made groups collapsible
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">