aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenu.tsx
diff options
context:
space:
mode:
authorMelissa Zhang <mzhang19096@gmail.com>2020-07-03 17:58:47 -0700
committerMelissa Zhang <mzhang19096@gmail.com>2020-07-03 17:58:47 -0700
commit0e3d35d1139d0edc9247837124c3ffdc0b7201e5 (patch)
treef7f315ec4a4fe44bb3808369710df4a59a09a5c9 /src/client/views/linking/LinkMenu.tsx
parent58b780563c7fc4a1496f5c676f2d14faddb096e0 (diff)
parentdf00289aad1c35e3811c02aada6479a5490e9650 (diff)
merge with master again
Diffstat (limited to 'src/client/views/linking/LinkMenu.tsx')
-rw-r--r--src/client/views/linking/LinkMenu.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/linking/LinkMenu.tsx b/src/client/views/linking/LinkMenu.tsx
index de1d60a09..c672511ac 100644
--- a/src/client/views/linking/LinkMenu.tsx
+++ b/src/client/views/linking/LinkMenu.tsx
@@ -10,6 +10,7 @@ import { LinkMenuGroup } from "./LinkMenuGroup";
import { faTrash } from '@fortawesome/free-solid-svg-icons';
import { library } from "@fortawesome/fontawesome-svg-core";
import { DocumentLinksButton } from "../nodes/DocumentLinksButton";
+import { LinkDocPreview } from "../nodes/LinkDocPreview";
library.add(faTrash);
@@ -28,9 +29,16 @@ export class LinkMenu extends React.Component<Props> {
@action
onClick = (e: PointerEvent) => {
+
+ LinkDocPreview.LinkInfo = undefined;
+
if (this._linkMenuRef?.contains(e.target as any)) {
DocumentLinksButton.EditLink = undefined;
}
+
+ if (this._linkMenuRef && !this._linkMenuRef.contains(e.target as any)) {
+ DocumentLinksButton.EditLink = undefined;
+ }
}
@action
componentDidMount() {
@@ -70,7 +78,8 @@ export class LinkMenu extends React.Component<Props> {
render() {
const sourceDoc = this.props.docView.props.Document;
const groups: Map<string, Doc[]> = LinkManager.Instance.getRelatedGroupedLinks(sourceDoc);
- return <div className="linkMenu-list" ref={(r) => this._linkMenuRef = r} style={{ left: this.props.location[0], top: this.props.location[1] }}>
+ return <div className="linkMenu-list"
+ ref={(r) => this._linkMenuRef = r} style={{ left: this.props.location[0], top: this.props.location[1] }}>
{!this._editingLink ?
this.renderAllGroups(groups) :
<LinkEditor sourceDoc={this.props.docView.props.Document} linkDoc={this._editingLink} showLinks={action(() => this._editingLink = undefined)} />