编辑文件-提交至

This commit is contained in:
caishi 2020-10-16 10:35:51 +08:00
parent 4f13421872
commit 3949584549
4 changed files with 23 additions and 22 deletions

View File

@ -521,6 +521,7 @@ class CoderRootDirectory extends Component {
{...this.state}
readOnly={this.state.readOnly}
onEdit={this.onEdit}
currentBranch={branch}
></CoderRootFileDetail>
)}
{

View File

@ -164,7 +164,8 @@ class CoderRootFileDetail extends Component {
current_user,
isManager,
isDeveloper,
md
md,
currentBranch
} = this.props;
const { language, languages, description } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper);
@ -194,12 +195,9 @@ class CoderRootFileDetail extends Component {
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
</span>
}
</span>
) : (
<React.Fragment>
<Select
@ -260,21 +258,22 @@ class CoderRootFileDetail extends Component {
</a>
</div>
) : (
md && readOnly ?
<div className="files-md">
<RenderHtml className="file-md imageLayerParent" value={description} />
</div>
:
<Meditor
{...this.props}
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={detail.content}
readOnly={readOnly}
editorType="update"
></Meditor>
)}
md && readOnly ?
<div className="files-md">
<RenderHtml className="file-md imageLayerParent" value={description} />
</div>
:
<Meditor
{...this.props}
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={detail.content}
readOnly={readOnly}
editorType="update"
currentBranch={currentBranch}
></Meditor>
)}
</div>
</div>
);

View File

@ -115,7 +115,7 @@ class UserSubmitComponent extends Component {
const { branch, projectsId , owner } = this.props.match.params;
const { current_user, filepath, projectDetail } = this.props;
const { current_user, filepath, projectDetail , currentBranch } = this.props;
const { editor_type } = this.props;
return (
<div>
@ -175,7 +175,7 @@ class UserSubmitComponent extends Component {
>
<Radio value="0" className="mb10">
<i className="iconfont icon-banbenku font-16 mr5"></i>
直接提交至<span className="color-orange">{branch}</span>
直接提交至<span className="color-orange">{currentBranch || branch}</span>
</Radio>
<Radio value="1">
<Icon type="pull-request" className="mr5" />

View File

@ -20,7 +20,7 @@ class m_editor extends Component {
render() {
const { editorValue } = this.state;
const { readOnly, editorType, language } = this.props;
const { readOnly, editorType, language , currentBranch } = this.props;
const editor_options = {
lineNumbers: "on",
wordWrap: true, //强制换行
@ -64,6 +64,7 @@ class m_editor extends Component {
filepath={`${this.props.filepath}`}
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
></UserSubmitComponent>
)}
</div>