From c3a147995564a10ae7650330aa11bbbb4fabdfda Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 7 Jul 2020 15:08:21 -0500 Subject: UI change to menu --- src/client/views/linking/LinkMenu.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/client/views/linking/LinkMenu.tsx') diff --git a/src/client/views/linking/LinkMenu.tsx b/src/client/views/linking/LinkMenu.tsx index 8a7b12f48..064c24f7a 100644 --- a/src/client/views/linking/LinkMenu.tsx +++ b/src/client/views/linking/LinkMenu.tsx @@ -29,6 +29,8 @@ export class LinkMenu extends React.Component { @observable private _linkMenuRef = React.createRef(); private _editorRef = React.createRef(); + @observable private _numLinks: number = 0; + @action onClick = (e: PointerEvent) => { @@ -69,6 +71,9 @@ export class LinkMenu extends React.Component { showEditor={action((linkDoc: Doc) => this._editingLink = linkDoc)} addDocTab={this.props.addDocTab} /> ); + group.forEach((item) => { + this._numLinks++; + }); }); // if source doc has no links push message @@ -77,12 +82,16 @@ export class LinkMenu extends React.Component { return linkItems; } + @action render() { const sourceDoc = this.props.docView.props.Document; const groups: Map = LinkManager.Instance.getRelatedGroupedLinks(sourceDoc); return
+ style={{ + left: this.props.location[0], top: this.props.location[1], + overflowY: this._numLinks > 4 ? "scroll" : "auto" + }}> {!this._editingLink ? this.renderAllGroups(groups) :