diff options
| author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 09:54:55 +0530 |
|---|---|---|
| committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 09:54:55 +0530 |
| commit | 3bfb158e4560ca2aa45373d39e46021a25051c96 (patch) | |
| tree | 2282a85074bf3eceb3f33285016a605f13584fd6 /src/client/views/collections/CollectionSubView.tsx | |
| parent | ef0528db45c3050671174163181531ace8692bdd (diff) | |
| parent | b096129d54238bc4cea735cd2db8e5f3e94613b7 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 0e40cd21c..d1aeb1b65 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -182,8 +182,6 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: } childDocs = docsforFilter; - - const docFilters = this.docFilters(); const docRangeFilters = this.props.ignoreFields?.includes("_docRangeFilters") ? [] : Cast(this.props.Document._docRangeFilters, listSpec("string"), []); return this.props.Document.dontRegisterView ? docs : DocUtils.FilterDocs(docs, this.docFilters(), docRangeFilters, viewSpecScript); @@ -402,14 +400,28 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: // } } if (uriList) { - this.addDocument(Docs.Create.WebDocument(uriList, { - ...options, - title: uriList, - _width: 400, - _height: 315, - _nativeWidth: 850, - _nativeHeight: 962 - })); + const existingWebDoc = await Hypothesis.findWebDoc(uriList); + if (existingWebDoc) { + const alias = Doc.MakeAlias(existingWebDoc); + alias.x = options.x; + alias.y = options.y; + alias._nativeWidth = 850; + alias._nativeHeight = 962; + alias._width = 400; + this.addDocument(alias); + } else { + const newDoc = Docs.Create.WebDocument(uriList, { + ...options, + 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; } @@ -492,3 +504,5 @@ import { CollectionView, CollectionViewType } from "./CollectionView"; import { SelectionManager } from "../../util/SelectionManager"; import { OverlayView } from "../OverlayView"; import { setTimeout } from "timers"; +import { Hypothesis } from "../../util/HypothesisUtils"; + |
