diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/DocumentManager.ts | 11 | ||||
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 9 |
2 files changed, 14 insertions, 6 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 => { diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index e1ac8f16d..4e4db323c 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -28,6 +28,8 @@ import { FormattedTextBox } from './formattedText/FormattedTextBox'; import { pageSchema } from "./ImageBox"; import "./PDFBox.scss"; import React = require("react"); +import { DocFocusOptions } from './DocumentView'; +import { List } from '../../../fields/List'; type PdfDocument = makeInterface<[typeof documentSchema, typeof panZoomSchema, typeof pageSchema]>; const PdfDocument = makeInterface(documentSchema, panZoomSchema, pageSchema); @@ -87,6 +89,12 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum initialScrollTarget: Opt<Doc>; scrollFocus = (doc: Doc, smooth: boolean) => { + if (DocListCast(this.rootDoc[this.sidebarKey()]).includes(doc)) { + if (this.layoutDoc["_" + this.sidebarKey() + "-docFilters"]) { + this.layoutDoc["_" + this.sidebarKey() + "-docFilters"] = new List<string>(); + return 1; + } + } this.initialScrollTarget = doc; return this._pdfViewer?.scrollFocus(doc, smooth); } @@ -298,7 +306,6 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum </div> </div>; } - isChildActive = (outsideReaction?: boolean) => this._isChildActive; @computed get renderPdfView() { TraceMobx(); |