diff options
| author | bob <bcz@cs.brown.edu> | 2020-02-20 15:59:53 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2020-02-20 15:59:53 -0500 |
| commit | 6e5abc3052f4df09b156deccdfe6a7b0b62f492b (patch) | |
| tree | cb90cac3ed45ee8154afd2e95d3e39bdf97e44cd /src/client/views/DocumentDecorations.tsx | |
| parent | 7a7105d8867e4b1c91e020f54dc8e9b3be563587 (diff) | |
cleaned up a whole bunch of linking stuff. link menu / link types / link default behaviors / added LinkBox
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
| -rw-r--r-- | src/client/views/DocumentDecorations.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 07cc1d984..61c199c1d 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -77,11 +77,14 @@ export class DocumentDecorations extends React.Component<{}, { value: string }> var [sptX, sptY] = transform.transformPoint(0, 0); let [bptX, bptY] = transform.transformPoint(documentView.props.PanelWidth(), documentView.props.PanelHeight()); if (documentView.props.Document.type === DocumentType.LINK) { - const rect = documentView.ContentDiv!.getElementsByClassName("docuLinkBox-cont")[0].getBoundingClientRect(); - sptX = rect.left; - sptY = rect.top; - bptX = rect.right; - bptY = rect.bottom; + const docuBox = documentView.ContentDiv!.getElementsByClassName("docuLinkBox-cont"); + if (docuBox.length) { + const rect = docuBox[0].getBoundingClientRect(); + sptX = rect.left; + sptY = rect.top; + bptX = rect.right; + bptY = rect.bottom; + } } return { x: Math.min(sptX, bounds.x), y: Math.min(sptY, bounds.y), |
