Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/5213

Vanessacccd44c00c98
diff --git a/app/src/asset/anno.ts b/app/src/asset/anno.ts
index d53deb72ba..f5817fa7f1 100644
--- a/app/src/asset/anno.ts
+++ b/app/src/asset/anno.ts
@@ -314,7 +314,7 @@ const getHightlightCoordsByRange = (pdf: any, color: string) => {
// https://github.com/siyuan-note/siyuan/issues/5213
const rangeContents = range.cloneContents();
Array.from(rangeContents.children).forEach(item => {
- if (item.tagName === "BR") {
+ 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)) &&