aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenu.tsx
diff options
context:
space:
mode:
authorgeireann <60007097+geireann@users.noreply.github.com>2020-07-05 12:32:20 +0800
committergeireann <60007097+geireann@users.noreply.github.com>2020-07-05 12:32:20 +0800
commitc7dd9ba9e953adfb8c117bee3b95528d8d8c7304 (patch)
tree6aebd235aadb8ff4a4a464697ec4eb9fdcbb091a /src/client/views/linking/LinkMenu.tsx
parent2c04b0ae3689d931675151acbec24c88ea00daa1 (diff)
parent641ddbeefbbc05f8bf586c542595af672826149b (diff)
Merge branch 'master' into presentation_updates
Diffstat (limited to 'src/client/views/linking/LinkMenu.tsx')
-rw-r--r--src/client/views/linking/LinkMenu.tsx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/client/views/linking/LinkMenu.tsx b/src/client/views/linking/LinkMenu.tsx
index 0fcc0f0b9..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,7 +29,14 @@ export class LinkMenu extends React.Component<Props> {
@action
onClick = (e: PointerEvent) => {
- if (!Array.from(this._linkMenuRef?.getElementsByTagName((e.target as HTMLElement).tagName) || []).includes(e.target as any)) {
+
+ 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;
}
}
@@ -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)} />