diff options
| author | Hannah Chow <hannah_chow@brown.edu> | 2019-02-28 01:09:26 -0500 |
|---|---|---|
| committer | Hannah Chow <hannah_chow@brown.edu> | 2019-02-28 01:09:26 -0500 |
| commit | e6265a20f4c5d2619aa06cef6ee9442c0fd6bb41 (patch) | |
| tree | bb6576b0c38658f373847a33d263021bccdf0774 /src/client/views/nodes/DocumentView.tsx | |
| parent | c6ce284c0938587df5a0fa759587b33f8beaa68f (diff) | |
first pass at linking drag and drop
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
| -rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index d5b4a723d..51d073f7a 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -165,6 +165,19 @@ export class DocumentView extends React.Component<DocumentViewProps> { } @action + drop = (e: Event, de: DragManager.DropEvent) => { + console.log("drop"); + const sourceDocView: DocumentView = de.data["linkSourceDoc"]; + let sourceDoc: Document = sourceDocView.props.Document; + let destDoc: Document = this.props.Document; + + sourceDoc.GetAsync(KeyStore.LinkedToDocs, field => { (field as ListField<Document>).Data.push(destDoc) }); + destDoc.GetAsync(KeyStore.LinkedFromDocs, field => { (field as ListField<Document>).Data.push(sourceDoc) }); + + e.stopPropagation(); + } + + @action onContextMenu = (e: React.MouseEvent): void => { e.stopPropagation(); let moved = Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3; |
