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

fix code format (#6365)

This commit is contained in:
Michael An
2024-07-18 11:58:42 +08:00
committed by GitHub
parent c5d02b33b2
commit 67210c7363
450 changed files with 2425 additions and 2385 deletions

View File

@@ -103,7 +103,7 @@ class DirentListItem extends React.Component {
isOperationShow: false,
}, () => {
if (nextProps.activeDirent && nextProps.activeDirent.name === nextProps.dirent.name) {
this.setState({isOperationShow: true});
this.setState({ isOperationShow: true });
}
});
}
@@ -115,7 +115,7 @@ class DirentListItem extends React.Component {
});
};
//UI Interactive
// UI Interactive
onMouseEnter = () => {
if (!this.props.isItemFreezed) {
this.setState({
@@ -124,7 +124,7 @@ class DirentListItem extends React.Component {
});
}
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
this.setState({ isDragTipShow: true });
}
};
@@ -136,7 +136,7 @@ class DirentListItem extends React.Component {
});
}
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
this.setState({ isDragTipShow: true });
}
};
@@ -147,7 +147,7 @@ class DirentListItem extends React.Component {
isOperationShow: false,
});
}
this.setState({isDragTipShow: false});
this.setState({ isDragTipShow: false });
};
unfreezeItem = () => {
@@ -158,7 +158,7 @@ class DirentListItem extends React.Component {
this.props.unfreezeItem();
};
//buiness handler
// buiness handler
onItemSelected = () => {
this.props.onItemSelected(this.props.dirent);
};
@@ -221,14 +221,14 @@ class DirentListItem extends React.Component {
onItemDelete = (e) => {
e.preventDefault();
e.nativeEvent.stopImmediatePropagation(); //for document event
e.nativeEvent.stopImmediatePropagation(); // for document event
this.props.onItemDelete(this.props.dirent);
};
onItemShare = (e) => {
e.preventDefault();
e.nativeEvent.stopImmediatePropagation(); //for document event
this.setState({isShareDialogShow: !this.state.isShareDialogShow});
e.nativeEvent.stopImmediatePropagation(); // for document event
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
};
exportDocx = () => {
@@ -240,7 +240,7 @@ class DirentListItem extends React.Component {
};
closeSharedDialog = () => {
this.setState({isShareDialogShow: !this.state.isShareDialogShow});
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
};
onMobileMenuItemClick = (e) => {
@@ -249,7 +249,7 @@ class DirentListItem extends React.Component {
};
onMenuItemClick = (operation, event) => {
switch(operation) {
switch (operation) {
case 'Download':
this.onItemDownload(event);
break;
@@ -319,9 +319,9 @@ class DirentListItem extends React.Component {
}
};
onItemConvert = (e, dstType)=> {
onItemConvert = (e, dstType) => {
e.preventDefault();
e.nativeEvent.stopImmediatePropagation(); //for document event
e.nativeEvent.stopImmediatePropagation(); // for document event
this.props.onItemConvert(this.props.dirent, dstType);
};
@@ -359,15 +359,15 @@ class DirentListItem 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 = () => {
@@ -415,7 +415,7 @@ class DirentListItem extends React.Component {
onHistory = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
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;
};
@@ -428,11 +428,11 @@ class DirentListItem extends React.Component {
onOpenViaClient = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
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;
};
onConvertWithONLYOFFICE = ()=> {
onConvertWithONLYOFFICE = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
seafileAPI.onlyofficeConvert(repoID, filePath).then(res => {
@@ -467,7 +467,7 @@ class DirentListItem extends React.Component {
});
}
} 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;
}
};
@@ -485,7 +485,7 @@ class DirentListItem extends React.Component {
onTagTooltipToggle = (e) => {
e.stopPropagation();
this.setState({isShowTagTooltip: !this.state.isShowTagTooltip});
this.setState({ isShowTagTooltip: !this.state.isShowTagTooltip });
};
onItemMove = (destRepo, dirent, selectedPath, currentPath) => {
@@ -501,9 +501,9 @@ class DirentListItem extends React.Component {
if (selectedDirentList.length > 0 && selectedDirentList.includes(this.props.dirent)) { // drag items and selectedDirentList include item
this.props.onShowDirentsDraggablePreview();
e.dataTransfer.setDragImage(this.refs.empty_content, 0, 0); // Show an empty content
let selectedList = selectedDirentList.map(item => {
let selectedList = selectedDirentList.map(item => {
let nodeRootPath = this.getDirentPath(item);
let dragStartItemData = {nodeDirent: item, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath};
let dragStartItemData = { nodeDirent: item, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath };
return dragStartItemData;
});
selectedList = JSON.stringify(selectedList);
@@ -516,7 +516,7 @@ class DirentListItem extends React.Component {
}
let nodeRootPath = this.getDirentPath(this.props.dirent);
let dragStartItemData = {nodeDirent: this.props.dirent, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath};
let dragStartItemData = { nodeDirent: this.props.dirent, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath };
dragStartItemData = JSON.stringify(dragStartItemData);
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData);
@@ -528,7 +528,7 @@ class DirentListItem extends React.Component {
}
if (this.props.dirent.type === 'dir') {
e.stopPropagation();
this.setState({isDropTipshow: true});
this.setState({ isDropTipshow: true });
}
};
@@ -551,14 +551,14 @@ class DirentListItem extends React.Component {
if (this.props.dirent.type === 'dir') {
e.stopPropagation();
}
this.setState({isDropTipshow: false});
this.setState({ isDropTipshow: false });
};
onItemDragDrop = (e) => {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
this.setState({isDropTipshow: false});
this.setState({ isDropTipshow: false });
if (e.dataTransfer.files.length) { // uploaded files
return;
}
@@ -569,14 +569,14 @@ class DirentListItem extends React.Component {
}
let dragStartItemData = e.dataTransfer.getData('applicaiton/drag-item-info');
dragStartItemData = JSON.parse(dragStartItemData);
if (Array.isArray(dragStartItemData)) { //move items
let direntPaths = dragStartItemData.map(draggedItem => {
if (Array.isArray(dragStartItemData)) { // move items
let direntPaths = dragStartItemData.map(draggedItem => {
return draggedItem.nodeRootPath;
});
let selectedPath = Utils.joinPath(this.props.path, this.props.dirent.name);
if (direntPaths.some(direntPath => { return direntPath === selectedPath;})) { //eg; A/B, A/C --> A/B
if (direntPaths.some(direntPath => { return direntPath === selectedPath;})) { // eg; A/B, A/C --> A/B
return;
}
@@ -698,10 +698,10 @@ class DirentListItem extends React.Component {
let isActive = (activeDirent && activeDirent.name === dirent.name) || dirent.isSelected;
let trClass = this.state.highlight ? 'tr-highlight ' : '';
trClass += this.state.isDropTipshow ? 'tr-drop-effect' : '';
trClass += isActive ? 'tr-active' : '';
trClass += isActive ? 'tr-active' : '';
trClass += isActive ? 'tr-active' : '';
let lockedInfo = dirent.is_freezed ? gettext('Frozen by {name}'): gettext('locked by {name}');
let lockedInfo = dirent.is_freezed ? gettext('Frozen by {name}') : gettext('locked by {name}');
lockedInfo = lockedInfo.replace('{name}', dirent.lock_owner_name);
const isDesktop = Utils.isDesktop();
@@ -748,7 +748,7 @@ class DirentListItem extends React.Component {
<img ref='drag_icon' src={iconUrl} width="24" alt='' />
}
{dirent.is_locked && <img className="locked" src={lockedImageUrl} alt={lockedMessage} title={lockedInfo}/>}
<div ref="empty_content" style={{position: 'absolute', width: '1px', height: '1px'}}></div>
<div ref="empty_content" style={{ position: 'absolute', width: '1px', height: '1px' }}></div>
</div>
</td>
<td className="name">

View File

@@ -100,11 +100,11 @@ class DirentListView extends React.Component {
}
freezeItem = () => {
this.setState({isItemFreezed: true});
this.setState({ isItemFreezed: true });
};
unfreezeItem = () => {
this.setState({isItemFreezed: false});
this.setState({ isItemFreezed: false });
};
onItemRename = (dirent, newName) => {
@@ -125,7 +125,7 @@ class DirentListView extends React.Component {
};
onItemSelected = (dirent) => {
this.setState({activeDirent: null});
this.setState({ activeDirent: null });
this.props.onItemSelected(dirent);
};
@@ -134,7 +134,7 @@ class DirentListView extends React.Component {
if (this.props.selectedDirentList.length > 0 && !this.state.activeDirent ) {
return;
}
this.setState({activeDirent: dirent});
this.setState({ activeDirent: dirent });
this.props.onDirentClick(dirent);
};
@@ -204,7 +204,7 @@ class DirentListView extends React.Component {
};
closeImagePopup = () => {
this.setState({isImagePopupOpen: false});
this.setState({ isImagePopupOpen: false });
};
onCreateFileToggle = (fileType) => {
@@ -215,11 +215,11 @@ class DirentListView extends React.Component {
};
onCreateFolderToggle = () => {
this.setState({isCreateFolderDialogShow: !this.state.isCreateFolderDialogShow});
this.setState({ isCreateFolderDialogShow: !this.state.isCreateFolderDialogShow });
};
onAddFolder = (dirPath) => {
this.setState({isCreateFolderDialogShow: false});
this.setState({ isCreateFolderDialogShow: false });
this.props.onAddFolder(dirPath);
};
@@ -232,11 +232,11 @@ class DirentListView extends React.Component {
};
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 });
};
onItemsDownload = () => {
@@ -244,8 +244,8 @@ class DirentListView extends React.Component {
if (selectedDirentList.length) {
if (selectedDirentList.length === 1 && !selectedDirentList[0].isDir()) {
let direntPath = Utils.joinPath(path, selectedDirentList[0].name);
let url = URLDecorator.getUrl({type: 'download_file_url', repoID: repoID, filePath: direntPath});
location.href= url;
let url = URLDecorator.getUrl({ type: 'download_file_url', repoID: repoID, filePath: direntPath });
location.href = url;
return;
}
@@ -261,7 +261,7 @@ class DirentListView extends React.Component {
};
onCloseZipDownloadDialog = () => {
this.setState({isProgressDialogShow: false});
this.setState({ isProgressDialogShow: false });
};
// common contextmenu handle
@@ -401,7 +401,7 @@ class DirentListView extends React.Component {
};
onContainerMenuItemClick = (operation) => {
switch(operation) {
switch (operation) {
case 'New Folder':
this.onCreateFolderToggle();
break;
@@ -431,7 +431,7 @@ class DirentListView extends React.Component {
};
onDirentsMenuItemClick = (operation) => {
switch(operation) {
switch (operation) {
case 'Move':
this.onMoveToggle();
break;
@@ -523,7 +523,7 @@ class DirentListView extends React.Component {
if (this.state.isListDropTipShow) {
return ;
}
this.setState({isListDropTipShow: true});
this.setState({ isListDropTipShow: true });
}
};
@@ -544,7 +544,7 @@ class DirentListView extends React.Component {
}
this.enteredCounter--;
if (this.enteredCounter === 0) {
this.setState({isListDropTipShow: false});
this.setState({ isListDropTipShow: false });
}
};
@@ -554,16 +554,16 @@ class DirentListView extends React.Component {
}
e.persist();
this.enteredCounter = 0;
this.setState({isListDropTipShow: false});
this.setState({ isListDropTipShow: 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, nodeRootPath} = dragStartItemData;
let { nodeDirent, nodeParentPath, nodeRootPath } = dragStartItemData;
if (Array.isArray(dragStartItemData)) { //selected items
if (Array.isArray(dragStartItemData)) { // selected items
return;
}
@@ -616,18 +616,18 @@ class DirentListView extends React.Component {
onDragLeave={this.onTableDragLeave}
onDrop={this.tableDrop}
>
<table className={`table-hover ${isDesktop ? '': 'table-thead-hidden'}`}>
<table className={`table-hover ${isDesktop ? '' : 'table-thead-hidden'}`}>
{isDesktop ? (
<thead onMouseDown={this.onThreadMouseDown} onContextMenu={this.onThreadContextMenu}>
<tr>
<th width="3%" className="pl10">
<input type="checkbox" className="vam" onChange={this.props.onAllItemSelected} checked={this.props.isAllItemSelected} aria-label={this.props.isAllItemSelected ? gettext('Unselect all items') : gettext('Select all items')} />
</th>
<th width="3%" className="pl10">{/*icon */}</th>
<th width="5%" className="pl10">{/*star */}</th>
<th width="3%" className="pl10">{/* icon */}</th>
<th width="5%" className="pl10">{/* star */}</th>
<th width="39%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
<th width="6%">{/*tag */}</th>
<th width="18%">{/*operation */}</th>
<th width="6%">{/* tag */}</th>
<th width="18%">{/* operation */}</th>
<th width="11%"><a className="d-block table-sort-op" href="#" onClick={this.sortBySize}>{gettext('Size')} {sortBySize && sortIcon}</a></th>
<th width="15%"><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Last Update')} {sortByTime && sortIcon}</a></th>
</tr>

View File

@@ -54,17 +54,23 @@ class DirentNodeView extends React.Component {
<p className="text-secondary text-center">{gettext('This folder has no content at this time.')}</p>
<p className="text-secondary text-center">{gettext('You can create files quickly')}{' +'}</p>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.md')}>
{'+ Markdown'}</button>
{'+ Markdown'}
</button>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.pptx')}>
{'+ PPT'}</button>
{'+ PPT'}
</button>
<br />
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.docx')}>
{'+ Word'}</button>
{'+ Word'}
</button>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.xlsx')}>
{'+ Excel'}</button>
{'+ Excel'}
</button>
<br />
{enableSeadoc && !currentRepoInfo.encrypted && <button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.sdoc')}>
{'+ SeaDoc'}</button>}
{enableSeadoc && !currentRepoInfo.encrypted &&
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.sdoc')}>
{'+ SeaDoc'}
</button>}
</div>
{this.state.isCreateFileDialogShow && (
<ModalPortal>

View File

@@ -20,8 +20,9 @@ export default class FileTag extends React.PureComponent {
className="file-tag"
id={fileTagID}
key={fileTag.id}
style={{zIndex:length - index, backgroundColor:fileTag.color}}
></span>
style={{ zIndex: length - index, backgroundColor: fileTag.color }}
>
</span>
<UncontrolledTooltip target={fileTagID} placement="bottom">
{fileTag.name}
</UncontrolledTooltip>