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

update-file-type

This commit is contained in:
yinjianfei
2024-01-08 10:55:34 +08:00
parent 4bb038656f
commit 6ee3992064
2 changed files with 8 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ class CreateFile extends React.Component {
isMarkdownDraft: false, isMarkdownDraft: false,
isSdocDraft: false, isSdocDraft: false,
errMessage: '', errMessage: '',
isSubmitBtnActive: false, isSubmitBtnActive: props.fileType.slice(0, -5) ? true : false,
}; };
this.newInput = React.createRef(); this.newInput = React.createRef();
} }

View File

@@ -30,6 +30,7 @@ class ExternalOperations extends React.Component {
isShowShareDialog: false, isShowShareDialog: false,
internalLink: '', internalLink: '',
isShowCreateFileDialog: false, isShowCreateFileDialog: false,
fileType: '.sdoc',
}; };
} }
@@ -122,7 +123,10 @@ class ExternalOperations extends React.Component {
this.props.onNewNotification(); this.props.onNewNotification();
}; };
onCreateSdocFile = () => { onCreateSdocFile = (params) => {
if (params?.newFileName) {
this.setState({fileType: `${params.newFileName}.sdoc`});
}
this.setState({ this.setState({
isShowCreateFileDialog: !this.state.isShowCreateFileDialog isShowCreateFileDialog: !this.state.isShowCreateFileDialog
}); });
@@ -146,7 +150,7 @@ class ExternalOperations extends React.Component {
render() { render() {
const { repoID, docPath, docName, docPerm, dirPath } = this.props; const { repoID, docPath, docName, docPerm, dirPath } = this.props;
const { isShowInternalLinkDialog, isShowShareDialog, internalLink, isShowCreateFileDialog } = this.state; const { isShowInternalLinkDialog, isShowShareDialog, internalLink, isShowCreateFileDialog, fileType } = this.state;
return ( return (
<> <>
{isShowInternalLinkDialog && ( {isShowInternalLinkDialog && (
@@ -170,7 +174,7 @@ class ExternalOperations extends React.Component {
{isShowCreateFileDialog && ( {isShowCreateFileDialog && (
<CreateFile <CreateFile
parentPath={dirPath} parentPath={dirPath}
fileType='.sdoc' fileType={fileType}
onAddFile={this.onAddFile} onAddFile={this.onAddFile}
checkDuplicatedName={this.checkDuplicatedName} checkDuplicatedName={this.checkDuplicatedName}
toggleDialog={this.onCreateSdocFile} toggleDialog={this.onCreateSdocFile}