Merge pull request 'issue' (#298) from durian/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
4971dc0a3d
|
@ -25,7 +25,7 @@ if (isDev) {
|
||||||
}
|
}
|
||||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
|
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||||
}
|
}
|
||||||
window._debugType = debugType;
|
window._debugType = debugType;
|
||||||
export function initAxiosInterceptors(props) {
|
export function initAxiosInterceptors(props) {
|
||||||
|
|
|
@ -47,7 +47,26 @@ class order_form extends Component {
|
||||||
}
|
}
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
this.getSelectList();
|
this.getSelectList();
|
||||||
|
//如果是复制issue则需要将原内容中的@谁录入 @列表中 (在tpm-md-editor.js中其实有处理,但是当用户点击【复制】按钮之后迅速创建issue会有延迟导致@失效)
|
||||||
|
if (this.state.form_type === "copy"){
|
||||||
|
let allUser = undefined;
|
||||||
|
axios.get(`/${owner}/${projectsId}/members.json`).then(response=>{
|
||||||
|
if (response.data.total_count !== 0) {
|
||||||
|
allUser = response.data.users
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (allUser && allUser.length !== 0 && description && description.indexOf("@") !== -1) {
|
||||||
|
const list = new Set();
|
||||||
|
allUser.map(item => {
|
||||||
|
if (description.indexOf(`[@${item.username}](/${item.login})`) !== -1) {
|
||||||
|
list.add(item.login);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.setState({ atWhoLoginList: Array.from(list)});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
get_detail = () => {
|
get_detail = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin:true
|
isSpin:true
|
||||||
|
|
|
@ -90,7 +90,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
const containerId = `mdEditor_${mdID}`;
|
const containerId = `mdEditor_${mdID}`;
|
||||||
const editorBodyId = `mdEditors_${mdID}`;
|
const editorBodyId = `mdEditors_${mdID}`;
|
||||||
const tipId = `e_tips_mdEditor_${mdID}`;
|
const tipId = `e_tips_mdEditor_${mdID}`;
|
||||||
const [init, setInit] = useState(true);
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
//请求members接口获取全部可@列表
|
//请求members接口获取全部可@列表
|
||||||
|
@ -107,6 +106,20 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
})
|
})
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
//如果是复制issue则需要将原内容中的@谁录入 @列表中
|
||||||
|
if (isCanAtme === "copy" && initValue && initValue.indexOf("@") !== -1) {
|
||||||
|
allUsers.map(item=>{
|
||||||
|
if (initValue.indexOf(`[@${item.username}](/${item.login})`) !== -1) {
|
||||||
|
const list = new Set(atWhoLoginList.current);
|
||||||
|
list.add(item.login);
|
||||||
|
atWhoLoginList.current = Array.from(list);
|
||||||
|
setAtWhoLoginListState(Array.from(list));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [initValue])
|
||||||
|
|
||||||
function onLayout() {
|
function onLayout() {
|
||||||
let ro;
|
let ro;
|
||||||
if (editorEl.current) {
|
if (editorEl.current) {
|
||||||
|
@ -198,7 +211,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
changeAtWhoLoginList && changeAtWhoLoginList(atWhoLoginListState);
|
changeAtWhoLoginList && changeAtWhoLoginList(atWhoLoginList.current);
|
||||||
},[atWhoLoginListState])
|
},[atWhoLoginListState])
|
||||||
|
|
||||||
const atWhoList = (
|
const atWhoList = (
|
||||||
|
@ -296,17 +309,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
|
|
||||||
const cmEl = editorInstance && editorInstance.cm
|
const cmEl = editorInstance && editorInstance.cm
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
//如果是复制issue则需要将原内容中的@谁录入 @列表中
|
|
||||||
if (init && cmEl && initValue && isCanAtme === "copy" && initValue.indexOf("@") !== -1) {
|
|
||||||
allUsers.map(item => {
|
|
||||||
initValue.indexOf(`[@${item.username}](/${item.login})`) !== -1 && selectAtWho(item.username);
|
|
||||||
})
|
|
||||||
setInit(false);
|
|
||||||
console.log('复制issue atWhoLoginList.current', atWhoLoginList.current, 'atWhoLoginListState', atWhoLoginListState);
|
|
||||||
}
|
|
||||||
}, [initValue])
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(atWhoVisibleRef.current){
|
if(atWhoVisibleRef.current){
|
||||||
// 添加上下键、enter键监听事件
|
// 添加上下键、enter键监听事件
|
||||||
|
|
Loading…
Reference in New Issue