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

fix: optimize code

This commit is contained in:
liuhongbo
2024-04-01 10:21:48 +08:00
parent a63cffafc0
commit 4d9316827c

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});