aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenuItem.tsx
diff options
context:
space:
mode:
authormonikahedman <monika_hedman@brown.edu>2019-08-21 13:55:46 -0400
committermonikahedman <monika_hedman@brown.edu>2019-08-21 13:55:46 -0400
commit11d2743b553da47da88e77de1ac758e16e09b3e0 (patch)
tree5ebc24d35aa304d959f8e69571de76a4dc8c5264 /src/client/views/linking/LinkMenuItem.tsx
parent0759b23448de29158367f344342e939dfa6eaf48 (diff)
adding docs works
Diffstat (limited to 'src/client/views/linking/LinkMenuItem.tsx')
-rw-r--r--src/client/views/linking/LinkMenuItem.tsx26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx
index 7dc0a9fcd..65516b374 100644
--- a/src/client/views/linking/LinkMenuItem.tsx
+++ b/src/client/views/linking/LinkMenuItem.tsx
@@ -1,12 +1,12 @@
import { library } from '@fortawesome/fontawesome-svg-core';
-import { faEdit, faEye, faTimes, faArrowRight, faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
+import { faEdit, faEye, faTimes, faArrowRight, faChevronDown, faChevronUp, faGlobeAsia } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { observer } from "mobx-react";
import { DocumentManager } from "../../util/DocumentManager";
import { undoBatch } from "../../util/UndoManager";
import './LinkMenu.scss';
import React = require("react");
-import { Doc, DocListCastAsync } from '../../../new_fields/Doc';
+import { Doc, DocListCastAsync, WidthSym } from '../../../new_fields/Doc';
import { StrCast, Cast, FieldValue, NumCast } from '../../../new_fields/Types';
import { observable, action } from 'mobx';
import { LinkManager } from '../../util/LinkManager';
@@ -138,27 +138,29 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> {
SelectionManager.DeselectAll();
}
+ // DONE
// this will open a link next to the source doc
@undoBatch
openLinkInPlace = () => {
this.highlightDoc();
let alias = Doc.MakeAlias(this.props.destinationDoc);
- let y = this.props.sourceDoc.y;
- let x = this.props.sourceDoc.x;
- let parentView: any = undefined;
- let parentDoc: Doc = this.props.sourceDoc;
+ let y = NumCast(this.props.sourceDoc.y);
+ let x = NumCast(this.props.sourceDoc.x);
+
+ let width = NumCast(this.props.sourceDoc.width);
+ let height = NumCast(this.props.sourceDoc.height);
+
+ alias.x = x + width + 30;
+ alias.y = y;
+ alias.width = width;
+ alias.height = height;
SelectionManager.SelectedDocuments().map(dv => {
if (dv.props.Document === this.props.sourceDoc) {
- parentView = dv.props.ContainingCollectionView;
+ dv.props.addDocument && dv.props.addDocument(alias, false);
}
});
-
- if (parentView) {
- // console.log(parentDoc)
- console.log(parentView.props.addDocument);
- }
}
//set this to be the default link behavior, can be any of the above