From 6263a4539576ce92f97a02b9e7bde2804e01a6df Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Sat, 8 Aug 2020 15:28:55 -0700 Subject: clean up code, fix delete link bugs --- src/client/views/collections/CollectionSubView.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/views/collections/CollectionSubView.tsx') diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 4d9ed358b..e045b351f 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -403,7 +403,6 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T, moreProps?: } if (uriList) { const existingWebDoc = await Hypothesis.findWebDoc(uriList); - if (existingWebDoc) { const alias = Doc.MakeAlias(existingWebDoc); alias.x = options.x; @@ -413,16 +412,17 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T, moreProps?: alias._width = 400; this.addDocument(alias); } else { - const cleanedUri = uriList.split("#annotations:")[0]; // clean hypothes.is URLs that reference a specific annotation (eg. https://en.wikipedia.org/wiki/Cartoon#annotations:t7qAeNbCEeqfG5972KR2Ig) - this.addDocument(Docs.Create.WebDocument(uriList, { + const newDoc = Docs.Create.WebDocument(uriList, { ...options, - title: cleanedUri, + title: uriList.split("#annotations:")[0], _width: 400, _height: 315, _nativeWidth: 850, _nativeHeight: 962, UseCors: true - })); + }); + newDoc.data = new WebField(uriList.split("#annotations:")[0]); // clean hypothes.is URLs that reference a specific annotation (eg. https://en.wikipedia.org/wiki/Cartoon#annotations:t7qAeNbCEeqfG5972KR2Ig) + this.addDocument(newDoc); } return; } -- cgit v1.2.3-70-g09d2