forked from Gitlink/forgeplus-react
分支设置下拉列表不可选择标签
This commit is contained in:
parent
e3c1e7b82f
commit
a4dbda8c5d
|
@ -55,8 +55,8 @@ function buildToc(coll, k, level, ctx) {
|
|||
|
||||
export function getTocContent() {
|
||||
buildToc(toc, 0, 0, ctx)
|
||||
ctx.push("</ul>")
|
||||
return ctx.join("")
|
||||
ctx.push("</ul>");
|
||||
return ctx.join("");
|
||||
}
|
||||
|
||||
const tokenizer = {
|
||||
|
|
|
@ -22,9 +22,8 @@ export default ({
|
|||
url
|
||||
}) => {
|
||||
let str = String(value);
|
||||
|
||||
const html = useMemo(() => {
|
||||
let rs = marked(str)
|
||||
let rs = marked(str);
|
||||
const math_expressions = getMathExpressions();
|
||||
if (str.match(/\[TOC\]/)) {
|
||||
rs = rs.replace("<p>[TOC]</p>", getTocContent())
|
||||
|
@ -37,14 +36,12 @@ export default ({
|
|||
rs = rs.replace(/▁/g, "▁▁▁")
|
||||
resetMathExpressions()
|
||||
return dompurify.sanitize(rs)
|
||||
|
||||
}, [str]);
|
||||
|
||||
// 锚点跳转,链接地址里含#对应的id
|
||||
useEffect(()=>{
|
||||
if(url && url.hash && html){
|
||||
let u = url.hash;
|
||||
debugger;
|
||||
if(u){
|
||||
let id = decodeURIComponent(u.split("#")[1]);
|
||||
let ele = document.getElementById(id);
|
||||
|
|
|
@ -4,7 +4,7 @@ import './branch.css';
|
|||
import { getBranch , getTag } from '../GetData/getData';
|
||||
|
||||
|
||||
export default (({ projectsId , branch , owner , changeBranch , branchList })=>{
|
||||
export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{
|
||||
const [ showValue , setShowValue ] = useState(branch);
|
||||
const [ inputValue , setInputValue] = useState(undefined);
|
||||
const [ nav , setNav ] = useState(0);
|
||||
|
@ -82,8 +82,8 @@ export default (({ projectsId , branch , owner , changeBranch , branchList })=>{
|
|||
onChange={changeInputValue} style={{width:"220px"}}
|
||||
/>
|
||||
<ul className="navUl">
|
||||
<li className={nav==0?"navli active":"navli"} onClick={()=>changeNav(0)}><i className="iconfont icon-fenzhi1 font-14 mr3"></i>分支列表</li>
|
||||
<li className={nav==1?"navli active":"navli"} onClick={()=>changeNav(1)}><i className="iconfont icon-biaoqian3 font-14 mr3"></i>标签列表</li>
|
||||
<li className={nav === 0?"navli active":"navli"} onClick={()=>changeNav(0)}><i className="iconfont icon-fenzhi1 font-14 mr3"></i>分支列表</li>
|
||||
{ tagflag && <li className={nav === 1?"navli active":"navli"} onClick={()=>changeNav(1)}><i className="iconfont icon-biaoqian3 font-14 mr3"></i>标签列表</li> }
|
||||
</ul>
|
||||
</div>
|
||||
<Spin spinning={isSpin}>
|
||||
|
|
|
@ -109,6 +109,7 @@ export default ((props)=>{
|
|||
owner={owner}
|
||||
history={props.history}
|
||||
branchList = {branchList}
|
||||
tagflag={false}
|
||||
/>
|
||||
<a className="color-blue ml20" onClick={()=>resetSetting()}>设为默认分支</a>
|
||||
</AlignCenter>
|
||||
|
@ -116,26 +117,16 @@ export default ((props)=>{
|
|||
<div className="mt10">
|
||||
<p className="color-grey-3 mb10 font-18">分支保护</p>
|
||||
<AlignCenter>
|
||||
<Select
|
||||
showSearch
|
||||
defaultValue={branch}
|
||||
className="setHeight"
|
||||
style={{ width: 240, height: 40 }}
|
||||
placeholder="选择分支"
|
||||
optionFilterProp="children"
|
||||
filterOption={(input, option) =>
|
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
onChange={setProtectBranch}
|
||||
>
|
||||
{
|
||||
branchList && branchList.length > 0 && branchList.map((item,key)=>{
|
||||
return(
|
||||
<Select.Option value={item.name}>{item.name}</Select.Option>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Select>
|
||||
<SelectBranch
|
||||
branch={protectBranch}
|
||||
repo_id={ projectDetail && projectDetail.repo_id}
|
||||
projectsId={projectsId}
|
||||
changeBranch={setProtectBranch}
|
||||
owner={owner}
|
||||
history={props.history}
|
||||
branchList = {branchList}
|
||||
tagflag={false}
|
||||
/>
|
||||
<a className={ protectBranchList && protectBranchList.length > 0?"color-blue ml20":"color-grey ml20"} onClick={()=>settingRule(protectBranch)}>设置分支保护</a>
|
||||
</AlignCenter>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue