diff options
author | bobzel <zzzman@gmail.com> | 2021-03-13 12:38:12 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-03-13 12:38:12 -0500 |
commit | e20a8916483734bb06d08409b6bc804c2391a289 (patch) | |
tree | 5c5c135a8894e8a2bd8d27eb03e004fedd291358 /src/client/util/DocumentManager.ts | |
parent | 280c24f1216a532e9f2157e6db0bf8c8030a16f3 (diff) |
fixed pdfs to show filtered annotations when a link follows to them by removing docFilters.
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r-- | src/client/util/DocumentManager.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index d975461e8..8cb80ecf9 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -9,9 +9,6 @@ import { CollectionView } from '../views/collections/CollectionView'; import { LightboxView } from '../views/LightboxView'; import { DocumentView, ViewAdjustment } from '../views/nodes/DocumentView'; import { Scripting } from './Scripting'; -import { CurrentUserUtils } from './CurrentUserUtils'; -import { TabDocView } from '../views/collections/TabDocView'; -import { UndoManager } from './UndoManager'; export class DocumentManager { @@ -160,12 +157,15 @@ export class DocumentManager { return false; }; const annotatedDoc = Cast(targetDoc.annotationOn, Doc, null); - const rtfView = annotatedDoc && getFirstDocView(annotatedDoc); + const annoContainerView = annotatedDoc && getFirstDocView(annotatedDoc); const contextDocs = docContext ? await DocListCastAsync(docContext.data) : undefined; const contextDoc = contextDocs?.find(doc => Doc.AreProtosEqual(doc, targetDoc) || Doc.AreProtosEqual(doc, annotatedDoc)) ? docContext : undefined; const targetDocContext = contextDoc || annotatedDoc; const targetDocContextView = targetDocContext && getFirstDocView(targetDocContext); - const focusView = !docView && targetDoc.type === DocumentType.TEXTANCHOR && rtfView ? rtfView : docView; + const focusView = !docView && targetDoc.type === DocumentType.TEXTANCHOR && annoContainerView ? annoContainerView : docView; + if (!docView && annoContainerView && !focusView) { + annoContainerView.focus(targetDoc); // this allows something like a PDF view to remove its doc filters to expose the target so that it can be found in the retry code below + } if (focusView) { focusView && Doc.linkFollowHighlight(focusView.rootDoc); focusView.focus(targetDoc, { @@ -196,6 +196,7 @@ export class DocumentManager { const findView = (delay: number) => { const retryDocView = getFirstDocView(targetDoc); // test again for the target view snce we presumably created the context above by focusing on it if (retryDocView) { // we found the target in the context + Doc.linkFollowHighlight(retryDocView.rootDoc); retryDocView.props.focus(targetDoc, { willZoom, afterFocus: (didFocus: boolean) => new Promise<ViewAdjustment>(res => { |