mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +00:00
Menu bug repair (#2531)
This commit is contained in:
@@ -89,8 +89,8 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onItemMenuShow = (e) => {
|
onItemMenuShow = (e) => {
|
||||||
let left = e.clientX - 8*16;
|
let left = e.clientX;
|
||||||
let top = e.clientY + 15;
|
let top = e.clientY;
|
||||||
let position = Object.assign({},this.state.menuPosition, {left: left, top: top});
|
let position = Object.assign({},this.state.menuPosition, {left: left, top: top});
|
||||||
this.setState({
|
this.setState({
|
||||||
menuPosition: position,
|
menuPosition: position,
|
||||||
|
@@ -24,7 +24,8 @@ class DirentMenu extends React.Component {
|
|||||||
let repo = this.props.currentRepo;
|
let repo = this.props.currentRepo;
|
||||||
let menuList = this.calculateMenuList(repo);
|
let menuList = this.calculateMenuList(repo);
|
||||||
this.setState({
|
this.setState({
|
||||||
menuList: menuList
|
menuList: menuList,
|
||||||
|
menuHeight: menuList.length * 30,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -98,9 +99,16 @@ class DirentMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let position = this.props.menuPosition;
|
|
||||||
let style = {position: 'fixed', left: position.left, top: position.top, display: 'block'};
|
|
||||||
if (this.state.menuList.length) {
|
if (this.state.menuList.length) {
|
||||||
|
let position = this.props.menuPosition;
|
||||||
|
let left = position.left - (8 * 16); // 8rem width;
|
||||||
|
let top = position.top + (1 * 16);
|
||||||
|
let style = {position: 'fixed', left: left, top: top, display: 'block'};
|
||||||
|
let screenH = window.innerHeight;
|
||||||
|
if (screenH - position.top < this.state.menuHeight) {
|
||||||
|
top = position.top - this.state.menuHeight;
|
||||||
|
style = {position: 'fixed', left: left, top: top, display: 'block'};
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ul className="dropdown-menu operation-menu" style={style}>
|
<ul className="dropdown-menu operation-menu" style={style}>
|
||||||
{this.state.menuList.map((item, index) => {
|
{this.state.menuList.map((item, index) => {
|
||||||
|
Reference in New Issue
Block a user