aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-04-27 14:55:04 -0400
committerbobzel <zzzman@gmail.com>2022-04-27 14:55:04 -0400
commit40ccb702d1dddf0ce9f15e047feb321353f01580 (patch)
tree810b09d24d0ff12fde5cb01955363e4a06868b56 /src/client/util/DocumentManager.ts
parent267d4d7c3f2a85f0df292dea9667293eee3358c5 (diff)
fixed following pushpin links to text selections to toggle the text box (since markers don't have a hidden flag for toggling). fixed pdf next/prev page and # pages. fixed pdf selections to not include <br>'s which apparently have the wrong bounds.
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 607a3d6bf..cc3196baa 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -168,15 +168,17 @@ export class DocumentManager {
originalTarget = originalTarget ?? targetDoc;
const getFirstDocView = LightboxView.LightboxDoc ? DocumentManager.Instance.getLightboxDocumentView : DocumentManager.Instance.getFirstDocumentView;
const docView = getFirstDocView(targetDoc, originatingDoc);
- const wasHidden = targetDoc.hidden; //
+ const annotatedDoc = Cast(targetDoc.annotationOn, Doc, null);
+ const resolvedTarget = targetDoc.type === DocumentType.MARKER ? annotatedDoc ?? targetDoc : targetDoc; // if target is a marker, then focus toggling should apply to the document it's on since the marker itself doesn't have a hidden field
+ const wasHidden = resolvedTarget.hidden;
if (wasHidden) {
runInAction(() => {
- targetDoc.hidden = false;
- docView?.props.bringToFront(targetDoc);
+ resolvedTarget.hidden = false;
+ docView?.props.bringToFront(resolvedTarget);
}); // if the target is hidden, un-hide it here.
}
const focusAndFinish = (didFocus: boolean) => {
- const finalTargetDoc = docView?.Document ?? targetDoc;
+ const finalTargetDoc = docView?.Document ?? resolvedTarget;
if (originatingDoc?.isPushpin) {
if (!didFocus && !wasHidden) { // don't toggle the hidden state if the doc was already un-hidden as part of this document traversal
finalTargetDoc.hidden = !finalTargetDoc.hidden;
@@ -188,7 +190,6 @@ export class DocumentManager {
finished?.();
return false;
};
- const annotatedDoc = Cast(targetDoc.annotationOn, Doc, null);
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;