mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 03:11:07 +00:00
fix code format (#6365)
This commit is contained in:
@@ -63,7 +63,7 @@ class DirentGridItem extends React.Component {
|
||||
onItemClick = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.setState({isGridSelected: false});
|
||||
this.setState({ isGridSelected: false });
|
||||
|
||||
const { dirent, activeDirent } = this.props;
|
||||
|
||||
@@ -77,7 +77,7 @@ class DirentGridItem extends React.Component {
|
||||
this.clickTimeout = setTimeout(() => {
|
||||
this.clickTimeout = null;
|
||||
this.handleSingleClick(dirent, activeDirent);
|
||||
}, 250); //A click within 250 milliseconds is considered a single click.
|
||||
}, 250); // A click within 250 milliseconds is considered a single click.
|
||||
};
|
||||
|
||||
handleSingleClick = (dirent, activeDirent) => {
|
||||
@@ -121,7 +121,7 @@ class DirentGridItem extends React.Component {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
return false;
|
||||
}
|
||||
let dragStartItemData = {nodeDirent: this.props.dirent, nodeParentPath: this.props.path};
|
||||
let dragStartItemData = { nodeDirent: this.props.dirent, nodeParentPath: this.props.path };
|
||||
dragStartItemData = JSON.stringify(dragStartItemData);
|
||||
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
@@ -133,7 +133,7 @@ class DirentGridItem extends React.Component {
|
||||
return false;
|
||||
}
|
||||
if (this.props.dirent.type === 'dir') {
|
||||
this.setState({isGridDropTipShow: true});
|
||||
this.setState({ isGridDropTipShow: true });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -149,20 +149,20 @@ class DirentGridItem extends React.Component {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
return false;
|
||||
}
|
||||
this.setState({isGridDropTipShow: false});
|
||||
this.setState({ isGridDropTipShow: false });
|
||||
};
|
||||
|
||||
onGridItemDragDrop = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
return false;
|
||||
}
|
||||
this.setState({isGridDropTipShow: false});
|
||||
this.setState({ isGridDropTipShow: false });
|
||||
if (e.dataTransfer.files.length) { // uploaded files
|
||||
return;
|
||||
}
|
||||
let dragStartItemData = e.dataTransfer.getData('applicaiton/drag-item-info');
|
||||
dragStartItemData = JSON.parse(dragStartItemData);
|
||||
let {nodeDirent, nodeParentPath} = dragStartItemData;
|
||||
let { nodeDirent, nodeParentPath } = dragStartItemData;
|
||||
let dropItemData = this.props.dirent;
|
||||
|
||||
if (nodeDirent.name === dropItemData.name) {
|
||||
@@ -177,7 +177,7 @@ class DirentGridItem extends React.Component {
|
||||
this.onItemMove(this.props.currentRepoInfo, nodeDirent, selectedPath, nodeParentPath);
|
||||
};
|
||||
|
||||
onGridItemMouseDown = (event) =>{
|
||||
onGridItemMouseDown = (event) => {
|
||||
this.props.onGridItemMouseDown(event);
|
||||
};
|
||||
|
||||
@@ -299,7 +299,7 @@ class DirentGridItem extends React.Component {
|
||||
{dirent.file_tags.map((fileTag, index) => {
|
||||
let length = dirent.file_tags.length;
|
||||
return (
|
||||
<span className="file-tag" key={fileTag.id} style={{zIndex:length - index, backgroundColor:fileTag.color}}></span>
|
||||
<span className="file-tag" key={fileTag.id} style={{ zIndex: length - index, backgroundColor: fileTag.color }}></span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -313,13 +313,15 @@ class DirentGridItem extends React.Component {
|
||||
className="sf-link grid-file-name-link"
|
||||
onClick={this.onItemClick}
|
||||
title={dirent.name}
|
||||
>{showName}</a> :
|
||||
>{showName}
|
||||
</a> :
|
||||
<a
|
||||
className="grid-file-name-link"
|
||||
href={dirent.type === 'dir' ? dirHref : fileHref}
|
||||
onClick={this.onItemClick}
|
||||
title={dirent.name}
|
||||
>{showName}</a>
|
||||
>{showName}
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
|
@@ -90,39 +90,39 @@ class DirentGridView extends React.Component {
|
||||
|
||||
onGridItemClick = (dirent) => {
|
||||
hideMenu();
|
||||
this.setState({activeDirent: dirent});
|
||||
this.setState({ activeDirent: dirent });
|
||||
this.props.onGridItemClick(dirent);
|
||||
};
|
||||
|
||||
onMoveToggle = () => {
|
||||
this.setState({isMoveDialogShow: !this.state.isMoveDialogShow});
|
||||
this.setState({ isMoveDialogShow: !this.state.isMoveDialogShow });
|
||||
};
|
||||
|
||||
onCopyToggle = () => {
|
||||
this.setState({isCopyDialogShow: !this.state.isCopyDialogShow});
|
||||
this.setState({ isCopyDialogShow: !this.state.isCopyDialogShow });
|
||||
};
|
||||
|
||||
onAddFolder = (dirPath) => {
|
||||
this.setState({isCreateFolderDialogShow: false});
|
||||
this.setState({ isCreateFolderDialogShow: false });
|
||||
this.props.onAddFolder(dirPath);
|
||||
};
|
||||
|
||||
onItemShare = (e) => {
|
||||
e.nativeEvent.stopImmediatePropagation(); //for document event
|
||||
this.setState({isShareDialogShow: !this.state.isShareDialogShow});
|
||||
e.nativeEvent.stopImmediatePropagation(); // for document event
|
||||
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
|
||||
};
|
||||
|
||||
closeSharedDialog = () => {
|
||||
this.setState({isShareDialogShow: !this.state.isShareDialogShow});
|
||||
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
|
||||
};
|
||||
|
||||
onItemDelete = (currentObject, e) => {
|
||||
e.nativeEvent.stopImmediatePropagation(); //for document event
|
||||
e.nativeEvent.stopImmediatePropagation(); // for document event
|
||||
this.props.onItemDelete(currentObject);
|
||||
};
|
||||
|
||||
onItemConvert = (currentObject, e, dstType) => {
|
||||
e.nativeEvent.stopImmediatePropagation(); //for document event
|
||||
e.nativeEvent.stopImmediatePropagation(); // for document event
|
||||
this.props.onItemConvert(currentObject, dstType);
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ class DirentGridView extends React.Component {
|
||||
|
||||
onMenuItemClick = (operation, currentObject, event) => {
|
||||
hideMenu();
|
||||
switch(operation) {
|
||||
switch (operation) {
|
||||
case 'Download':
|
||||
this.onItemDownload(currentObject, event);
|
||||
break;
|
||||
@@ -256,7 +256,7 @@ class DirentGridView extends React.Component {
|
||||
isZipDialogOpen: true
|
||||
});
|
||||
} else {
|
||||
let url = URLDecorator.getUrl({type: 'download_file_url', repoID: repoID, filePath: direntPath});
|
||||
let url = URLDecorator.getUrl({ type: 'download_file_url', repoID: repoID, filePath: direntPath });
|
||||
location.href = url;
|
||||
}
|
||||
};
|
||||
@@ -274,15 +274,15 @@ class DirentGridView extends React.Component {
|
||||
};
|
||||
|
||||
onItemMoveToggle = () => {
|
||||
this.setState({isMoveDialogShow: !this.state.isMoveDialogShow});
|
||||
this.setState({ isMoveDialogShow: !this.state.isMoveDialogShow });
|
||||
};
|
||||
|
||||
onItemCopyToggle = () => {
|
||||
this.setState({isCopyDialogShow: !this.state.isCopyDialogShow});
|
||||
this.setState({ isCopyDialogShow: !this.state.isCopyDialogShow });
|
||||
};
|
||||
|
||||
onPermissionItem = () => {
|
||||
this.setState({isPermissionDialogOpen: !this.state.isPermissionDialogOpen});
|
||||
this.setState({ isPermissionDialogOpen: !this.state.isPermissionDialogOpen });
|
||||
};
|
||||
|
||||
onLockItem = (currentObject) => {
|
||||
@@ -330,7 +330,7 @@ class DirentGridView extends React.Component {
|
||||
onHistory = (currentObject) => {
|
||||
let repoID = this.props.repoID;
|
||||
let filePath = this.getDirentPath(currentObject);
|
||||
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath});
|
||||
let url = URLDecorator.getUrl({ type: 'file_revisions', repoID: repoID, filePath: filePath });
|
||||
location.href = url;
|
||||
};
|
||||
|
||||
@@ -343,7 +343,7 @@ class DirentGridView extends React.Component {
|
||||
onOpenViaClient = (currentObject) => {
|
||||
let repoID = this.props.repoID;
|
||||
let filePath = this.getDirentPath(currentObject);
|
||||
let url = URLDecorator.getUrl({type: 'open_via_client', repoID: repoID, filePath: filePath});
|
||||
let url = URLDecorator.getUrl({ type: 'open_via_client', repoID: repoID, filePath: filePath });
|
||||
location.href = url;
|
||||
};
|
||||
|
||||
@@ -382,7 +382,7 @@ class DirentGridView extends React.Component {
|
||||
};
|
||||
|
||||
closeImagePopup = () => {
|
||||
this.setState({isImagePopupOpen: false});
|
||||
this.setState({ isImagePopupOpen: false });
|
||||
};
|
||||
|
||||
moveToPrevImage = () => {
|
||||
@@ -481,7 +481,7 @@ class DirentGridView extends React.Component {
|
||||
|
||||
hideMenu();
|
||||
|
||||
this.setState({activeDirent: currentObject});
|
||||
this.setState({ activeDirent: currentObject });
|
||||
|
||||
let showMenuConfig = {
|
||||
id: id,
|
||||
@@ -505,7 +505,7 @@ class DirentGridView extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
let {direntList, path} = this.props;
|
||||
let { direntList, path } = this.props;
|
||||
let dirent = this.state.activeDirent ? this.state.activeDirent : '';
|
||||
let direntPath = Utils.joinPath(path, dirent.name);
|
||||
|
||||
|
Reference in New Issue
Block a user