diff options
| author | bobzel <zzzman@gmail.com> | 2024-05-14 23:15:24 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-05-14 23:15:24 -0400 |
| commit | 3534aaf88a3c30a474b3b5a5b7f04adfe6f15fac (patch) | |
| tree | 47fb7a8671b209bd4d76e0f755a5b035c6936607 /src/client/views/DocViewUtils.ts | |
| parent | 87bca251d87b5a95da06b2212400ce9427152193 (diff) | |
| parent | 5cb7ad90e120123ca572e8ef5b1aa6ca41581134 (diff) | |
Merge branch 'restoringEslint' into sarah-ai-visualization
Diffstat (limited to 'src/client/views/DocViewUtils.ts')
| -rw-r--r-- | src/client/views/DocViewUtils.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client/views/DocViewUtils.ts b/src/client/views/DocViewUtils.ts new file mode 100644 index 000000000..1f5f29c7e --- /dev/null +++ b/src/client/views/DocViewUtils.ts @@ -0,0 +1,21 @@ +/* eslint-disable prefer-destructuring */ +/* eslint-disable default-param-last */ +/* eslint-disable no-use-before-define */ +import { runInAction } from 'mobx'; +import { Doc, SetActiveAudioLinker } from '../../fields/Doc'; +import { DocUtils } from '../documents/DocUtils'; +import { FieldViewProps } from './nodes/FieldView'; + +export namespace DocViewUtils { + export const ActiveRecordings: { props: FieldViewProps; getAnchor: (addAsAnnotation: boolean) => Doc }[] = []; + + export function MakeLinkToActiveAudio(getSourceDoc: () => Doc | undefined, broadcastEvent = true) { + broadcastEvent && runInAction(() => { Doc.RecordingEvent += 1; }); // prettier-ignore + return ActiveRecordings.map(audio => { + const sourceDoc = getSourceDoc(); + return sourceDoc && DocUtils.MakeLink(sourceDoc, audio.getAnchor(true) || audio.props.Document, { link_relationship: 'recording annotation:linked recording', link_description: 'recording timeline' }); + }); + } + + SetActiveAudioLinker(MakeLinkToActiveAudio); +} |
