代码库根目录:点击readme文件的编辑按钮时要显示编辑状态

This commit is contained in:
caishi 2021-07-07 11:16:07 +08:00
parent e6e0546e27
commit 967ff385aa
1 changed files with 6 additions and 3 deletions

View File

@ -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){