From 19705d01102fbb594ea5df18bb980bd2dfec93d4 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 3 Jun 2022 08:44:03 -0400
Subject: fixed presentation as list index display

---
 src/client/views/nodes/trails/PresBox.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/trails/PresBox.tsx')

diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index d85f0b640..f4e792acd 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -102,7 +102,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
     // TODO: [AL] add childDocs() and treeMap fields
     // @computed get childDocs() { return DocListCast(this.rootDoc.presentationaLinearizedDocuments); }
     //_treeViewMap:Map<number[], Doc>
-    @computed get childDocs() { return DocListCast(this.rootDoc.presentationLinearizedDocuments); }
+    @computed get childDocs() { return this.layoutDoc._viewType === CollectionViewType.Tree ? DocListCast(this.rootDoc.presentationLinearizedDocuments) : DocListCast(this.rootDoc[this.fieldKey]); }
     @observable _treeViewMap: Map<number, Doc> = new Map<number, Doc>();
 
     @computed get tagDocs() {
@@ -2533,7 +2533,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
 }
 // this func communicates with PresBoxElement to send information of the doc
 ScriptingGlobals.add(function lookupPresBoxField(presBoxDoc: Doc, field: string, presEleDoc: Doc) {
-    if (field === 'indexInPres') return DocListCast(presBoxDoc.presentationLinearizedDocuments).indexOf(presEleDoc);
+    if (field === 'indexInPres') return DocListCast(presBoxDoc._viewType === CollectionViewType.Tree ? presBoxDoc.presentationLinearizedDocuments : presBoxDoc[StrCast(presBoxDoc.presentationFieldKey)]).indexOf(presEleDoc);
     if (field === 'presCollapsedHeight') return [CollectionViewType.Tree || CollectionViewType.Stacking].includes(presBoxDoc._viewType as any) ? 35 : 31;
     if (field === 'presStatus') return presBoxDoc.presStatus;
     if (field === '_itemIndex') return presBoxDoc._itemIndex;
-- 
cgit v1.2.3-70-g09d2

