🐛 修复解析&渲染异常

This commit is contained in:
目棃
2024-08-26 12:47:03 +08:00
parent fe003d42da
commit f83576a689
2 changed files with 9 additions and 1 deletions

View File

@@ -63,6 +63,7 @@ import { createTGWindow } from "../../utils/TGWindow.js";
import { AnnoLang, AnnoServer } from "../../web/request/getAnno.js";
import TGRequest from "../../web/request/TGRequest.js";
import TGUtils from "../../web/utils/TGUtils.js";
import { decodeRegExp } from "../../web/utils/tools.js";
// 服务器名称-服务器对应
type AnnoServerMap = {
@@ -206,7 +207,8 @@ function getAnnoTime(content: string): string | false {
if (content.match(regexes[2])) {
const res = content.match(regexes[2]);
if (res?.[1]?.match(/\d\.\d/)) {
return `${res?.[1]}版本更新后 ~ ${res?.[2]}`;
const parser = new DOMParser().parseFromString(decodeRegExp(res[2]), "text/html");
return `${res?.[1]}版本更新后 ~ ${parser.body.innerText}`;
}
return `${res?.[1]} ~ ${res?.[2]}`;
}

View File

@@ -257,6 +257,12 @@ function parseAnnoParagraph(
children: res,
};
}
if (child.tagName === "T") {
return {
insert: "",
children: parseAnnoNode(child),
};
}
return defaultRes;
}
const res: TGApp.Plugins.Mys.SctPost.Base = {