aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-07-26 18:08:26 -0400
committerFawn <fangrui_tong@brown.edu>2019-07-26 18:08:26 -0400
commit4c8d0e0cf2422bffe26fcddd91eca9e8f3145e1a (patch)
tree54d976ae37247ea5a459a574d45b12a3a011436c /src
parentd7444d7de920a0081a54042db32702273c91865e (diff)
collection cannot be moved to inside itself in schema
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionSchemaMovableTableHOC.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx b/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx
index f45575143..0ddd56180 100644
--- a/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx
+++ b/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx
@@ -11,6 +11,7 @@ import { action } from "mobx";
import { library } from '@fortawesome/fontawesome-svg-core';
import { faGripVertical, faTrash } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { DocumentManager } from "../../util/DocumentManager";
library.add(faGripVertical, faTrash);
@@ -183,6 +184,14 @@ export class MovableRow extends React.Component<MovableRowProps> {
@action
move: DragManager.MoveFunction = (doc: Doc, target: Doc, addDoc) => {
+ let targetView = DocumentManager.Instance.getDocumentView(target);
+ if (targetView) {
+ let targetContainingColl = targetView.props.ContainingCollectionView; //.props.ContainingCollectionView.props.Document;
+ if (targetContainingColl) {
+ let targetContCollDoc = targetContainingColl.props.Document;
+ return doc !== target && doc !== targetContCollDoc && this.props.removeDoc(doc) && addDoc(doc);
+ }
+ }
return doc !== target && this.props.removeDoc(doc) && addDoc(doc);
}