From 28292ff91ea48b129dee6e692343790696e12b7f Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Fri, 3 Jul 2020 15:12:58 -0700 Subject: added button to send event to hypothes.is to complete link --- src/client/views/nodes/DocumentView.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 09eeaee36..2c22bde81 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -42,6 +42,7 @@ import { LinkAnchorBox } from './LinkAnchorBox'; import { RadialMenu } from './RadialMenu'; import React = require("react"); import { DocumentLinksButton } from './DocumentLinksButton'; +import { HypothesisApi } from '../../apis/hypothesis/HypothesisApiUtils'; library.add(fa.faEdit, fa.faTrash, fa.faShare, fa.faDownload, fa.faExpandArrowsAlt, fa.faCompressArrowsAlt, fa.faLayerGroup, fa.faExternalLinkAlt, fa.faAlignCenter, fa.faCaretSquareRight, fa.faSquare, fa.faConciergeBell, fa.faWindowRestore, fa.faFolder, fa.faMapPin, fa.faLink, fa.faFingerprint, fa.faCrosshairs, fa.faDesktop, fa.faUnlock, fa.faLock, fa.faLaptopCode, fa.faMale, @@ -736,6 +737,13 @@ export class DocumentView extends DocComponent(Docu const cm = ContextMenu.Instance; + cm.addItem({ + description: "make hypothesis link", event: () => { + const docUrl = Utils.prepend("/doc/" + this.props.Document[Id]); + document.dispatchEvent(new CustomEvent("hypothesisLink", { detail: docUrl })); + }, icon: "eye" + }); + const customScripts = Cast(this.props.Document.contextMenuScripts, listSpec(ScriptField), []); Cast(this.props.Document.contextMenuLabels, listSpec("string"), []).forEach((label, i) => cm.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" })); -- cgit v1.2.3-70-g09d2