From 6ee3992064c97632c6afd8df9efdc39589a7d520 Mon Sep 17 00:00:00 2001 From: yinjianfei <1358009667@qq.com> Date: Mon, 8 Jan 2024 10:55:34 +0800 Subject: [PATCH] update-file-type --- frontend/src/components/dialog/create-file-dialog.js | 2 +- .../src/pages/sdoc/sdoc-editor/external-operations.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/dialog/create-file-dialog.js b/frontend/src/components/dialog/create-file-dialog.js index 560da08cdc9..6eb34293fc3 100644 --- a/frontend/src/components/dialog/create-file-dialog.js +++ b/frontend/src/components/dialog/create-file-dialog.js @@ -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(); } diff --git a/frontend/src/pages/sdoc/sdoc-editor/external-operations.js b/frontend/src/pages/sdoc/sdoc-editor/external-operations.js index aef441c760e..4ef3cdf4493 100644 --- a/frontend/src/pages/sdoc/sdoc-editor/external-operations.js +++ b/frontend/src/pages/sdoc/sdoc-editor/external-operations.js @@ -30,6 +30,7 @@ class ExternalOperations extends React.Component { isShowShareDialog: false, internalLink: '', isShowCreateFileDialog: false, + fileType: '.sdoc', }; } @@ -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 }); @@ -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 && ( @@ -170,7 +174,7 @@ class ExternalOperations extends React.Component { {isShowCreateFileDialog && (