From 45c2bf0a22ae83a65d91f11934e1c21770b897c7 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 15 Sep 2020 12:06:15 -0400
Subject: simplifying menus for annotations.  added target toggle option to
 PDFmenu

---
 src/client/views/collections/CollectionView.tsx | 39 +++++++++++++------------
 1 file changed, 20 insertions(+), 19 deletions(-)

(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 97b8da8da..dd754e0fe 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -282,10 +282,11 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
         subItems.push({ description: "Grid", event: () => func(CollectionViewType.Grid), icon: "th-list" });
         subItems.push({ description: "lightbox", event: action(() => this._isLightboxOpen = true), icon: "eye" });
 
-        if (!Doc.IsSystem(this.props.Document)) {
+        if (!Doc.IsSystem(this.props.Document) && !this.props.Document.annotationOn) {
             const existingVm = ContextMenu.Instance.findByDescription(category);
             const catItems = existingVm && "subitems" in existingVm ? existingVm.subitems : [];
             catItems.push({ description: "Add a Perspective...", addDivider: true, noexpand: true, subitems: subItems, icon: "eye" });
+            catItems.push({ description: "Export collection", icon: "download", event: async () => Doc.Zip(this.props.Document) });
             !existingVm && ContextMenu.Instance.addItem({ description: category, subitems: catItems, icon: "eye" });
         }
     }
@@ -313,25 +314,25 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
 
             !options && cm.addItem({ description: "Options...", subitems: optionItems, icon: "hand-point-right" });
 
-            const existingOnClick = cm.findByDescription("OnClick...");
-            const onClicks = existingOnClick && "subitems" in existingOnClick ? existingOnClick.subitems : [];
-            const funcs = [
-                { key: "onChildClick", name: "On Child Clicked" },
-                { key: "onChildDoubleClick", name: "On Child Double Clicked" }];
-            funcs.map(func => onClicks.push({
-                description: `Edit ${func.name} script`, icon: "edit", event: (obj: any) => {
-                    const alias = Doc.MakeAlias(this.props.Document);
-                    DocUtils.makeCustomViewClicked(alias, undefined, func.key);
-                    this.props.addDocTab(alias, "add:right");
-                }
-            }));
-            DocListCast(Cast(Doc.UserDoc()["clickFuncs-child"], Doc, null).data).forEach(childClick =>
-                onClicks.push({
-                    description: `Set child ${childClick.title}`,
-                    icon: "edit",
-                    event: () => Doc.GetProto(this.props.Document)[StrCast(childClick.targetScriptKey)] = ObjectField.MakeCopy(ScriptCast(childClick.data)),
+            if (!Doc.UserDoc().noviceMode && !this.props.Document.annotationOn) {
+                const existingOnClick = cm.findByDescription("OnClick...");
+                const onClicks = existingOnClick && "subitems" in existingOnClick ? existingOnClick.subitems : [];
+                const funcs = [{ key: "onChildClick", name: "On Child Clicked" }, { key: "onChildDoubleClick", name: "On Child Double Clicked" }];
+                funcs.map(func => onClicks.push({
+                    description: `Edit ${func.name} script`, icon: "edit", event: (obj: any) => {
+                        const alias = Doc.MakeAlias(this.props.Document);
+                        DocUtils.makeCustomViewClicked(alias, undefined, func.key);
+                        this.props.addDocTab(alias, "add:right");
+                    }
                 }));
-            !Doc.IsSystem(this.props.Document) && !existingOnClick && cm.addItem({ description: "OnClick...", noexpand: true, subitems: onClicks, icon: "mouse-pointer" });
+                DocListCast(Cast(Doc.UserDoc()["clickFuncs-child"], Doc, null).data).forEach(childClick =>
+                    onClicks.push({
+                        description: `Set child ${childClick.title}`,
+                        icon: "edit",
+                        event: () => Doc.GetProto(this.props.Document)[StrCast(childClick.targetScriptKey)] = ObjectField.MakeCopy(ScriptCast(childClick.data)),
+                    }));
+                !Doc.IsSystem(this.props.Document) && !existingOnClick && cm.addItem({ description: "OnClick...", noexpand: true, subitems: onClicks, icon: "mouse-pointer" });
+            }
 
             if (!Doc.UserDoc().noviceMode) {
                 const more = cm.findByDescription("More...");
-- 
cgit v1.2.3-70-g09d2

