1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 09:21:54 +00:00

fix file suffixes

This commit is contained in:
Michael An
2019-04-23 22:51:20 +08:00
parent 0897a3e1b7
commit e3d3b242b8
6 changed files with 17 additions and 17 deletions

View File

@@ -47,7 +47,7 @@ class InsertRepoImageDialog extends React.Component {
render() { render() {
const toggle = this.props.toggleCancel; const toggle = this.props.toggleCancel;
const fileSuffix = ['jpg', 'png', 'jpeg', 'gif', 'bmp']; const fileSuffixes = ['jpg', 'png', 'jpeg', 'gif', 'bmp'];
let imageUrl; let imageUrl;
if (this.state.repo) { if (this.state.repo) {
imageUrl = siteRoot + 'thumbnail/' + this.state.repo.repo_id + '/1024' + this.state.selectedPath; imageUrl = siteRoot + 'thumbnail/' + this.state.repo.repo_id + '/1024' + this.state.selectedPath;
@@ -64,7 +64,7 @@ class InsertRepoImageDialog extends React.Component {
onDirentItemClick={this.onDirentItemClick} onDirentItemClick={this.onDirentItemClick}
onRepoItemClick={this.onRepoItemClick} onRepoItemClick={this.onRepoItemClick}
mode="current_repo_and_other_repos" mode="current_repo_and_other_repos"
fileSuffix={fileSuffix} fileSuffixes={fileSuffixes}
/> />
</div> </div>
<div className="insert-image-container col-6"> <div className="insert-image-container col-6">

View File

@@ -12,7 +12,7 @@ const propTypes = {
dirent: PropTypes.object.isRequired, dirent: PropTypes.object.isRequired,
repo: PropTypes.object.isRequired, repo: PropTypes.object.isRequired,
onDirentItemClick: PropTypes.func.isRequired, onDirentItemClick: PropTypes.func.isRequired,
fileSuffix: PropTypes.array, fileSuffixes: PropTypes.array,
}; };
class DirentListItem extends React.Component { class DirentListItem extends React.Component {
@@ -92,7 +92,7 @@ class DirentListItem extends React.Component {
selectedRepo={this.props.selectedRepo} selectedRepo={this.props.selectedRepo}
onDirentItemClick={this.props.onDirentItemClick} onDirentItemClick={this.props.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
); );
})} })}
@@ -105,9 +105,9 @@ class DirentListItem extends React.Component {
let isCurrentPath = this.props.selectedPath === this.state.filePath; let isCurrentPath = this.props.selectedPath === this.state.filePath;
const fileName = this.props.dirent.name; const fileName = this.props.dirent.name;
if (this.props.fileSuffix && fileName && fileName.indexOf('.') !== -1) { if (this.props.fileSuffixes && fileName && fileName.indexOf('.') !== -1) {
const suffix = fileName.slice(fileName.lastIndexOf('.') + 1).toLowerCase(); const suffix = fileName.slice(fileName.lastIndexOf('.') + 1).toLowerCase();
if (!this.props.fileSuffix.includes(suffix)) return null; if (!this.props.fileSuffixes.includes(suffix)) return null;
} }
return ( return (
<li className="file-chooser-item"> <li className="file-chooser-item">

View File

@@ -9,7 +9,7 @@ const propTypes = {
isShowFile: PropTypes.bool, isShowFile: PropTypes.bool,
selectedPath: PropTypes.string, selectedPath: PropTypes.string,
selectedRepo: PropTypes.object, selectedRepo: PropTypes.object,
fileSuffix: PropTypes.array, fileSuffixes: PropTypes.array,
repo: PropTypes.object.isRequired, repo: PropTypes.object.isRequired,
isShowChildren: PropTypes.bool.isRequired, isShowChildren: PropTypes.bool.isRequired,
onDirentItemClick: PropTypes.func.isRequired onDirentItemClick: PropTypes.func.isRequired
@@ -58,7 +58,7 @@ class DirentListView extends React.Component {
onDirentItemClick={this.props.onDirentItemClick} onDirentItemClick={this.props.onDirentItemClick}
selectedPath={this.props.selectedPath} selectedPath={this.props.selectedPath}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
); );
})} })}

View File

@@ -17,7 +17,7 @@ const propTypes = {
onDirentItemClick: PropTypes.func, onDirentItemClick: PropTypes.func,
onRepoItemClick: PropTypes.func, onRepoItemClick: PropTypes.func,
mode: PropTypes.oneOf(['current_repo_and_other_repos', 'only_all_repos', 'only_current_library']), mode: PropTypes.oneOf(['current_repo_and_other_repos', 'only_all_repos', 'only_current_library']),
fileSuffix: PropTypes.array, fileSuffixes: PropTypes.array,
}; };
class FileChooser extends React.Component { class FileChooser extends React.Component {
@@ -309,7 +309,7 @@ class FileChooser extends React.Component {
onRepoItemClick={this.onRepoItemClick} onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick} onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
} }
</div> </div>
@@ -328,7 +328,7 @@ class FileChooser extends React.Component {
onRepoItemClick={this.onRepoItemClick} onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick} onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
} }
</div> </div>
@@ -350,7 +350,7 @@ class FileChooser extends React.Component {
onRepoItemClick={this.onRepoItemClick} onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick} onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
} }
</div> </div>
@@ -370,7 +370,7 @@ class FileChooser extends React.Component {
onRepoItemClick={this.onRepoItemClick} onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick} onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
</div> </div>
</div> </div>

View File

@@ -10,7 +10,7 @@ const propTypes = {
initToShowChildren: PropTypes.bool.isRequired, initToShowChildren: PropTypes.bool.isRequired,
onDirentItemClick: PropTypes.func.isRequired, onDirentItemClick: PropTypes.func.isRequired,
onRepoItemClick: PropTypes.func.isRequired, onRepoItemClick: PropTypes.func.isRequired,
fileSuffix: PropTypes.array, fileSuffixes: PropTypes.array,
}; };
class RepoListItem extends React.Component { class RepoListItem extends React.Component {
@@ -65,7 +65,7 @@ class RepoListItem extends React.Component {
selectedRepo={this.props.selectedRepo} selectedRepo={this.props.selectedRepo}
selectedPath={this.props.selectedPath} selectedPath={this.props.selectedPath}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
)} )}
</li> </li>

View File

@@ -12,7 +12,7 @@ const propTypes = {
selectedPath: PropTypes.string, selectedPath: PropTypes.string,
onDirentItemClick: PropTypes.func.isRequired, onDirentItemClick: PropTypes.func.isRequired,
onRepoItemClick: PropTypes.func.isRequired, onRepoItemClick: PropTypes.func.isRequired,
fileSuffix: PropTypes.array, fileSuffixes: PropTypes.array,
}; };
class RepoListView extends React.Component { class RepoListView extends React.Component {
@@ -36,7 +36,7 @@ class RepoListView extends React.Component {
onRepoItemClick={this.props.onRepoItemClick} onRepoItemClick={this.props.onRepoItemClick}
onDirentItemClick={this.props.onDirentItemClick} onDirentItemClick={this.props.onDirentItemClick}
isShowFile={this.props.isShowFile} isShowFile={this.props.isShowFile}
fileSuffix={this.props.fileSuffix} fileSuffixes={this.props.fileSuffixes}
/> />
); );
})} })}