Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/8152

Vanessa7f2d191c6720
diff --git a/app/src/asset/anno.ts b/app/src/asset/anno.ts
index 35423eb3d3..e3639b7d3c 100644
--- a/app/src/asset/anno.ts
+++ b/app/src/asset/anno.ts
@@ -320,11 +320,14 @@ const getHightlightCoordsByRange = (pdf: any, color: string) => {
if (item.tagName === "BR" && item.previousElementSibling && item.nextElementSibling) {
const previousText = item.previousElementSibling.textContent;
const nextText = item.nextElementSibling.textContent;
- if (previousText.endsWith("-") && /^[A-Za-z]$/.test(previousText.substring(previousText.length - 2, previousText.length - 1)) &&
+ if (/^[A-Za-z]$/.test(previousText.substring(previousText.length - 2, previousText.length - 1)) &&
/^[A-Za-z]$/.test(nextText.substring(0, 1))) {
- item.previousElementSibling.textContent = previousText.substring(0, previousText.length - 1);
- } else {
- item.insertAdjacentText("afterend", " ");
+ if (previousText.endsWith("-")) {
+ item.previousElementSibling.textContent = previousText.substring(0, previousText.length - 1);
+ } else {
+ // 中文情况不能添加 https://github.com/siyuan-note/siyuan/issues/8152
+ item.insertAdjacentText("afterend", " ");
+ }
}
}
});