forked from Gitlink/forgeplus-react
issue
This commit is contained in:
parent
7a8b028aeb
commit
f9ce3de759
|
@ -1,5 +1,5 @@
|
|||
import React , { Component } from 'react';
|
||||
import { Dropdown , Icon } from 'antd';
|
||||
import { Dropdown , Icon , Tooltip } from 'antd';
|
||||
import "./branch.css";
|
||||
|
||||
class CloneAddress extends Component{
|
||||
|
@ -8,7 +8,7 @@ class CloneAddress extends Component{
|
|||
var e = document.getElementById("copy_rep_content");
|
||||
e.select();
|
||||
document.execCommand("Copy");
|
||||
this.props.showNotification('复制成功');
|
||||
// this.props.showNotification('复制成功');
|
||||
}
|
||||
|
||||
render(){
|
||||
|
@ -18,7 +18,9 @@ class CloneAddress extends Component{
|
|||
<span className={"addressType active"} onClick={()=>this.changeAddress("http")}>HTTP</span>
|
||||
{/* <span className={address ==="ssh" ? "addressType active":"addressType"} onClick={()=>this.changeAddress("ssh")}>SSH</span> */}
|
||||
<input type="text" id="copy_rep_content" value={ http_url }/>
|
||||
<span onClick={()=>this.jsCopy()}><i className="iconfont icon-fuzhi"></i></span>
|
||||
<Tooltip title="复制链接">
|
||||
<span onClick={()=>this.jsCopy()}><i className="iconfont icon-fuzhi"></i></span>
|
||||
</Tooltip>
|
||||
<span>
|
||||
<Dropdown overlay={downloadUrl} trigger={['click']} placement="bottomRight">
|
||||
<a className="ant-dropdown-link">
|
||||
|
|
|
@ -3,9 +3,13 @@
|
|||
border-radius: 4px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding:0px 10px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
width: 150px;
|
||||
}
|
||||
.branchDropdown .ant-dropdown-trigger{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.branchOptions{
|
||||
width: 200px;
|
||||
|
@ -16,7 +20,7 @@
|
|||
max-height: 200px;
|
||||
}
|
||||
.OptionsUl{
|
||||
max-height: 100px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.OptionsUl li{
|
||||
|
|
|
@ -36,7 +36,6 @@ class CoderRootDirectory extends Component{
|
|||
branchList:undefined,
|
||||
fileDetail:undefined,
|
||||
branchLastCommit:undefined,
|
||||
current_user:undefined,
|
||||
|
||||
rootData:undefined
|
||||
}
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
import React , { Component } from "react";
|
||||
import Editor from "react-monaco-editor";
|
||||
// import Editor from "react-monaco-editor";
|
||||
|
||||
import {UnControlled as CodeMirror} from 'react-codemirror2';
|
||||
import 'codemirror/mode/cmake/cmake';
|
||||
import 'codemirror/mode/sql/sql';
|
||||
import 'codemirror/mode/xml/xml';
|
||||
import 'codemirror/mode/clike/clike';
|
||||
import 'codemirror/mode/javascript/javascript';
|
||||
import 'codemirror/addon/hint/show-hint.css';
|
||||
import 'codemirror/addon/hint/show-hint.js';
|
||||
|
||||
import { Popconfirm, Result } from 'antd';
|
||||
|
||||
|
@ -42,16 +51,16 @@ class CoderRootFileDetail extends Component{
|
|||
}
|
||||
|
||||
// 编辑文件
|
||||
changeContent=(e)=>{
|
||||
|
||||
changeMmirror=(e,e1,value)=>{
|
||||
this.setState({
|
||||
value:e
|
||||
value
|
||||
})
|
||||
}
|
||||
|
||||
deleteFile=()=>{
|
||||
const { author , branch , detail }= this.props;
|
||||
const { branch , detail }= this.props;
|
||||
const { projectsId } = this.props.match.params;
|
||||
const authorLogin = this.props.match.params.author;
|
||||
|
||||
const url = `/repositories/${projectsId}/delete_file.json`;
|
||||
axios.delete(url,{
|
||||
|
@ -99,8 +108,8 @@ class CoderRootFileDetail extends Component{
|
|||
render(){
|
||||
const { detail , current_user , isManager , isReporter , isDeveloper } = this.props;
|
||||
const { readOnly ,value } = this.state;
|
||||
let flag = current_user && current_user.login && (isManager || isReporter);
|
||||
|
||||
const flag = current_user && current_user.login && (isManager || isReporter);
|
||||
return(
|
||||
<div>
|
||||
<div className="branchTable">
|
||||
|
@ -135,13 +144,30 @@ class CoderRootFileDetail extends Component{
|
|||
<a href={detail.download_url} className="color-blue font-15">下载原始文件</a>
|
||||
</div>
|
||||
:
|
||||
<Editor
|
||||
height="300px"
|
||||
theme={"vs-dark"}
|
||||
<CodeMirror
|
||||
value={value}
|
||||
onChange={this.changeContent}
|
||||
readOnly={readOnly}
|
||||
options={{
|
||||
// mode: 'xml',
|
||||
theme: 'default',
|
||||
lineNumbers: true,
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
readOnly: readOnly?"nocursor":false
|
||||
}}
|
||||
onChange={this.changeMmirror}
|
||||
/>
|
||||
// <Editor
|
||||
// height="300px"
|
||||
// theme={"vs-dark"}
|
||||
// value={value}
|
||||
// onChange={this.changeContent}
|
||||
// readOnly={readOnly}
|
||||
// />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -291,12 +291,11 @@ class Detail extends Component{
|
|||
|
||||
render(){
|
||||
|
||||
const { projectDetail , watchers_count , praises_count , forked_count , isSpin } = this.state;
|
||||
const { projectDetail , watchers_count , praises_count , forked_count , isSpin , isManager } = this.state;
|
||||
const url = this.props.history.location.pathname;
|
||||
const urlArr= url.split("/");
|
||||
const urlFlag = (urlArr.length === 3);
|
||||
|
||||
const { isManager } = this.state;
|
||||
const { projectsId } = this.props.match.params;
|
||||
|
||||
const { state } = this.props.history.location;
|
||||
|
|
|
@ -368,8 +368,8 @@ body,#root{
|
|||
}
|
||||
/* 分支 */
|
||||
.branchTable{
|
||||
border:1px solid #f4f4f4;
|
||||
background-color: #f4f4f4;
|
||||
border:1px solid #f7f7f7;
|
||||
background-color: #f7f7f7;
|
||||
border-radius: 4px;
|
||||
margin-top:20px;
|
||||
}
|
||||
|
@ -559,4 +559,10 @@ body,#root{
|
|||
border: 1px solid #2185d0;
|
||||
}
|
||||
.content-file{margin-top: 8px;}
|
||||
|
||||
.content-file .CodeMirror{
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #e4e4e4;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.text-center{text-align: center;}
|
||||
|
|
|
@ -17,7 +17,6 @@ import Quill from 'quill';
|
|||
import katex from 'katex';
|
||||
import deepEqual from './deepEqual.js'
|
||||
import { fetchUploadImage } from '../../services/ojService.js';
|
||||
import { getImageUrl } from 'educoder'
|
||||
import ImageBlot from './ImageBlot';
|
||||
import FillBlot from './FillBlot';
|
||||
import LinkBlot from './link-blot'
|
||||
|
|
Loading…
Reference in New Issue