forked from Gitlink/forgeplus-react
代码库根目录:点击readme文件的编辑按钮时要显示编辑状态
This commit is contained in:
parent
e6e0546e27
commit
967ff385aa
|
@ -46,7 +46,8 @@ function CoderDepot(props){
|
|||
const [ website , setWebsite ] = useState(undefined);
|
||||
const [ lesson_url , setLessonUrl ] = useState(undefined);
|
||||
const [ readme , setReadme ] = useState(undefined);
|
||||
const [ defaultBranch , setDefaultBranch ] = useState(undefined)
|
||||
const [ defaultBranch , setDefaultBranch ] = useState(undefined);
|
||||
const [ editReadme , setEditReadme ] = useState(false);
|
||||
|
||||
const owner = props.match.params.owner;
|
||||
const projectsId = props.match.params.projectsId;
|
||||
|
@ -110,6 +111,7 @@ function CoderDepot(props){
|
|||
setMainFlag(true);
|
||||
setReadOnly(true);
|
||||
setReadme(result.data.readme);
|
||||
setEditReadme(false);
|
||||
setHide(true);
|
||||
}
|
||||
setTimeout(function(){setIsSpin(false);},500);
|
||||
|
@ -152,7 +154,7 @@ function CoderDepot(props){
|
|||
setLastCommit(c && c.commit);
|
||||
setLastCommitAuthor(c && c.committer);
|
||||
setMainFlag(false);
|
||||
setReadOnly(true);
|
||||
setReadOnly(!editReadme);
|
||||
setHide(true);
|
||||
}
|
||||
setTimeout(function(){setIsSpin(false);},500)
|
||||
|
@ -205,12 +207,13 @@ function CoderDepot(props){
|
|||
|
||||
function onEdit(readOnly){
|
||||
setReadOnly(readOnly);
|
||||
setEditReadme(false);
|
||||
}
|
||||
function ChangeFile(path, readOnly){
|
||||
//点击直接跳转页面 加载一次路由
|
||||
props.history.push(`/projects/${owner}/${projectsId}/tree/${branchName || defaultBranch}/${path}`);
|
||||
setType("file");
|
||||
setReadOnly(readOnly);
|
||||
setEditReadme(true);
|
||||
};
|
||||
|
||||
function changeHide(hide){
|
||||
|
|
Loading…
Reference in New Issue