aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-11 19:51:08 -0400
committerbobzel <zzzman@gmail.com>2020-09-11 19:51:08 -0400
commitbfd2769ccce8db190913d9a9fcb6f8f3cac75935 (patch)
tree267a7a4480e9595ca43c51060e9ec58d4e48e2a7 /src/client/util/DocumentManager.ts
parentb81ad33b746387dc785580b719866f479fbd9b30 (diff)
fixed warnings and fixed focus on slide
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index f41c5e4cb..9bf10d167 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -10,6 +10,7 @@ import { Scripting } from './Scripting';
import { SelectionManager } from './SelectionManager';
import { DocumentType } from '../documents/DocumentTypes';
import { TraceMobx } from '../../fields/util';
+import { returnFalse } from '../../Utils';
export type CreateViewFunc = (doc: Doc, followLinkLocation: string, finished?: () => void) => void;
@@ -86,7 +87,8 @@ export class DocumentManager {
}
public getFirstDocumentView = (toFind: Doc, originatingDoc: Opt<Doc> = undefined): DocumentView | undefined => {
- return this.getDocumentViews(toFind)?.find(view => view.props.Document !== originatingDoc);
+ const views = this.getDocumentViews(toFind).filter(view => view.props.Document !== originatingDoc);
+ return views?.find(view => view.props.focus !== returnFalse) || (view.length ? views[0] : undefined);
}
public getDocumentViews(toFind: Doc): DocumentView[] {
const toReturn: DocumentView[] = [];
@@ -200,7 +202,7 @@ export class DocumentManager {
} else {
setTimeout(() => findView(delay + 250), 250);
}
- }
+ };
findView(0);
}
} else { // there's no context view so we need to create one first and try again