aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocViewUtils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-15 10:55:17 -0400
committerbobzel <zzzman@gmail.com>2024-05-15 10:55:17 -0400
commit213e5c5ab7dcb7a92a2d6c0e2ca10433ddc3141f (patch)
tree01a4c5501ce4e6ce8fb74c4a64acb6bc77c5562e /src/client/views/DocViewUtils.ts
parentc329d7719ed60d71bec4a8ac7309e33081c3373c (diff)
parent0b1d434ad7f0d057456631ac786ed338c84a7f41 (diff)
merged with new eslint code
Diffstat (limited to 'src/client/views/DocViewUtils.ts')
-rw-r--r--src/client/views/DocViewUtils.ts21
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);
+}