aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-02-16 00:59:28 -0500
committerbobzel <zzzman@gmail.com>2021-02-16 00:59:28 -0500
commit05a9a3eed9a1afb55ec0ca55845b33cc745289e0 (patch)
tree2f8b7350fd5a2c3b4570cbc0a4464d5ffd2b51e5 /src/client/util/DocumentManager.ts
parent53b13f534431266e6efc856c8b5dc6e886cd171d (diff)
updated pivot views to have a getAnchor() method to save the pivotField when linking. added an engineProp to layoutEngiens so that you can preview a change in a LinkDocPreview without modifying the document.
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 6013a2ef3..d028258b2 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -144,10 +144,6 @@ export class DocumentManager {
originalTarget = originalTarget ?? targetDoc;
const getFirstDocView = LightboxView.LightboxDoc ? DocumentManager.Instance.getLightboxDocumentView : DocumentManager.Instance.getFirstDocumentView;
const docView = getFirstDocView(targetDoc, originatingDoc);
- const highlight = () => {
- const finalDocView = getFirstDocView(targetDoc);
- finalDocView && Doc.linkFollowHighlight(finalDocView.rootDoc);
- };
const focusAndFinish = (didFocus: boolean) => {
if (originatingDoc?.isPushpin) {
if (!didFocus || targetDoc.hidden) {
@@ -157,7 +153,6 @@ export class DocumentManager {
targetDoc.hidden && (targetDoc.hidden = undefined);
docView?.select(false);
}
- highlight();
finished?.();
return false;
};
@@ -167,11 +162,10 @@ export class DocumentManager {
const contextDoc = contextDocs?.find(doc => Doc.AreProtosEqual(doc, targetDoc) || Doc.AreProtosEqual(doc, annotatedDoc)) ? docContext : undefined;
const targetDocContext = contextDoc || annotatedDoc;
const targetDocContextView = targetDocContext && getFirstDocView(targetDocContext);
- if (!docView && targetDoc.type === DocumentType.TEXTANCHOR && rtfView) {
- rtfView.focus(targetDoc);
- }
- else if (docView) {
- docView.props.focus(targetDoc, {
+ const focusView = !docView && targetDoc.type === DocumentType.TEXTANCHOR && rtfView ? rtfView : docView;
+ if (focusView) {
+ focusView && Doc.linkFollowHighlight(focusView.rootDoc);
+ focusView.focus(targetDoc, {
originalTarget, willZoom, afterFocus: (didFocus: boolean) =>
new Promise<ViewAdjustment>(res => {
focusAndFinish(didFocus);
@@ -181,7 +175,6 @@ export class DocumentManager {
} else {
if (!targetDocContext) { // we don't have a view and there's no context specified ... create a new view of the target using the dockFunc or default
createViewFunc(Doc.BrushDoc(targetDoc), finished); // bcz: should we use this?: Doc.MakeAlias(targetDoc)));
- highlight();
} else { // otherwise try to get a view of the context of the target
if (targetDocContextView) { // we found a context view and aren't forced to create a new one ... focus on the context first..
targetDocContext._viewTransition = "transform 500ms";
@@ -202,7 +195,6 @@ export class DocumentManager {
res();
})
}); // focus on the target in the context
- highlight();
} else if (delay > 1500) {
// we didn't find the target, so it must have moved out of the context. Go back to just creating it.
if (closeContextIfNotFound) targetDocContextView.props.removeDocument?.(targetDocContextView.rootDoc);