aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-06 11:07:28 -0400
committerbobzel <zzzman@gmail.com>2020-10-06 11:07:28 -0400
commit83aaea5320257ce15d68a5299c00977684ddab8e (patch)
treecdb96cd3b4407684669c88c82e753173875d26e2
parent9c4701f8a8214544a0e1e6b31887d393e8ad344f (diff)
restored ability to open document that has been moved from another document's annotation overlay
-rw-r--r--src/client/util/DocumentManager.ts8
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx3
-rw-r--r--src/client/views/nodes/FieldView.tsx2
-rw-r--r--src/client/views/pdf/PDFViewer.tsx6
4 files changed, 11 insertions, 8 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 2ca29cb7e..e2518d05f 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -193,11 +193,13 @@ export class DocumentManager {
if (retryDocView) { // we found the target in the context
retryDocView.props.focus(targetDoc, willZoom, undefined, focusAndFinish); // focus on the target in the context
highlight();
- }
- if (delay > 2500) {
+ } 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.props.Document);
- // targetDoc.layout && createViewFunc(Doc.BrushDoc(targetDoc), finished); // create a new view of the target
+ if (targetDoc.layout) {
+ Doc.SetInPlace(targetDoc, "annotationOn", undefined, false);
+ createViewFunc(Doc.BrushDoc(targetDoc), finished); // create a new view of the target
+ }
} else {
setTimeout(() => findView(delay + 250), 250);
}
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 2783011cf..fc3fd3a7c 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -891,9 +891,10 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
} else {
const contextHgt = Doc.AreProtosEqual(annotOn, this.props.Document) && this.props.VisibleHeight ? this.props.VisibleHeight() : NumCast(annotOn._height);
const offset = annotOn && (contextHgt / 2);
- this.props.Document._scrollY = NumCast(doc.y) - offset;
+ this.props.Document._scrollY = NumCast(doc.y) - ((Number.isNaN(offset) ? 150 : offset));
}
+ this.props.focus(this.props.Document);
afterFocus && setTimeout(afterFocus, 1000);
} else {
const layoutdoc = Doc.Layout(doc);
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index d65b43704..3a5b27b21 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -134,7 +134,7 @@ export class FieldView extends React.Component<FieldViewProps> {
// );
}
else if (field instanceof List) {
- return <div> {field.length ? field.map(f => Field.toString(f)).join(", ") : "[]"} </div>;
+ return <div> {field.length ? field.map(f => Field.toString(f)).join(", ") : ""} </div>;
}
// bcz: this belongs here, but it doesn't render well so taking it out for now
else if (field instanceof WebField) {
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 582e4ba84..4c5f72b97 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -180,9 +180,9 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
if (scrollY !== undefined) {
(this._showCover || this._showWaiting) && this.setupPdfJsViewer();
if ((this.props.renderDepth === -1 || (!LinkDocPreview.TargetDoc && !FormattedTextBoxComment.linkDoc)) && this._mainCont.current) {
- smoothScroll(1000, this._mainCont.current, (this.Document._scrollY || 0));
- } else {
- console.log("Waiting for preview");
+ smoothScroll(1000, this._mainCont.current, scrollY || 0);
+ } else if (!LinkDocPreview.TargetDoc && !FormattedTextBoxComment.linkDoc) { // wait for mainCont and try again to scroll
+ setTimeout(() => this._mainCont.current && smoothScroll(1000, this._mainCont.current, scrollY || 0), 250);
}
setTimeout(() => this.Document._scrollY = undefined, 1000);
}