diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index be03e03fb..9bf831933 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -67,6 +67,7 @@ function CoderDepot(props){ const [ editReadme , setEditReadme ] = useState(false); const [ pullsFlag , setPullsFlag ] = useState(true); const [ issuesFlag , setIssuesFlag ] = useState(true); + const [ releaseVersions , setReleaseVersions] = useState(undefined); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; @@ -131,6 +132,18 @@ function CoderDepot(props){ } },[projectsId,owner,pathname,defaultBranch]) + useEffect(()=>{ + axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{ + if(result && result.data){ + const release = { + "list":result.data.releases, + "total_count":result.data.releases.length + } + setReleaseVersions(release); + } + }) + },[]) + // 获取readme信息 function getReadmeInfo(path, ref) { axios.get(`/${owner}/${projectsId}/readme.json`, { @@ -545,13 +558,13 @@ function CoderDepot(props){ } {/* 发布 */} { - projectDetail && projectDetail.release_versions && + releaseVersions && diff --git a/src/forge/Main/version/version.js b/src/forge/Main/version/version.js index c28cc4b85..6c13a809d 100644 --- a/src/forge/Main/version/version.js +++ b/src/forge/Main/version/version.js @@ -63,7 +63,7 @@ function version(props) { {item.draft} - {item.tag_name} + {item.tag_name} diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index 3b8a92052..de4b8289e 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -52,68 +52,74 @@ class m_editor extends Component { const handleEditorMount = (editor, monaco) => { editor.onDidChangeModelDecorations(() => { - updateEditorHeight(); // typing - requestAnimationFrame(updateEditorHeight); //folding + updateEditorHeight(); // typing + requestAnimationFrame(updateEditorHeight); // folding }); const updateEditorHeight = () => { - const editorElement = editor.getDomNode(); + const editorElement = editor.getDomNode(); - if (!editorElement) { - return; - } + if (!editorElement) { + return; + } - const padding = 40; + const padding = 40; - const lineHeight = editor.getOption( - monaco.editor.EditorOption.lineHeight - ); - const lineCount = editor.getModel().getLineCount() || 1; - const height = - editor.getTopForLineNumber(lineCount + 1) + - lineHeight + - padding; - - if (this.state.prevHeight !== height) { - this.setState({ - prevHeight:height - }) + const lineHeight = editor.getOption( + monaco.editor.EditorOption.lineHeight + ); + + const lineCount = editor.getModel().getLineCount() || 1; + const height = + editor.getTopForLineNumber(lineCount + 1) + + lineHeight + + padding; + + if (this.state.prevHeight !== height) { + this.setState({ + prevHeight:height + }) // setPrevHeight(height); editorElement.style.height = `${height}px`; editor.layout(); - } + } }; - }; + }; + return ( -
-
- -
- {!readOnly && ( -
- -
- )} -
+ + + +
+
+ +
+ {!readOnly && ( +
+ +
+ )} +
+
); } }