diff options
| author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-01-20 11:22:26 -0500 |
|---|---|---|
| committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-01-20 11:22:26 -0500 |
| commit | 8d015ff599c145578166dda3013c6aaec1d34450 (patch) | |
| tree | f4f2f6d5f6c258a4bd4fdebc9d48770e2429df52 /src/client/views/collections/CollectionTimeView.tsx | |
| parent | 0ef7050b0792ce183c7d5cda637cb79b7a92b704 (diff) | |
| parent | 84f728cffb94319b86be8d6cc478ce424ec45c2f (diff) | |
Merge branch 'master' of github.com:brown-dash/Dash-Web into master
Diffstat (limited to 'src/client/views/collections/CollectionTimeView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionTimeView.tsx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionTimeView.tsx b/src/client/views/collections/CollectionTimeView.tsx index a1466bcd0..8c613198d 100644 --- a/src/client/views/collections/CollectionTimeView.tsx +++ b/src/client/views/collections/CollectionTimeView.tsx @@ -32,7 +32,7 @@ export class CollectionTimeView extends CollectionSubView() { @observable _viewDefDivClick: Opt<ScriptField>; @observable _focusPivotField: Opt<string>; - getAnchor = () => { + getAnchor = (addAsAnnotation: boolean) => { const anchor = Docs.Create.HTMLAnchorDocument([], { title: ComputedField.MakeFunction(`"${this.pivotField}"])`) as any, annotationOn: this.rootDoc, @@ -45,11 +45,13 @@ export class CollectionTimeView extends CollectionSubView() { proto.docRangeFilters = ObjectField.MakeCopy(this.layoutDoc._docRangeFilters as ObjectField) || new List<string>([]); proto[ViewSpecPrefix + '_viewType'] = this.layoutDoc._viewType; - // store anchor in annotations list of document (not technically needed since these anchors are never drawn) - if (Cast(this.dataDoc[this.props.fieldKey + '-annotations'], listSpec(Doc), null) !== undefined) { - Cast(this.dataDoc[this.props.fieldKey + '-annotations'], listSpec(Doc), []).push(anchor); - } else { - this.dataDoc[this.props.fieldKey + '-annotations'] = new List<Doc>([anchor]); + if (addAsAnnotation) { + // when added as an annotation, links to anchors can be found as links to the document even if the anchors are not rendered + if (Cast(this.dataDoc[this.props.fieldKey + '-annotations'], listSpec(Doc), null) !== undefined) { + Cast(this.dataDoc[this.props.fieldKey + '-annotations'], listSpec(Doc), []).push(anchor); + } else { + this.dataDoc[this.props.fieldKey + '-annotations'] = new List<Doc>([anchor]); + } } return anchor; }; |
