编辑文件-提交至

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} {...this.state}
readOnly={this.state.readOnly} readOnly={this.state.readOnly}
onEdit={this.onEdit} onEdit={this.onEdit}
currentBranch={branch}
></CoderRootFileDetail> ></CoderRootFileDetail>
)} )}
{ {

View File

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

View File

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

View File

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