From ed89b0fbf26c5bf4263198938dae07e6f32ab436 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Sat, 12 Oct 2019 13:43:13 -0400
Subject: a few more tweaks and now the bottom buttons are customizable

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

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

diff --git a/src/client/views/nodes/DragBox.tsx b/src/client/views/nodes/DragBox.tsx
index ab3368b94..4fca96382 100644
--- a/src/client/views/nodes/DragBox.tsx
+++ b/src/client/views/nodes/DragBox.tsx
@@ -44,7 +44,7 @@ export class DragBox extends DocComponent<FieldViewProps, DragDocument>(DragDocu
         }
     }
 
-    onDragMove = (e: MouseEvent) => {
+    onDragMove = async (e: MouseEvent) => {
         if (!e.cancelBubble && (Math.abs(this._downX - e.clientX) > 5 || Math.abs(this._downY - e.clientY) > 5)) {
             document.removeEventListener("pointermove", this.onDragMove);
             document.removeEventListener("pointerup", this.onDragUp);
@@ -52,7 +52,7 @@ export class DragBox extends DocComponent<FieldViewProps, DragDocument>(DragDocu
             e.stopPropagation();
             e.preventDefault();
             DragManager.StartDocumentDrag([this._mainCont.current!], new DragManager.DocumentDragData([this.props.Document]), e.clientX, e.clientY, {
-                finishDrag: (dropData) => {
+                finishDrag: async (dropData) => {
                     let res = onDragStart && onDragStart.script.run({ this: this.props.Document }).result;
                     let doc = (res as Doc) || Docs.Create.FreeformDocument([], { nativeWidth: undefined, nativeHeight: undefined, width: 150, height: 100, title: "freeform" });
                     dropData.droppedDocuments = [doc];
@@ -60,6 +60,7 @@ export class DragBox extends DocComponent<FieldViewProps, DragDocument>(DragDocu
                 handlers: { dragComplete: emptyFunction },
                 hideSource: false
             });
+            await this.props.Document.factory; // if there's a factory Doc that is being copied, make sure it's not pending.
         }
         e.stopPropagation();
         e.preventDefault();
-- 
cgit v1.2.3-70-g09d2

