mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
fix(parser): 更改跳转逻辑,后续看看能不能搞个新窗口出来
This commit is contained in:
@@ -104,9 +104,15 @@ function LinkTextParser(data: PostStructuredContent): HTMLSpanElement {
|
|||||||
icon.classList.add("mdi", "mdi-link-variant");
|
icon.classList.add("mdi", "mdi-link-variant");
|
||||||
// 创建链接
|
// 创建链接
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
|
const link_url = data.attributes.link;
|
||||||
link.classList.add("mys-post-link");
|
link.classList.add("mys-post-link");
|
||||||
link.href = data.attributes.link;
|
if (link_url.startsWith("https://www.miyoushe.com/ys/article/")) {
|
||||||
link.target = "view_window";
|
link.href = "/post_detail/" + link_url.split("/").pop();
|
||||||
|
link.target = "_self";
|
||||||
|
} else {
|
||||||
|
link.href = link_url;
|
||||||
|
link.target = "view_window";
|
||||||
|
}
|
||||||
link.innerText = data.insert;
|
link.innerText = data.insert;
|
||||||
// 插入图标作为链接前缀
|
// 插入图标作为链接前缀
|
||||||
link.prepend(icon);
|
link.prepend(icon);
|
||||||
|
|||||||
Reference in New Issue
Block a user