diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-04-05 01:41:22 -0400 | 
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-04-05 01:41:22 -0400 | 
| commit | 0fb53a4b5fb430e67ef4af2323c886e77985ca52 (patch) | |
| tree | ca2826992a817d9944ab0163717c7644b1216d69 /src/client/views/nodes/LinkBox.tsx | |
| parent | 8faacc6b8da0082823ec92cb1c862b6373596264 (diff) | |
| parent | 4fde212cd00bd2f8fc2fa122309af3bb71bba2fd (diff) | |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/nodes/LinkBox.tsx')
| -rw-r--r-- | src/client/views/nodes/LinkBox.tsx | 23 | 
1 files changed, 21 insertions, 2 deletions
diff --git a/src/client/views/nodes/LinkBox.tsx b/src/client/views/nodes/LinkBox.tsx index dd2f71b59..e81f8fec7 100644 --- a/src/client/views/nodes/LinkBox.tsx +++ b/src/client/views/nodes/LinkBox.tsx @@ -17,6 +17,8 @@ import { faEye } from '@fortawesome/free-solid-svg-icons';  import { faEdit } from '@fortawesome/free-solid-svg-icons';  import { faTimes } from '@fortawesome/free-solid-svg-icons';  import { undoBatch } from "../../util/UndoManager"; +import { FieldWaiting } from "../../../fields/Field"; +import { NumberField } from "../../../fields/NumberField";  library.add(faEye); @@ -39,9 +41,26 @@ export class LinkBox extends React.Component<Props> {          e.stopPropagation();          let docView = DocumentManager.Instance.getDocumentView(this.props.pairedDoc);          if (docView) { -            docView.props.focus(this.props.pairedDoc); +            docView.props.focus(docView.props.Document);          } else { -            CollectionDockingView.Instance.AddRightSplit(this.props.pairedDoc) +            this.props.pairedDoc.GetAsync(KeyStore.AnnotationOn, (contextDoc: any) => { +                if (!contextDoc) { +                    CollectionDockingView.Instance.AddRightSplit(this.props.pairedDoc.MakeDelegate()); +                } else if (contextDoc instanceof Document) { +                    this.props.pairedDoc.GetTAsync(KeyStore.Page, NumberField).then((pfield: any) => { +                        contextDoc.GetTAsync(KeyStore.CurPage, NumberField).then((cfield: any) => { +                            if (pfield != cfield) +                                contextDoc.SetNumber(KeyStore.CurPage, pfield.Data); +                            let contextView = DocumentManager.Instance.getDocumentView(contextDoc); +                            if (contextView) { +                                contextView.props.focus(contextDoc); +                            } else { +                                CollectionDockingView.Instance.AddRightSplit(contextDoc); +                            } +                        }) +                    }); +                } +            });          }      }  | 
