From 995ed33feef1eb663d65b1b1d3da8c91926013dc Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 29 Sep 2022 21:26:36 -0400
Subject: added content pinning for collections.

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

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

diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index fe2668492..f4ab845f3 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -327,11 +327,11 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
                 const scroll = targetDoc._scrollTop;
                 activeItem.presPinViewScroll = scroll;
                 if (targetDoc.type === DocumentType.RTF) {
-                    activeItem.presData = targetDoc.text instanceof RichTextField ? targetDoc.text[Copy]() : targetDoc.text;
+                    activeItem.presData = targetDoc[Doc.LayoutFieldKey(targetDoc)] instanceof RichTextField ? (targetDoc[Doc.LayoutFieldKey(targetDoc)] as RichTextField)[Copy]() : targetDoc.text;
                 }
                 break;
             case DocumentType.INK:
-                activeItem.presData = targetDoc.data instanceof InkField ? targetDoc.data[Copy]() : targetDoc.data;
+                activeItem.presData = targetDoc[Doc.LayoutFieldKey(targetDoc)] instanceof InkField ? (targetDoc[Doc.LayoutFieldKey(targetDoc)] as InkField)[Copy]() : targetDoc.data;
                 break;
             case DocumentType.VID:
             case DocumentType.AUDIO:
@@ -342,6 +342,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
                 activeItem.presPinClipWidth = clipWidth;
                 break;
             case DocumentType.COL:
+                activeItem.presPinLayoutData = new List<string>(DocListCast(targetDoc[Doc.LayoutFieldKey(targetDoc)]).map(d => JSON.stringify({ id: d[Id], x: NumCast(d.x), y: NumCast(d.y), w: NumCast(d._width), h: NumCast(d._height) })));
             default:
                 const bestView = DocumentManager.Instance.getFirstDocumentView(targetDoc);
                 if (activeItem.presPinViewBounds && bestView) {
-- 
cgit v1.2.3-70-g09d2

