aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util')
-rw-r--r--src/client/util/DocumentManager.ts6
-rw-r--r--src/client/util/LinkManager.ts13
2 files changed, 10 insertions, 9 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index dd59efa41..6013a2ef3 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -7,7 +7,7 @@ import { DocumentType } from '../documents/DocumentTypes';
import { CollectionDockingView } from '../views/collections/CollectionDockingView';
import { CollectionView } from '../views/collections/CollectionView';
import { LightboxView } from '../views/LightboxView';
-import { DocumentView } from '../views/nodes/DocumentView';
+import { DocumentView, ViewAdjustment } from '../views/nodes/DocumentView';
import { Scripting } from './Scripting';
export class DocumentManager {
@@ -173,7 +173,7 @@ export class DocumentManager {
else if (docView) {
docView.props.focus(targetDoc, {
originalTarget, willZoom, afterFocus: (didFocus: boolean) =>
- new Promise<boolean>(res => {
+ new Promise<ViewAdjustment>(res => {
focusAndFinish(didFocus);
res();
})
@@ -197,7 +197,7 @@ export class DocumentManager {
if (retryDocView) { // we found the target in the context
retryDocView.props.focus(targetDoc, {
willZoom, afterFocus: (didFocus: boolean) =>
- new Promise<boolean>(res => {
+ new Promise<ViewAdjustment>(res => {
focusAndFinish(didFocus);
res();
})
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts
index f741d9c2c..402cbdd68 100644
--- a/src/client/util/LinkManager.ts
+++ b/src/client/util/LinkManager.ts
@@ -3,7 +3,7 @@ import { computedFn } from "mobx-utils";
import { Doc, DocListCast, Opt } from "../../fields/Doc";
import { BoolCast, Cast, StrCast } from "../../fields/Types";
import { LightboxView } from "../views/LightboxView";
-import { DocumentViewSharedProps } from "../views/nodes/DocumentView";
+import { DocumentViewSharedProps, ViewAdjustment } from "../views/nodes/DocumentView";
import { DocumentManager } from "./DocumentManager";
import { SharingManager } from "./SharingManager";
import { UndoManager } from "./UndoManager";
@@ -105,21 +105,22 @@ export class LinkManager {
const batch = UndoManager.StartBatch("follow link click");
// open up target if it's not already in view ...
const createViewFunc = (doc: Doc, followLoc: string, finished?: Opt<() => void>) => {
- const createTabForTarget = (didFocus: boolean) => new Promise<boolean>(res => {
+ const createTabForTarget = (didFocus: boolean) => new Promise<ViewAdjustment>(res => {
const where = LightboxView.LightboxDoc ? "lightbox" : StrCast(sourceDoc.followLinkLocation) || followLoc;
docViewProps.addDocTab(doc, where);
setTimeout(() => {
const targDocView = DocumentManager.Instance.getFirstDocumentView(doc);
if (targDocView) {
targDocView.props.focus(doc, {
- willZoom: BoolCast(sourceDoc.followLinkZoom, false), afterFocus: (didFocus: boolean) => {
+ willZoom: BoolCast(sourceDoc.followLinkZoom, false),
+ afterFocus: (didFocus: boolean) => {
finished?.();
- res(true);
- return new Promise<boolean>(res2 => res2());
+ res(ViewAdjustment.resetView);
+ return new Promise<ViewAdjustment>(res2 => res2());
}
});
} else {
- res(where !== "inPlace"); // return true to reset the initial focus&zoom (return false for 'inPlace' since resetting the initial focus&zoom will negate the zoom into the target)
+ res(where !== "inPlace" ? ViewAdjustment.resetView : ViewAdjustment.doNothing); // for 'inPlace' resetting the initial focus&zoom would negate the zoom into the target
}
});
});