aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-13 12:38:12 -0500
committerbobzel <zzzman@gmail.com>2021-03-13 12:38:12 -0500
commite20a8916483734bb06d08409b6bc804c2391a289 (patch)
tree5c5c135a8894e8a2bd8d27eb03e004fedd291358 /src
parent280c24f1216a532e9f2157e6db0bf8c8030a16f3 (diff)
fixed pdfs to show filtered annotations when a link follows to them by removing docFilters.
Diffstat (limited to 'src')
-rw-r--r--src/client/util/DocumentManager.ts11
-rw-r--r--src/client/views/nodes/PDFBox.tsx9
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();