1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 19:01:42 +00:00

Merge pull request #6002 from haiwen/fix-create-new-file-error

fix: optimize code
This commit is contained in:
杨顺强
2024-04-02 16:06:14 +08:00
committed by GitHub

View File

@@ -15,11 +15,12 @@ const propTypes = {
class CreateFile extends React.Component {
constructor(props) {
super(props);
const { fileType = '' } = props;
this.state = {
parentPath: '',
childName: props.fileType || '',
childName: fileType,
errMessage: '',
isSubmitBtnActive: props.fileType.slice(0, -5) ? true : false,
isSubmitBtnActive: this.isSdocSuffix(fileType) ? true : false,
};
this.newInput = React.createRef();
}
@@ -33,6 +34,10 @@ class CreateFile extends React.Component {
}
}
isSdocSuffix = (name) => {
return name.endsWith('.sdoc');
};
handleChange = (e) => {
if (!e.target.value.trim()) {
this.setState({isSubmitBtnActive: false});