diff options
| author | bob <bcz@cs.brown.edu> | 2019-02-25 16:08:36 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2019-02-25 16:08:36 -0500 |
| commit | 39215d8999413a5e27d222c6650fc9e84c7a9ae9 (patch) | |
| tree | 61739afc1e830e54706079590ccfcb6bf70db356 /src/client/views/collections/CollectionViewBase.tsx | |
| parent | ad1aab1e757a2f0d8acc6038c19c54caa5b1ec48 (diff) | |
added drag/drop out of schema view
Diffstat (limited to 'src/client/views/collections/CollectionViewBase.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionViewBase.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx index e53485183..217536e2b 100644 --- a/src/client/views/collections/CollectionViewBase.tsx +++ b/src/client/views/collections/CollectionViewBase.tsx @@ -44,12 +44,16 @@ export class CollectionViewBase extends React.Component<SubCollectionViewProps> @undoBatch @action protected drop(e: Event, de: DragManager.DropEvent) { - const doc: DocumentView = de.data["document"]; - if (doc.props.ContainingCollectionView && doc.props.ContainingCollectionView !== this.props.CollectionView) { - if (doc.props.RemoveDocument) { - doc.props.RemoveDocument(doc.props.Document); + const docView: DocumentView = de.data["documentView"]; + const doc: Document = de.data["document"]; + if (docView && docView.props.ContainingCollectionView && docView.props.ContainingCollectionView !== this.props.CollectionView) { + if (docView.props.RemoveDocument) { + docView.props.RemoveDocument(docView.props.Document); } - this.props.addDocument(doc.props.Document); + this.props.addDocument(docView.props.Document); + } else if (doc) { + this.props.removeDocument(doc); + this.props.addDocument(doc); } e.stopPropagation(); } |
