From c94a61aa594f77db4c9b08a5f91c1a7e57d5ff9d Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Thu, 6 Aug 2020 11:47:16 -0700 Subject: add compatibility for start/complete link buttons in the client --- src/client/apis/hypothesis/HypothesisUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/apis/hypothesis/HypothesisUtils.ts b/src/client/apis/hypothesis/HypothesisUtils.ts index 075187934..de068c7d4 100644 --- a/src/client/apis/hypothesis/HypothesisUtils.ts +++ b/src/client/apis/hypothesis/HypothesisUtils.ts @@ -113,7 +113,8 @@ export namespace Hypothesis { // listen for event from Hypothes.is plugin to link an annotation to Dash export const linkListener = async (e: any) => { const annotationId: string = e.detail.id; - const annotationUri: string = StrCast(e.detail.uri).split("#annotations:")[0]; // clean hypothes.is URLs that reference a specific annotation (eg. https://en.wikipedia.org/wiki/Cartoon#annotations:t7qAeNbCEeqfG5972KR2Ig) + const annotationUri: string = StrCast(e.detail.uri).split("#annotations:")[0]; // clean hypothes.is URLs that reference a specific annotation + const isStart = (e.detail.isLinkStart === "true"); const sourceDoc: Doc = await getSourceWebDoc(annotationUri); if (!DocumentLinksButton.StartLink) { // start link if there were none already started @@ -123,7 +124,6 @@ export namespace Hypothesis { DocumentLinksButton.StartLink = sourceDoc; }); } else if (!Doc.AreProtosEqual(sourceDoc, DocumentLinksButton.StartLink)) { // if a link has already been started, complete the link to the sourceDoc - console.log("completing link", sourceDoc.title); runInAction(() => { DocumentLinksButton.AnnotationId = annotationId; DocumentLinksButton.AnnotationUri = annotationUri; -- cgit v1.2.3-70-g09d2