aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-01-25 12:59:50 -0500
committerbobzel <zzzman@gmail.com>2023-01-25 12:59:50 -0500
commit1763ff090ea734ca275c3c28edc6c303c935b801 (patch)
tree88630593b7bcdf109fa04f427fe565ce234667d8 /src/client/util/DocumentManager.ts
parent555d67a31adbe7e6d42f7f7805ba1348e6d505f6 (diff)
added a linkFollow o[ption to choose between opening target, or highest level collection containing target. fixed adding marker annotations to pdf/web/etc. fixed following link to wikipedia pages to not create a new document each time. made searchBox's search function static so that it can be called programmatically. Fixed LinkDocPreview to not flicker when doing a nopreview link follow. changed PlayTrail to restore state of all freeform collections containing source anchor.
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index aa09fb005..7c867d710 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -194,11 +194,16 @@ export class DocumentManager {
return toReturn;
}
- static GetContextPath(doc: Opt<Doc>) {
+ static GetContextPath(doc: Opt<Doc>, includeExistingViews?: boolean) {
if (!doc) return [];
const srcContext = Cast(doc.context, Doc, null) ?? Cast(Cast(doc.annotationOn, Doc, null)?.context, Doc, null);
var containerDocContext = srcContext ? [srcContext] : [];
- while (containerDocContext.length && containerDocContext[0]?.context && DocCast(containerDocContext[0].context)?.viewType !== CollectionViewType.Docking && !DocumentManager.Instance.getDocumentView(containerDocContext[0])) {
+ while (
+ containerDocContext.length &&
+ containerDocContext[0]?.context &&
+ DocCast(containerDocContext[0].context)?.viewType !== CollectionViewType.Docking &&
+ (includeExistingViews || !DocumentManager.Instance.getDocumentView(containerDocContext[0]))
+ ) {
containerDocContext = [Cast(containerDocContext[0].context, Doc, null), ...containerDocContext];
}
return containerDocContext;