aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index e33449782..ad57c2a62 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -2,7 +2,6 @@ import { Howl } from 'howler';
import { action, computed, makeObservable, observable, ObservableSet, observe } from 'mobx';
import { Doc, Opt } from '../../fields/Doc';
import { Animation, DocData } from '../../fields/DocSymbols';
-import { Id } from '../../fields/FieldSymbols';
import { listSpec } from '../../fields/Schema';
import { Cast, DocCast, NumCast, StrCast } from '../../fields/Types';
import { AudioField } from '../../fields/URLField';
@@ -108,16 +107,16 @@ export class DocumentManager {
});
// gets all views
- public getDocumentViewsById(id: string) {
+ public getAllDocumentViews(doc: Doc) {
const toReturn: DocumentView[] = [];
DocumentManager.Instance.DocumentViews.forEach(view => {
- if (view.Document[Id] === id) {
+ if (view.Document === doc) {
toReturn.push(view);
}
});
if (toReturn.length === 0) {
DocumentManager.Instance.DocumentViews.forEach(view => {
- if (view.Document[DocData]?.[Id] === id) {
+ if (view.Document[DocData] === doc) {
toReturn.push(view);
}
});
@@ -125,10 +124,6 @@ export class DocumentManager {
return toReturn;
}
- public getAllDocumentViews(doc: Doc) {
- return this.getDocumentViewsById(doc[Id]);
- }
-
public getDocumentView(target: Doc | undefined, preferredCollection?: DocumentView): DocumentView | undefined {
const docViewArray = DocumentManager.Instance.DocumentViews;
const passes = !target ? [] : preferredCollection ? [preferredCollection, undefined] : [undefined];
@@ -188,7 +183,7 @@ export class DocumentManager {
static _howl: Howl;
static playAudioAnno(doc: Doc) {
- const anno = Cast(doc[Doc.LayoutFieldKey(doc) + '_audioAnnotations'], listSpec(AudioField), null)?.lastElement();
+ const anno = Cast(doc[Doc.LayoutDataKey(doc) + '_audioAnnotations'], listSpec(AudioField), null)?.lastElement();
if (anno) {
this._howl?.stop();
if (anno instanceof AudioField) {