From bb170fe119eb1831e96ebc1ae10553334398cf45 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Mon, 27 Apr 2020 00:14:14 -0700 Subject: set drap & dropped document to snap back to its original position --- src/client/views/nodes/ComparisonBox.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index 09590aff7..e8368e12d 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -20,10 +20,7 @@ import { ContentFittingDocumentView } from './ContentFittingDocumentView'; library.add(faImage, faEye as any, faPaintBrush, faBrain); library.add(faFileAudio, faAsterisk); -export const pageSchema = createSchema({ - beforeDoc: "string", - afterDoc: "string" -}); +export const pageSchema = createSchema({}); type ComparisonDocument = makeInterface<[typeof pageSchema, typeof documentSchema]>; const ComparisonDocument = makeInterface(pageSchema, documentSchema); @@ -39,14 +36,16 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent { if (ele) { - return DragManager.MakeDropTarget(ele, (event, dropEvent) => this.dropHandler(event, dropEvent, fieldKey)); + this.props.Document.targetDropAction = "alias"; + return DragManager.MakeDropTarget(ele, (event, dropEvent) => this.dropHandler(event, dropEvent, fieldKey), this.props.Document); } } private dropHandler = (event: Event, dropEvent: DragManager.DropEvent, fieldKey: string) => { + event.stopPropagation(); const droppedDocs = dropEvent.complete.docDragData?.droppedDocuments; if (droppedDocs?.length) { - this.props.Document[fieldKey] = Doc.MakeAlias(droppedDocs[0]); + this.props.Document[fieldKey] = droppedDocs[0]; } } -- cgit v1.2.3-70-g09d2