diff options
| author | bob <bcz@cs.brown.edu> | 2019-09-16 09:12:28 -0400 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2019-09-16 09:12:28 -0400 |
| commit | 30ebba4ee0f8c957609589985ba76f25b0378af6 (patch) | |
| tree | c071de81273a6ffadaf1700fd7a9c2738e230e1a /src/client/views/collections/CollectionBaseView.tsx | |
| parent | 045baaf436d310ea592a614b68ca9f8523e0d04a (diff) | |
| parent | 15c529925821ad0812b2dfee774de7318f8551af (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionBaseView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionBaseView.tsx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx index b7036b3ff..a54718e9e 100644 --- a/src/client/views/collections/CollectionBaseView.tsx +++ b/src/client/views/collections/CollectionBaseView.tsx @@ -141,17 +141,16 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> { return false; } + // this is called with the document that was dragged and the collection to move it into. + // if the target collection is the same as this collection, then the move will be allowed. + // otherwise, the document being moved must be able to be removed from its container before + // moving it into the target. @action.bound moveDocument(doc: Doc, targetCollection: Doc, addDocument: (doc: Doc) => boolean): boolean { - let self = this; - let targetDataDoc = this.props.Document; - if (Doc.AreProtosEqual(targetDataDoc, targetCollection)) { + if (Doc.AreProtosEqual(this.props.Document, targetCollection)) { return true; } - if (this.removeDocument(doc)) { - return addDocument(doc); - } - return false; + return this.removeDocument(doc) ? addDocument(doc) : false; } render() { |
