aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
authorMelissa Zhang <mzhang19096@gmail.com>2020-07-14 22:22:47 -0700
committerMelissa Zhang <mzhang19096@gmail.com>2020-07-14 22:22:47 -0700
commit610ddaf1425018b4b00eb1fae83930f20777bad7 (patch)
tree102c20334b54e2200030f7d36ce11cd7b8987a43 /src/client/views/nodes
parenteb6e1b6705560d6fe94cb5787839b9138ab4b979 (diff)
deleting a link in a document removes its corresponding hyperlink in annotation (with some regex bugs)
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/DocumentLinksButton.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx
index ab97e8531..6d439e379 100644
--- a/src/client/views/nodes/DocumentLinksButton.tsx
+++ b/src/client/views/nodes/DocumentLinksButton.tsx
@@ -40,7 +40,7 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
componentDidMount() {
window.addEventListener("message", async (e: any) => {
if (e.origin === "http://localhost:1050" && e.data.message === "annotation created") {
- console.log("DASH RECEIVED MESSAGE:", e.data.message);
+ console.log("DASH received message: annotation created");
const response = await Hypothesis.getPlaceholderId("placeholder"); // delete once eventListening between client & Dash works
const source = SelectionManager.SelectedDocuments()[0];
response && runInAction(() => {
@@ -110,7 +110,6 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
if (DocumentLinksButton.StartLink === this.props.View) {
DocumentLinksButton.StartLink = undefined;
DocumentLinksButton.AnnotationId = undefined;
- console.log("reset to undefined (completeLink)");
// action((e: React.PointerEvent<HTMLDivElement>) => {
// Doc.UnBrushDoc(this.props.View.Document);
// });
@@ -124,8 +123,9 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
if (DocumentLinksButton.AnnotationId && DocumentLinksButton.AnnotationUri) {
const sourceUrl = DocumentLinksButton.AnnotationUri;
Doc.GetProto(linkDoc as Doc).linksToAnnotation = true;
+ Doc.GetProto(linkDoc as Doc).annotationId = DocumentLinksButton.AnnotationId;
Doc.GetProto(linkDoc as Doc).annotationUrl = Hypothesis.makeAnnotationUrl(DocumentLinksButton.AnnotationId, sourceUrl); // redirect web doc to this URL when following link
- Hypothesis.dispatchLinkRequest(StrCast(targetDoc.title), Utils.prepend("/doc/" + targetDoc[Id]), DocumentLinksButton.AnnotationId); // update and link placeholder annotation
+ Hypothesis.makeLink(StrCast(targetDoc.title), Utils.prepend("/doc/" + targetDoc[Id]), DocumentLinksButton.AnnotationId); // update and link placeholder annotation
}
LinkManager.currentLink = linkDoc;
@@ -151,7 +151,6 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
if (DocumentLinksButton.StartLink === this.props.View) {
DocumentLinksButton.StartLink = undefined;
DocumentLinksButton.AnnotationId = undefined;
- console.log("reset to undefined (finisheLinkClick)");
// action((e: React.PointerEvent<HTMLDivElement>) => {
// Doc.UnBrushDoc(this.props.View.Document);
// });
@@ -165,8 +164,9 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
if (DocumentLinksButton.AnnotationId && DocumentLinksButton.AnnotationUri) {
const sourceUrl = DocumentLinksButton.AnnotationUri; // the URL of the annotation's source web page
Doc.GetProto(linkDoc as Doc).linksToAnnotation = true;
+ Doc.GetProto(linkDoc as Doc).annotationId = DocumentLinksButton.AnnotationId;
Doc.GetProto(linkDoc as Doc).annotationUrl = Hypothesis.makeAnnotationUrl(DocumentLinksButton.AnnotationId, sourceUrl); // redirect web doc to this URL when following link
- Hypothesis.dispatchLinkRequest(StrCast(targetDoc.title), Utils.prepend("/doc/" + targetDoc[Id]), DocumentLinksButton.AnnotationId); // update and link placeholder annotation
+ Hypothesis.makeLink(StrCast(targetDoc.title), Utils.prepend("/doc/" + targetDoc[Id]), DocumentLinksButton.AnnotationId); // update and link placeholder annotation
}
LinkManager.currentLink = linkDoc;