From 88971a7730549e2b906688d21792a23fc2f39e8d Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Wed, 29 Nov 2023 22:49:41 -0500
Subject: schema to dataviz through popup

---
 .../collectionFreeForm/CollectionFreeFormView.tsx           | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

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

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 04e5ebb2c..e1ff4fda3 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -51,6 +51,7 @@ import { CollectionFreeFormRemoteCursors } from './CollectionFreeFormRemoteCurso
 import './CollectionFreeFormView.scss';
 import { MarqueeView } from './MarqueeView';
 import React = require('react');
+import { SchemaCSVPopUp } from '../../nodes/DataVizBox/SchemaCSVPopUp';
 
 export type collectionFreeformViewProps = {
     NativeWidth?: () => number;
@@ -1984,7 +1985,9 @@ ScriptingGlobals.add(function datavizFromSchema(doc: Doc) {
         for (let i=0; i < children.length; i++) {
             let eachRow = [];
             for (let j=0; j<keys.length; j++){
-                eachRow.push(children[i][keys[j]]);
+                var cell = children[i][keys[j]];
+                if (cell && cell as string)  cell = cell.toString().replace(/\,/g, '');
+                eachRow.push(cell);
             }
             csvRows.push(eachRow);
         }
@@ -1994,6 +1997,12 @@ ScriptingGlobals.add(function datavizFromSchema(doc: Doc) {
         const loading = Docs.Create.LoadingDocument(file, options);
         loading.presentation_openInLightbox = true;
         DocUtils.uploadFileToDoc(file, {}, loading);
-        if (view.ComponentView?.addDocument) view.ComponentView?.addDocument(loading);
+       // if (view.ComponentView?.addDocument) view.ComponentView?.addDocument(loading);
+
+        if (view.ComponentView?.addDocument) {
+            SchemaCSVPopUp.Instance.addToCollection = view.ComponentView?.addDocument;
+            SchemaCSVPopUp.Instance.setDataVizDoc(loading);
+            SchemaCSVPopUp.Instance.setVisible(true);
+        }
     })
 });
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

