1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-27 07:44:50 +00:00

fix grid view drag and drop on windows

This commit is contained in:
zhouwenxuan
2025-04-29 17:06:04 +08:00
parent 026671347d
commit deee10fba8
3 changed files with 13 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ class DirentGridItem extends React.Component {
this.canPreview = preview || modify; this.canPreview = preview || modify;
this.canDrag = modify; this.canDrag = modify;
} }
this.ref = React.createRef();
this.clickTimeout = null; this.clickTimeout = null;
this.isGeneratingThumbnail = false; this.isGeneratingThumbnail = false;
this.thumbnailCenter = null; this.thumbnailCenter = null;
@@ -206,6 +206,11 @@ class DirentGridItem extends React.Component {
if (Utils.isIEBrowser() || !this.canDrag) { if (Utils.isIEBrowser() || !this.canDrag) {
return false; return false;
} }
if (this.ref.current && this.ref.current.contains(e.relatedTarget)) {
return;
}
this.setState({ isGridDropTipShow: false }); this.setState({ isGridDropTipShow: false });
}; };
@@ -323,6 +328,7 @@ class DirentGridItem extends React.Component {
onClick={this.onItemClick} onClick={this.onItemClick}
> >
<div <div
ref={this.ref}
className={classnames('grid-file-img-link', { 'grid-drop-show': isGridDropTipShow })} className={classnames('grid-file-img-link', { 'grid-drop-show': isGridDropTipShow })}
draggable={this.canDrag} draggable={this.canDrag}
onDragStart={this.onGridItemDragStart} onDragStart={this.onGridItemDragStart}
@@ -337,8 +343,9 @@ class DirentGridItem extends React.Component {
className="thumbnail" className="thumbnail"
onClick={this.onItemClick} onClick={this.onItemClick}
alt="" alt=""
draggable={false}
/> : /> :
<img src={Utils.getDirentIcon(dirent, true)} width="80" height="80" alt='' /> <img src={Utils.getDirentIcon(dirent, true)} width="80" height="80" alt='' draggable={false} />
} }
{is_locked && {is_locked &&
<img <img
@@ -346,6 +353,7 @@ class DirentGridItem extends React.Component {
src={`${mediaUrl}img/file-${is_freezed ? 'freezed-32.svg' : 'locked-32.png'}`} src={`${mediaUrl}img/file-${is_freezed ? 'freezed-32.svg' : 'locked-32.png'}`}
alt={is_freezed ? gettext('freezed') : gettext('locked')} alt={is_freezed ? gettext('freezed') : gettext('locked')}
title={(is_freezed ? gettext('Frozen by {name}') : gettext('locked by {name}')).replace('{name}', lock_owner_name)} title={(is_freezed ? gettext('Frozen by {name}') : gettext('locked by {name}')).replace('{name}', lock_owner_name)}
draggable={false}
/> />
} }
</div> </div>

View File

@@ -856,10 +856,11 @@ class DirentListItem extends React.Component {
className="thumbnail cursor-pointer" className="thumbnail cursor-pointer"
onClick={this.onItemClick} onClick={this.onItemClick}
alt="" alt=""
draggable={false}
/> : /> :
<img ref={ref => this.dragIconRef = ref} src={iconUrl} width="24" alt='' /> <img ref={ref => this.dragIconRef = ref} src={iconUrl} width="24" alt='' draggable={false} />
} }
{dirent.is_locked && <img className="locked" src={lockedImageUrl} alt={lockedMessage} title={lockedInfo}/>} {dirent.is_locked && <img className="locked" src={lockedImageUrl} alt={lockedMessage} title={lockedInfo} draggable={false} />}
<div ref={ref => this.emptyContentRef = ref} className="empty-content"></div> <div ref={ref => this.emptyContentRef = ref} className="empty-content"></div>
</div> </div>
</td> </td>

View File

@@ -88,10 +88,6 @@
background: #f8f8f8; background: #f8f8f8;
} }
.grid-drop-show * {
pointer-events: none;
}
.selection-box { .selection-box {
position: absolute; position: absolute;
background-color: rgba(0, 120, 215, 0.3); background-color: rgba(0, 120, 215, 0.3);