Skip to content

Commit

Permalink
feat: #144 挂件版支持统一管理子目录所有文章-链接跳转优化
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 21, 2022
1 parent 804f3d8 commit d8f99ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/blog/themes/default/DefaultPostDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const handlePublish = (e: any) => {
}
const handleNewWinPublish = (e: any) => {
e.preventDefault()
goToPage("/index.html?id=" + props.post?.postid, "/")
goToPage("/publish/index.html?id=" + props.post?.postid, "/")
}
</script>

Expand Down
19 changes: 9 additions & 10 deletions src/lib/browser/ChromeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import {isInFirefoxExtension} from "./FirefoxUtil";
import {inSiyuan} from "../platform/siyuan/siyuanUtil";
import {getQueryString, inBrowser, setUrlParameter} from "../util";
import {getQueryString, inBrowser, pathJoin, setUrlParameter} from "../util";
import logUtil from "../logUtil";

function getPageUrl(pageUrl: string, split?: string) {
Expand All @@ -22,22 +22,21 @@ function getPageUrl(pageUrl: string, split?: string) {
// @ts-ignore
url = chrome.runtime.getURL(url);
} else {
// 思源笔记链接处理
const from = getQueryString("from")
if (inSiyuan() || from == "siyuan") {
if (split && split != "") {
url = "widgets/sy-post-publisher" + url;
} else {
url = "/widgets/sy-post-publisher" + url;
}

url = "/widgets/sy-post-publisher" + url;
url = setUrlParameter(url, "from", "siyuan")
}

// 处理手动分隔符
let baseUrl = window.location.protocol + "//" + window.location.host
if (split && split != "") {
url = window.location.protocol + "//" + window.location.host + split + url;
} else {
url = window.location.protocol + "//" + window.location.host + url;
baseUrl = window.location.protocol + "//" + window.location.host + split
}

// 智能拼接
url = pathJoin(baseUrl, url)
}

logUtil.logWarn("将要打开页面=>", url)
Expand Down

0 comments on commit d8f99ff

Please sign in to comment.