forked from Gitlink/forgeplus-react
merge
This commit is contained in:
commit
16e64b60bc
|
@ -236,7 +236,7 @@ function ProjectSource(props) {
|
|||
</div>
|
||||
{adminUrl && <Button onClick={()=>{wiki && window.open(`${data && data.gitlinkProject.wiki_url}/${wiki.titleStr}/${wiki.key}`)}} className='zone_apply_button' style={{width: '90px', height: '34px'}}>配置内容</Button>}
|
||||
</FlexAJ>
|
||||
{wikiDetail.md_content && <RenderHtml className="wikiContentHC editor-content-panel mt20" value={ Base64.decode(wikiDetail.md_content) } url={history.location}/>}
|
||||
{wikiDetail.md_content && <RenderHtml className="wikiContentHC editor-content-panel mt20 imageLayerParent" value={ Base64.decode(wikiDetail.md_content) } url={history.location}/>}
|
||||
</LongWidth>
|
||||
{wikiContMenu && wikiContMenu !== "<ul></ul>" && <Affix offsetTop={80}>
|
||||
<div id="wikiContMenuBox" className='wikiContMenuBox font-15' dangerouslySetInnerHTML={{ __html: wikiContMenu }}></div>
|
||||
|
|
|
@ -15,6 +15,7 @@ import { IsPC } from 'educoder';
|
|||
import "slick-carousel/slick/slick.css";
|
||||
import "slick-carousel/slick/slick-theme.css";
|
||||
import { tempEnum } from "./tempInfo";
|
||||
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
||||
|
||||
const SourceDetail = Loadable({
|
||||
loader: () => import("./Pages/sourceDetail"),
|
||||
|
@ -177,5 +178,8 @@ function Index(props){
|
|||
</div>
|
||||
)
|
||||
}
|
||||
export default withRouter((CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
|
||||
export default withRouter((CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(ImageLayerOfCommentHOC({
|
||||
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
|
||||
parentSelector: ".newContainer",
|
||||
})(Index)))))
|
||||
);
|
|
@ -1,19 +1,19 @@
|
|||
import React, { useEffect, useCallback, useState, useMemo } from 'react';
|
||||
import { Button, Dropdown, Icon, Input, Menu, Tooltip, Select, Upload, message, Spin, Modal } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Dropdown, Icon, Input, Menu, Select, message, Spin, Modal } from 'antd';
|
||||
import { getImageUrl, timeAgo } from 'educoder';
|
||||
import cookie from 'react-cookies';
|
||||
import CopyTool from '../Component/CopyTool';
|
||||
import Welcome from './Welcome';
|
||||
import RenderHtml from "../../components/render-html";
|
||||
|
||||
import { wikiPages, getWiki, parseSidebar, updateWiki, treeToMd } from './api';
|
||||
import { httpUrl, TokenKey } from './fetch';
|
||||
import { httpUrl } from './fetch';
|
||||
import './Index.scss';
|
||||
import './components/ModalFun/index.scss';
|
||||
import { isArray } from 'lodash';
|
||||
import { Base64 } from 'js-base64';
|
||||
import Sidebar from './components/sidebar';
|
||||
import UploadWiki from './components/uploadWiki';
|
||||
import axios from 'axios';
|
||||
const InputGroup = Input.Group;
|
||||
const { Option } = Select;
|
||||
|
||||
|
@ -38,9 +38,18 @@ export default (props) => {
|
|||
const [addMenuError, setAddMenuError] = useState(undefined);
|
||||
const [sidebar, setSidebar] = useState(undefined);
|
||||
const [defaultSelectedKeys, setDefaultSelectedKeys] = useState(undefined);
|
||||
const [masterProtected, setMasterProtected] = useState(false);
|
||||
|
||||
useEffect(()=>{
|
||||
window.scrollTo(0,0);
|
||||
// 获取仓库分支信息,判断master是否设置了分支保护
|
||||
if(projectsId && owner){
|
||||
axios.get(`/v1/${owner}/${projectsId}/branches.json`, {keyword: 'master'}).then(res=>{
|
||||
if(res && res.data && res.data.total_count === 1){
|
||||
setMasterProtected(res.data.branches[0].protected);
|
||||
}
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(()=>{
|
||||
|
@ -292,7 +301,7 @@ export default (props) => {
|
|||
<div className="wiki-nav">
|
||||
|
||||
{/* 读sidebar转换成目录树 */}
|
||||
<Sidebar fileList = {fileList} changeitem={changeitem} projectsId={projectsId} owner={owner} project={project} setReload={setReload} sidebar={sidebar} history={history} permission={permission} defaultSelectedKeys={defaultSelectedKeys} fileArrInit={fileArrInit}/>
|
||||
<Sidebar fileList = {fileList} changeitem={changeitem} projectsId={projectsId} owner={owner} project={project} setReload={setReload} sidebar={sidebar} history={history} permission={permission} defaultSelectedKeys={defaultSelectedKeys} fileArrInit={fileArrInit} masterProtected={masterProtected}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -321,7 +330,7 @@ export default (props) => {
|
|||
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
|
||||
</div>
|
||||
|
||||
{itemDetail&&itemDetail.md_content&&<RenderHtml className="wiki-content-detail editor-content-panel" value={ itemDetail && Base64.decode(itemDetail.md_content) } url={history.location}/>}
|
||||
{itemDetail&&itemDetail.md_content&&<RenderHtml className="wiki-content-detail editor-content-panel imageLayerParent" value={ itemDetail && Base64.decode(itemDetail.md_content) } url={history.location}/>}
|
||||
</div>
|
||||
</div>
|
||||
</div >
|
||||
|
|
|
@ -12,7 +12,7 @@ const {DirectoryTree, TreeNode} = Tree;
|
|||
|
||||
// wiki目录树
|
||||
export default function Sidebar(props) {
|
||||
const {fileList, changeitem, owner, projectsId, project, setReload, sidebar, history, permission, defaultSelectedKeys, fileArrInit} = props;
|
||||
const {fileList, changeitem, owner, projectsId, project, setReload, sidebar, history, permission, defaultSelectedKeys, fileArrInit, masterProtected} = props;
|
||||
const {location:{pathname}} = history;
|
||||
const [initMenuList, setInitMenuList] = useState(undefined);
|
||||
const [menuList, setMenuList] = useState(undefined);
|
||||
|
@ -66,9 +66,10 @@ export default function Sidebar(props) {
|
|||
</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a onClick={(e) => { deleteFileModal(e, title, isFile, item) }}>
|
||||
删除
|
||||
</a>
|
||||
{
|
||||
masterProtected && item.children.length ? <a onClick={() => { message.error("由于master分支设置了分支保护,不允许删除wiki") }}>删除</a> :
|
||||
<a onClick={(e) => { deleteFileModal(e, title, isFile, item) }}>删除</a>
|
||||
}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
};
|
||||
|
@ -81,9 +82,10 @@ export default function Sidebar(props) {
|
|||
</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a onClick={(e) => { deleteFileModal(e, title, isFile, item) }}>
|
||||
删除
|
||||
</a>
|
||||
{
|
||||
masterProtected ? <a onClick={() => { message.error("由于master分支设置了分支保护,不允许删除wiki") }}>删除</a> :
|
||||
<a onClick={(e) => { deleteFileModal(e, title, isFile, item) }}>删除</a>
|
||||
}
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue