Skip to content

Commit

Permalink
update-file-type
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjianfei-user committed Jan 8, 2024
1 parent 4bb0386 commit 6ee3992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/dialog/create-file-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CreateFile extends React.Component {
isMarkdownDraft: false,
isSdocDraft: false,
errMessage: '',
isSubmitBtnActive: false,
isSubmitBtnActive: props.fileType.slice(0, -5) ? true : false,
};
this.newInput = React.createRef();
}
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/pages/sdoc/sdoc-editor/external-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ExternalOperations extends React.Component {
isShowShareDialog: false,
internalLink: '',
isShowCreateFileDialog: false,
fileType: '.sdoc',
};
}

Expand Down Expand Up @@ -122,7 +123,10 @@ class ExternalOperations extends React.Component {
this.props.onNewNotification();
};

onCreateSdocFile = () => {
onCreateSdocFile = (params) => {
if (params?.newFileName) {
this.setState({fileType: `${params.newFileName}.sdoc`});
}
this.setState({
isShowCreateFileDialog: !this.state.isShowCreateFileDialog
});
Expand All @@ -146,7 +150,7 @@ class ExternalOperations extends React.Component {

render() {
const { repoID, docPath, docName, docPerm, dirPath } = this.props;
const { isShowInternalLinkDialog, isShowShareDialog, internalLink, isShowCreateFileDialog } = this.state;
const { isShowInternalLinkDialog, isShowShareDialog, internalLink, isShowCreateFileDialog, fileType } = this.state;
return (
<>
{isShowInternalLinkDialog && (
Expand All @@ -170,7 +174,7 @@ class ExternalOperations extends React.Component {
{isShowCreateFileDialog && (
<CreateFile
parentPath={dirPath}
fileType='.sdoc'
fileType={fileType}
onAddFile={this.onAddFile}
checkDuplicatedName={this.checkDuplicatedName}
toggleDialog={this.onCreateSdocFile}
Expand Down

0 comments on commit 6ee3992

Please sign in to comment.