1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 10:22:46 +00:00

Fix published wiki url when switch to page (#6953)

* delete useless css

* fix URL when switch page in published Wiki
This commit is contained in:
Michael An
2024-10-28 17:24:09 +08:00
committed by GitHub
parent 04bbb9080e
commit 285f98a729
2 changed files with 12 additions and 10 deletions

View File

@@ -10,8 +10,6 @@
} }
.detail-body .detail-image-thumbnail .thumbnail { .detail-body .detail-image-thumbnail .thumbnail {
height: 100%;
width: 100%;
border: 0; border: 0;
border-radius: 0; border-radius: 0;
float: none; float: none;

View File

@@ -53,14 +53,16 @@ class Wiki extends Component {
this.getWikiConfig(); this.getWikiConfig();
} }
handlePath = () => { getCustomUrl = () => {
const custom_url = window.location.pathname.substring(1); const siteRootLen = siteRoot.length;
if (custom_url.includes('wiki/publish')) { const customUrl = window.location.pathname.substring(siteRootLen);
return custom_url; if (customUrl.includes('wiki/publish')) {
return customUrl;
} }
return isWiki2 ? 'wikis/' : 'published/'; return isWiki2 ? 'wikis/' : 'published/';
}; };
getWikiConfig = () => { getWikiConfig = () => {
let wikiAPIConfig; let wikiAPIConfig;
if (wikiPermission === 'public') { if (wikiPermission === 'public') {
@@ -171,11 +173,13 @@ class Wiki extends Component {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
params.set('page_id', pageId); params.set('page_id', pageId);
let fileUrl = `${siteRoot}${this.handlePath()}${wikiId}/?${params.toString()}`;
if (this.handlePath().includes('wiki/publish')) { let customUrl = this.getCustomUrl();
fileUrl = `${siteRoot}${this.handlePath()}?${params.toString()}`; let url = `${siteRoot}${customUrl}${wikiId}/?${params.toString()}`;
if (customUrl.includes('wiki/publish')) {
url = `${siteRoot}${customUrl}?${params.toString()}`;
} }
window.history.pushState({ url: fileUrl, path: filePath }, filePath, fileUrl); window.history.pushState({ url: url, path: filePath }, filePath, url);
}; };
cacheHistoryFiles = (docUuid, name, pageId) => { cacheHistoryFiles = (docUuid, name, pageId) => {