From 3101134e8e579a6f9202d552c46d2a8bd70fda79 Mon Sep 17 00:00:00 2001
From: Monika Hedman <monika_hedman@brown.edu>
Date: Sat, 16 Mar 2019 18:48:21 -0400
Subject: cant get image stuff????

---
 .../views/collections/CollectionFreeFormView.tsx   | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

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

diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index a94539312..79ea77c77 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -31,6 +31,7 @@ import { MarqueeView } from "./MarqueeView";
 import { PreviewCursor } from "./PreviewCursor";
 import React = require("react");
 const JsxParser = require('react-jsx-parser').default;//TODO Why does this need to be imported like this?
+import { ImageField } from '../../../fields/ImageField';
 
 @observer
 export class CollectionFreeFormView extends CollectionViewBase {
@@ -208,7 +209,27 @@ export class CollectionFreeFormView extends CollectionViewBase {
     @action
     onDrop = (e: React.DragEvent): void => {
         var pt = this.getTransform().transformPoint(e.pageX, e.pageY);
-        super.onDrop(e, { x: pt[0], y: pt[1] });
+
+        let text = e.dataTransfer.getData("text/plain");
+        let start = text.startsWith("<div")
+        if (start) {
+            console.log(e.target);
+            console.log(this.props.Document.GetData(KeyStore.Layout, TextField, new String))
+            var children = this.props.Document.GetList<Document>(KeyStore.Data, []);
+            console.log(children);
+            if (children) {
+                children.forEach(f => {
+                    console.log(f.GetData(KeyStore.Layout, TextField, new String));
+                });
+            }
+            // let xx = this.props.Document.GetT(KeyStore.Thumbnail, ImageField)
+            // if (xx) {
+            //     console.log(xx.toString())
+            // }
+            this.props.Document.SetData(KeyStore.Layout, text, TextField);
+            e.stopPropagation();
+        }
+        else { super.onDrop(e, { x: pt[0], y: pt[1] }); }
     }
 
     onDragOver = (): void => {
-- 
cgit v1.2.3-70-g09d2

