mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
remove useless divider in more menu (#7559)
This commit is contained in:
@@ -47,9 +47,9 @@ class ItemDropdownMenu extends React.Component {
|
|||||||
if (this.props.isHandleContextMenuEvent) {
|
if (this.props.isHandleContextMenuEvent) {
|
||||||
this.listenerId = listener.register(this.onShowMenu, this.onHideMenu);
|
this.listenerId = listener.register(this.onShowMenu, this.onHideMenu);
|
||||||
}
|
}
|
||||||
let { item } = this.props;
|
this.setState({
|
||||||
let menuList = this.props.getMenuList(item);
|
menuList: this.removeUselessDivider(this.props.getMenuList(this.props.item))
|
||||||
this.setState({ menuList: menuList });
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.dropdownRef.current) {
|
if (this.dropdownRef.current) {
|
||||||
this.subMenuDirection = (window.innerWidth - this.dropdownRef.current.getBoundingClientRect().right < 400) ? 'left' : 'right';
|
this.subMenuDirection = (window.innerWidth - this.dropdownRef.current.getBoundingClientRect().right < 400) ? 'left' : 'right';
|
||||||
@@ -58,9 +58,8 @@ class ItemDropdownMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillReceiveProps(nextProps) { // for toolbar item operation
|
UNSAFE_componentWillReceiveProps(nextProps) { // for toolbar item operation
|
||||||
let { item } = nextProps;
|
const nextMenuList = this.removeUselessDivider(nextProps.getMenuList(nextProps.item));
|
||||||
const nextMenuList = nextProps.getMenuList(item);
|
if (nextProps.item.name !== this.props.item.name || this.state.menuList !== nextMenuList) {
|
||||||
if (item.name !== this.props.item.name || this.state.menuList !== nextMenuList) {
|
|
||||||
this.setState({ menuList: nextMenuList });
|
this.setState({ menuList: nextMenuList });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,6 +70,13 @@ class ItemDropdownMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeUselessDivider = (menuList) => {
|
||||||
|
while (menuList && menuList[0] === 'Divider') {
|
||||||
|
menuList.shift();
|
||||||
|
}
|
||||||
|
return menuList;
|
||||||
|
};
|
||||||
|
|
||||||
onShowMenu = () => {
|
onShowMenu = () => {
|
||||||
// nothing todo
|
// nothing todo
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user