From 2e1284512f6f302673874ef3c368bdc50735f2a6 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Mon, 6 Jul 2020 16:01:42 -0700 Subject: set up linking from Dash documents to annotation --- src/client/views/nodes/DocumentLinksButton.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/client/views/nodes/DocumentLinksButton.tsx') diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx index bfd860f65..37d47700f 100644 --- a/src/client/views/nodes/DocumentLinksButton.tsx +++ b/src/client/views/nodes/DocumentLinksButton.tsx @@ -11,6 +11,9 @@ import { DocUtils } from "../../documents/Documents"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { LinkDocPreview } from "./LinkDocPreview"; import { LinkCreatedBox } from "./LinkCreatedBox"; +import { SelectionManager } from "../../util/SelectionManager"; +import { Document } from "../../../fields/documentSchemas"; + const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -27,6 +30,21 @@ export class DocumentLinksButton extends React.Component { // event used by Hypothes.is plugin to tell Dash when an unlinked annotation has been created + // const annotatedUrl = e.details; + // SelectionManager.SelectedDocuments().forEach(action((element: DocumentView) => { + // DocumentLinksButton.StartLink = element; + // })); + // }); + window.addEventListener("fakeLinkStarted", (e: any) => { // event used by Hypothes.is plugin to tell Dash when an unlinked annotation has been created + console.log("Helo fake link"); + SelectionManager.SelectedDocuments().forEach(action((element: DocumentView) => { + DocumentLinksButton.StartLink = element; + })); + }); + } + @action onLinkButtonMoved = (e: PointerEvent) => { if (this._linkButton.current !== null) { -- cgit v1.2.3-70-g09d2