diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index f83b777d..a95b8446 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -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){