From 76a00475a0f805fec5940300e8ccd83b6fae5d69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Tue, 4 Apr 2023 14:11:15 +0800
Subject: [PATCH 1/7] =?UTF-8?q?wiki=E9=9B=86=E6=88=90=E9=94=9A=E7=82=B9?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 4 ++--
public/index.html | 11 ++++++++++-
src/AppConfig.js | 3 ++-
src/common/marked.js | 3 ++-
src/components/render-html.jsx | 6 +++---
src/forge/Wiki/Index.jsx | 3 ++-
6 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/package.json b/package.json
index 05b987685..4fb713015 100644
--- a/package.json
+++ b/package.json
@@ -222,7 +222,7 @@
"webpack": "^4.42.1",
"webpack-bundle-analyzer": "^3.7.0"
},
- "volta":{
- "node":"8.12.0"
+ "volta": {
+ "node": "8.12.0"
}
}
diff --git a/public/index.html b/public/index.html
index 9a3bbc126..c62221a58 100755
--- a/public/index.html
+++ b/public/index.html
@@ -53,7 +53,16 @@
$('#ie_info').css({display:'block'});
$('#root').css({display:'none'});
}
-
+ window.onload=function(){
+ $(".newContainer").delegate("a.anchors","click",function(){
+ let h = $(this).offset().top - 180;
+ $("html,body").animate({scrollTop:h},10);
+ window.location.hash = $(this).attr("name");
+ return false;
+ });
+
+ }
+
diff --git a/src/AppConfig.js b/src/AppConfig.js
index 6e20bcf28..be1fe7622 100644
--- a/src/AppConfig.js
+++ b/src/AppConfig.js
@@ -33,7 +33,8 @@ export function initAxiosInterceptors(props) {
initOnlineOfflineListener();
// var proxy = "http://192.168.1.40:3000";
- var proxy = "http://111.8.36.180:8000";
+ // var proxy = "http://111.8.36.180:8000";
+ var proxy = "http://117.50.100.12:49999"
// var proxy = "https://www.osredm.com";
//响应前的设置
diff --git a/src/common/marked.js b/src/common/marked.js
index abfd657a0..674b986c5 100644
--- a/src/common/marked.js
+++ b/src/common/marked.js
@@ -155,7 +155,8 @@ renderer.heading = function (text, level, raw) {
level: level,
text: text
})
- return '
]*>/g
+const preRegex = /]*>/g;
function _unescape(str) {
let div = document.createElement('div')
div.innerHTML = str
@@ -46,7 +46,7 @@ export default ({
let id = decodeURIComponent(u.split("#")[1]);
let ele = document.getElementById(id);
if(ele){
- window.scrollTo(0, ele.offsetTop + 120);
+ window.scrollTo(0, ele.offsetTop);
}
}
}
diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx
index f15b19686..2ac1c6326 100644
--- a/src/forge/Wiki/Index.jsx
+++ b/src/forge/Wiki/Index.jsx
@@ -9,6 +9,7 @@ import { wikiPages, getWiki, deleteWiki } from './api';
import { httpUrl, TokenKey } from './fetch';
import './Index.scss';
import { isArray } from 'lodash';
+import RenderHtml from '../../components/render-html';
const Search = Input.Search;
const InputGroup = Input.Group;
const { Option } = Select;
@@ -271,7 +272,7 @@ export default (props) => {
{permission && }
-
+ {itemDetail && itemDetail.md_content && }
From 16e55368407c86211f7886e4b356028fca02751e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Tue, 4 Apr 2023 14:21:00 +0800
Subject: [PATCH 2/7] =?UTF-8?q?wiki=E9=9B=86=E6=88=90=E7=8B=AC=E7=AB=8B?=
=?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Wiki/Index.jsx | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx
index 2ac1c6326..45309631f 100644
--- a/src/forge/Wiki/Index.jsx
+++ b/src/forge/Wiki/Index.jsx
@@ -20,7 +20,7 @@ export default (props) => {
let projectsId = match.params.projectsId;
let owner = match.params.owner;
-
+ let wikiName = match.params.wikiName;
const [fileArrInit, setFileArrInit] = useState(null);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});
@@ -41,7 +41,12 @@ export default (props) => {
setFileArr(res.data);
setFileArrInit(res.data);
if (res.data.length) {
- setCheckItem(res.data[0]);
+ if (wikiName) {
+ let activeItem = res.data.filter(item => { return item.name == wikiName })[0] || res.data[0];
+ setCheckItem(activeItem)
+ } else {
+ setCheckItem(res.data[0]);
+ }
};
} else {
setFileArr([]);
@@ -192,6 +197,11 @@ export default (props) => {
},
};
+ function changeItem(item){
+ history.push(`/${owner}/${projectsId}/wiki/${item.name}`)
+ setCheckItem(item);
+ }
+
return (
< Spin spinning={!fileArrInit} className="opacitySpin">
{fileArrInit && fileArrInit.length ?
@@ -235,7 +245,7 @@ export default (props) => {
{
fileArr.map(item => {
return
- { setCheckItem(item) }}>
+ { changeItem(item) }}>
{item.name}
From 2b72c68cb92a093f322f57b61b714a23b4f98626 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Tue, 4 Apr 2023 14:50:37 +0800
Subject: [PATCH 3/7] =?UTF-8?q?wiki=E9=94=9A=E7=82=B9=E8=B7=B3=E8=BD=AC?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD-=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/css/index.scss | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/forge/css/index.scss b/src/forge/css/index.scss
index 720b02f4e..95326b3ba 100644
--- a/src/forge/css/index.scss
+++ b/src/forge/css/index.scss
@@ -394,4 +394,22 @@ button.btngrey{
border-color:rgba(153, 153, 153, 0.5);
color: #666666;
}
+}
+.markdown_anchors{
+ position: relative;
+}
+.markdown_anchors:hover {
+ .anchors{
+ display: inline-block;
+ }
+}
+.markdown_anchors {
+ .anchors:hover{
+ text-decoration: none;
+ }
+}
+.markdown_anchors .anchors {
+ color: inherit;
+ margin-left: -14px;
+ display: none;
}
\ No newline at end of file
From 552522ef389a9b8cea8b607871c273f540198759 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Thu, 6 Apr 2023 09:52:52 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=B1=E4=BA=8C?=
=?UTF-8?q?=E7=BA=A7=E5=AD=90=E9=A1=B5=E9=9D=A2=E5=9B=9E=E5=88=B0wiki?=
=?UTF-8?q?=E4=B8=BB=E9=A1=B5=E9=94=9A=E7=82=B9=E5=A4=B1=E6=95=88=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Wiki/EditWiki.jsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/forge/Wiki/EditWiki.jsx b/src/forge/Wiki/EditWiki.jsx
index a7b4911d1..7a378ce30 100644
--- a/src/forge/Wiki/EditWiki.jsx
+++ b/src/forge/Wiki/EditWiki.jsx
@@ -126,7 +126,8 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
}
function goBack() {
- history.push(`/${owner}/${projectsId}/wiki`);
+ // history.push(`/${owner}/${projectsId}/wiki`);
+ window.location.href = `/${owner}/${projectsId}/wiki`;
}
function changeModal(e) {
From f45217816f6761102f35b57e1880e36075322f3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Thu, 6 Apr 2023 09:56:11 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E5=AF=BC=E5=85=A5wiki=E9=9A=90=E8=97=8F?=
=?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=A4=84=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8E?=
=?UTF-8?q?=E7=BC=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Wiki/Index.jsx | 6 +++---
src/forge/Wiki/fetch.js | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx
index 45309631f..71ee00a04 100644
--- a/src/forge/Wiki/Index.jsx
+++ b/src/forge/Wiki/Index.jsx
@@ -171,10 +171,10 @@ export default (props) => {
const uploadProps = {
name: 'multipartFile',
withCredentials: true,
- action: `${httpUrl}/api/wikiExport/uploadWiki/${owner}/${projectsId}/${project && project.id}`, //?token=${sessionStorage.taskToken}
+ action: `${httpUrl}/api/wikiExport/uploadWiki/${owner}/${projectsId}/${project && project.id}`,
showUploadList: false,
headers: {
- Authorization: cookie.load(TokenKey) || sessionStorage.taskToken,
+ Authorization: cookie.load(TokenKey),
},
beforeUpload: beforeUpload,
onChange(info) {
@@ -248,7 +248,7 @@ export default (props) => {
{ changeItem(item) }}>
- {item.name}
+ {item.name.substring(0, item.name.indexOf('.') !== -1 ? item.name.lastIndexOf('.') : item.name.length-1)}
{permission && { deleteFileModal(e, item) }}>}
diff --git a/src/forge/Wiki/fetch.js b/src/forge/Wiki/fetch.js
index ec3abf870..ef10699b9 100644
--- a/src/forge/Wiki/fetch.js
+++ b/src/forge/Wiki/fetch.js
@@ -8,6 +8,6 @@ let actionUrl = settings && settings.common.wiki;
const service = javaFetch(actionUrl);
export const httpUrl = actionUrl;
export default service;
-
+export const TokenKey = 'autologin_trustie';
From 1acb91286adca0c4b878c598868d549ba62d27e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Thu, 6 Apr 2023 09:57:33 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E6=90=9C=E7=B4=A2wiki=E6=96=87=E4=BB=B6=20?=
=?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=A4=A7=E5=B0=8F=E5=86=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Wiki/Index.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx
index 71ee00a04..2ab1acf0e 100644
--- a/src/forge/Wiki/Index.jsx
+++ b/src/forge/Wiki/Index.jsx
@@ -75,7 +75,7 @@ export default (props) => {
let value = e.target.value;
let newFileArr = [];
for (const item of fileArrInit) {
- if (item.name.indexOf(value) > -1) {
+ if (item.name.match(new RegExp(value, 'i'))) {
newFileArr.push(item);
}
}
From d42793850d85cfd204d8dd3420b750398ce277d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com>
Date: Fri, 7 Apr 2023 10:33:23 +0800
Subject: [PATCH 7/7] =?UTF-8?q?wiki=E4=B8=BB=E9=A1=B5=E5=88=9D=E5=A7=8B?=
=?UTF-8?q?=E5=8C=96=E6=B2=A1=E6=9C=89=E8=AF=86=E5=88=AB=E5=88=B0=E8=B7=AF?=
=?UTF-8?q?=E7=94=B1=E9=87=8C=E7=9A=84wiki?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Wiki/Index.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx
index 2ab1acf0e..43a34bc3d 100644
--- a/src/forge/Wiki/Index.jsx
+++ b/src/forge/Wiki/Index.jsx
@@ -15,12 +15,12 @@ const InputGroup = Input.Group;
const { Option } = Select;
export default (props) => {
- const { match, history, showNotification, project, projectDetail } = props;
+ const { match, history, showNotification, project, projectDetail, history:{location:{pathname}} } = props;
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
let projectsId = match.params.projectsId;
let owner = match.params.owner;
- let wikiName = match.params.wikiName;
+ let wikiName = pathname && pathname.split('/').pop();
const [fileArrInit, setFileArrInit] = useState(null);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});