1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

Merge branch '10.0'

This commit is contained in:
lian
2023-08-18 09:47:15 +08:00
10 changed files with 164 additions and 58 deletions

View File

@@ -59,21 +59,6 @@ class DirentListItem extends React.Component {
constructor(props) {
super(props);
this.state = {
isOperationShow: false,
highlight: false,
isZipDialogOpen: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
isShareDialogShow: false,
isMutipleOperation: false,
isShowTagTooltip: false,
isDragTipShow: false,
isDropTipshow: false,
isEditFileTagShow: false,
isPermissionDialogOpen: false,
isOpMenuOpen: false // for mobile
};
const { dirent } = this.props;
const { isCustomPermission, customPermission } = Utils.getUserPermission(dirent.permission);
@@ -86,6 +71,23 @@ class DirentListItem extends React.Component {
this.canPreview = preview || modify;
this.canDrag = modify;
}
this.state = {
isOperationShow: false,
highlight: false,
isZipDialogOpen: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
isShareDialogShow: false,
isMutipleOperation: false,
canDrag: this.canDrag,
isShowTagTooltip: false,
isDragTipShow: false,
isDropTipshow: false,
isEditFileTagShow: false,
isPermissionDialogOpen: false,
isOpMenuOpen: false // for mobile
};
}
componentWillReceiveProps(nextProps) {
@@ -115,7 +117,7 @@ class DirentListItem extends React.Component {
isOperationShow: true,
});
}
if (this.canDrag) {
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
}
}
@@ -127,7 +129,7 @@ class DirentListItem extends React.Component {
isOperationShow: true,
});
}
if (this.canDrag) {
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
}
}
@@ -314,6 +316,7 @@ class DirentListItem extends React.Component {
this.setState({
isOperationShow: false,
isRenameing: true,
canDrag: false
});
}
@@ -323,7 +326,10 @@ class DirentListItem extends React.Component {
}
onRenameCancel = () => {
this.setState({isRenameing: false});
this.setState({
isRenameing: false,
canDrag: this.canDrag // set it back to the initial value
});
this.unfreezeItem();
}
@@ -479,7 +485,7 @@ class DirentListItem extends React.Component {
}
onItemDragStart = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
e.dataTransfer.effectAllowed = 'move';
@@ -509,7 +515,7 @@ class DirentListItem extends React.Component {
}
onItemDragEnter = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
if (this.props.dirent.type === 'dir') {
@@ -519,7 +525,7 @@ class DirentListItem extends React.Component {
}
onItemDragOver = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
if (e.dataTransfer.dropEffect === 'copy') {
@@ -530,7 +536,7 @@ class DirentListItem extends React.Component {
}
onItemDragLeave = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
@@ -541,7 +547,7 @@ class DirentListItem extends React.Component {
}
onItemDragDrop = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
this.setState({isDropTipshow: false});
@@ -698,10 +704,11 @@ class DirentListItem extends React.Component {
let lockedInfo = gettext('locked by {name}').replace('{name}', dirent.lock_owner_name);
const isDesktop = Utils.isDesktop();
const { canDrag } = this.state;
const desktopItem = (
<tr
className={trClass}
draggable={this.canDrag}
draggable={canDrag}
onFocus={this.onMouseEnter}
onMouseEnter={this.onMouseEnter}
onMouseOver={this.onMouseOver}