From 4ae6b564896dd216c37fa38ffeee70ba0e671221 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Sat, 28 Mar 2020 02:40:17 -0400
Subject: simplified linkDocs to not keep a context -- instead, link are made
 between aliases which have a context.  fixed clippings of PDFs to scroll
 correctly and resize in slideViews.  fixed slideViews to render 'text' and
 'data' instead of 'contents' and 'data'

---
 src/client/views/collections/CollectionView.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/client/views/collections/CollectionView.tsx')

diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 2386f2d5d..1542988e7 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -127,6 +127,7 @@ export class CollectionView extends Touchable<FieldViewProps> {
         const docList = DocListCast(targetDataDoc[this.props.fieldKey]);
         !docList.includes(doc) && (targetDataDoc[this.props.fieldKey] = new List<Doc>([...docList, doc]));  // DocAddToList may write to targetdataDoc's parent ... we don't want this. should really change GetProto to GetDataDoc and test for resolvedDataDoc there
         // Doc.AddDocToList(targetDataDoc, this.props.fieldKey, doc);
+        doc.context = this.props.Document;
         targetDataDoc[this.props.fieldKey + "-lastModified"] = new DateField(new Date(Date.now()));
         Doc.GetProto(doc).lastOpened = new DateField;
         return true;
@@ -141,7 +142,8 @@ export class CollectionView extends Touchable<FieldViewProps> {
         let index = value.reduce((p, v, i) => (v instanceof Doc && v === doc) ? i : p, -1);
         index = index !== -1 ? index : value.reduce((p, v, i) => (v instanceof Doc && Doc.AreProtosEqual(v, doc)) ? i : p, -1);
 
-        ContextMenu.Instance && ContextMenu.Instance.clearItems();
+        doc.context = undefined;
+        ContextMenu.Instance?.clearItems();
         if (index !== -1) {
             value.splice(index, 1);
             targetDataDoc[this.props.fieldKey] = new List<Doc>(value);
-- 
cgit v1.2.3-70-g09d2

