内网版本-文件内容没有渲染的问题(隐藏了 webIDE 的原因)
This commit is contained in:
parent
df3ba179a3
commit
6fd469fd79
|
@ -27,7 +27,8 @@ class CoderRootFileDetail extends Component {
|
|||
description: props.detail.replace_content,
|
||||
menuList:undefined,
|
||||
replaceVisible:false,
|
||||
loading:false
|
||||
loading:false,
|
||||
random:0,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -140,6 +141,12 @@ class CoderRootFileDetail extends Component {
|
|||
EditFile = (flag) => {
|
||||
const { onEdit } = this.props;
|
||||
onEdit && onEdit(flag);
|
||||
if(flag){
|
||||
let num = Math.random();
|
||||
this.setState({
|
||||
random:num
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
DownLoadFile = (url) => {
|
||||
|
@ -272,7 +279,7 @@ class CoderRootFileDetail extends Component {
|
|||
} = this.props;
|
||||
// 文件只读状态
|
||||
const readOnly = this.props.history.location.search.indexOf('edit') === -1
|
||||
const { language, languages, description , replaceVisible , loading } = this.state;
|
||||
const { language, languages, description , replaceVisible , loading , random } = this.state;
|
||||
let flag = current_user && current_user.login && (isManager || isDeveloper);
|
||||
const Option = Select.Option;
|
||||
return (
|
||||
|
@ -395,6 +402,7 @@ class CoderRootFileDetail extends Component {
|
|||
filepath={`/${detail.path}`}
|
||||
content={detail.content}
|
||||
readOnly={readOnly}
|
||||
random={random}
|
||||
md={md}
|
||||
editorType="update"
|
||||
currentBranch={currentBranch}
|
||||
|
|
|
@ -21,7 +21,14 @@ class m_editor extends Component {
|
|||
};
|
||||
}
|
||||
componentDidUpdate = (prevProps) => {
|
||||
if (prevProps && this.props && this.props.content !== prevProps.content) {
|
||||
let firstCondition = prevProps && this.props && this.props.content !== prevProps.content;
|
||||
let secondCondition = prevProps && this.props && this.props.random !== prevProps.random;
|
||||
if (firstCondition) {
|
||||
this.setState({
|
||||
editorValue: this.props.content
|
||||
})
|
||||
}
|
||||
if(secondCondition){
|
||||
this.setState({
|
||||
editorValue: this.props.content
|
||||
})
|
||||
|
@ -57,20 +64,17 @@ class m_editor extends Component {
|
|||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
let download_url = detail && detail.download_url;
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="editorBorderBox">
|
||||
{!readOnly ?
|
||||
<CodeMirror
|
||||
placeholder="请输入内容"
|
||||
value={editorValue}
|
||||
options={editor_options}
|
||||
onChange={this.changeEditor}
|
||||
/> : ''
|
||||
// <CloudIDE download_url={download_url} value={editorValue} params={params} filepath={filepath&&filepath.startsWith('/')?filepath.slice(1):filepath}/>
|
||||
}
|
||||
<CodeMirror
|
||||
placeholder="请输入内容"
|
||||
value={editorValue}
|
||||
options={editor_options}
|
||||
onChange={this.changeEditor}
|
||||
readOnly={readOnly}
|
||||
/>
|
||||
</div>
|
||||
{!readOnly && (
|
||||
<div className="editorBorderSubmitBox" style={{ padding: "20px" }}>
|
||||
|
|
Loading…
Reference in New Issue