1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 16:31:13 +00:00

use this.getDirentPath replace trinocular operator

This commit is contained in:
zxj96
2019-06-18 18:02:20 +08:00
parent 921ab320ef
commit e357bf972b

View File

@@ -360,8 +360,8 @@ class DirentListItem extends React.Component {
let selectedList = []; let selectedList = [];
if (selectedDirentList.length > 0 && selectedDirentList.includes(this.props.dirent)) { // drag items and selectedDirentList include item if (selectedDirentList.length > 0 && selectedDirentList.includes(this.props.dirent)) { // drag items and selectedDirentList include item
selectedList = selectedDirentList.map(item => { selectedList = selectedDirentList.map(item => {
let nodeRootPath = this.getDirentPath(item); let getDirentPath = this.getDirentPath(item);
let dragStartItemData = {nodeDirent: item, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath}; let dragStartItemData = {nodeDirent: item, nodeParentPath: this.props.path, nodeRootPath: getDirentPath};
return dragStartItemData; return dragStartItemData;
}); });
selectedList = JSON.stringify(selectedList); selectedList = JSON.stringify(selectedList);
@@ -369,9 +369,8 @@ class DirentListItem extends React.Component {
return ; return ;
} }
let nodeRootPath = ''; let getDirentPath = this.getDirentPath(this.props.dirent);
nodeRootPath = this.props.path === '/' ? `${this.props.path}${this.props.dirent.name}` : `${this.props.path}/${this.props.dirent.name}`; let dragStartItemData = {nodeDirent: this.props.dirent, nodeParentPath: this.props.path, nodeRootPath: getDirentPath};
let dragStartItemData = {nodeDirent: this.props.dirent, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath};
dragStartItemData = JSON.stringify(dragStartItemData); dragStartItemData = JSON.stringify(dragStartItemData);
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData); e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData);