aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-11-04 01:29:48 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-11-04 01:29:48 +0800
commit7520040052b0943bc5c80d3754335eb869793eb1 (patch)
tree0b78cfbeae706f516f7352311d97dfb197add62d /src
parent88a677d37d63d2fcb163df5aee9cfbeb127a414f (diff)
fixed presCollection not updating correctly
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/PresBox.tsx11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 1d2e6d173..04eda8b90 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -313,14 +313,21 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
navigateToElement = async (curDoc: Doc) => {
const activeItem: Doc = this.activeItem;
const targetDoc: Doc = this.targetDoc;
- const srcContext = await DocCastAsync(targetDoc?.context);
+ const srcContext = Cast(targetDoc.context, Doc, null);
const presCollection = Cast(this.layoutDoc.presCollection, Doc, null);
const collectionDocView = presCollection ? DocumentManager.Instance.getDocumentView(presCollection) : undefined;
const includesDoc: boolean = DocListCast(presCollection?.data).includes(targetDoc);
+ const tab = Array.from(CollectionDockingView.Instance.tabMap).find(tab => tab.DashDoc === srcContext);
this.turnOffEdit();
+ // Handles the setting of presCollection
if (includesDoc) {
+ //Case 1: Pres collection should not change as it is already the same
+ console.log(1);
+ } else if (tab !== undefined) {
+ // Case 2: Pres collection should update
+ console.log(2);
this.layoutDoc.presCollection = srcContext;
- } else if (targetDoc) this.layoutDoc.presCollection = targetDoc;
+ }
const presStatus = this.rootDoc.presStatus;
const selViewCache = Array.from(this._selectedArray.keys());
const dragViewCache = Array.from(this._dragArray);