diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-07-07 15:08:21 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-07-07 15:08:21 -0500 |
commit | c3a147995564a10ae7650330aa11bbbb4fabdfda (patch) | |
tree | 22c96d3701d5599b734e07c3aebc12c113a49496 /src/client/views/linking/LinkMenu.tsx | |
parent | 915f35e6d6c0b0f7bdb18c0c2a6aa88ee5df5eed (diff) |
UI change to menu
Diffstat (limited to 'src/client/views/linking/LinkMenu.tsx')
-rw-r--r-- | src/client/views/linking/LinkMenu.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
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<Props> { @observable private _linkMenuRef = React.createRef<HTMLDivElement>(); private _editorRef = React.createRef<HTMLDivElement>(); + @observable private _numLinks: number = 0; + @action onClick = (e: PointerEvent) => { @@ -69,6 +71,9 @@ export class LinkMenu extends React.Component<Props> { 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<Props> { return linkItems; } + @action render() { const sourceDoc = this.props.docView.props.Document; const groups: Map<string, Doc[]> = LinkManager.Instance.getRelatedGroupedLinks(sourceDoc); return <div className="linkMenu" ref={this._linkMenuRef} > <div className="linkMenu-list" - style={{ left: this.props.location[0], top: this.props.location[1] }}> + style={{ + left: this.props.location[0], top: this.props.location[1], + overflowY: this._numLinks > 4 ? "scroll" : "auto" + }}> {!this._editingLink ? this.renderAllGroups(groups) : <LinkEditor sourceDoc={this.props.docView.props.Document} linkDoc={this._editingLink} |