mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
This commit is contained in:
parent
d4af0d0342
commit
62cbcf63e5
1 changed files with 13 additions and 1 deletions
|
|
@ -383,7 +383,19 @@ const getHightlightCoordsByRange = (pdf: any, color: string) => {
|
|||
return;
|
||||
}
|
||||
const endIndex = parseInt(endPageElement.getAttribute("data-page-number")) - 1;
|
||||
const content = Lute.EscapeHTMLStr(range.toString());
|
||||
// https://github.com/siyuan-note/siyuan/issues/5213
|
||||
const rangeContents = range.cloneContents()
|
||||
Array.from(rangeContents.children).forEach(item => {
|
||||
if (item.tagName === "BR") {
|
||||
const previousText = item.previousElementSibling.textContent
|
||||
if (previousText.endsWith("-")) {
|
||||
item.previousElementSibling.textContent = previousText.substring(0, previousText.length - 1)
|
||||
} else {
|
||||
item.insertAdjacentText("afterend", " ");
|
||||
}
|
||||
}
|
||||
});
|
||||
const content = Lute.EscapeHTMLStr(rangeContents.textContent);
|
||||
|
||||
const startPage = pdf.pdfViewer.getPageView(startIndex);
|
||||
const startPageRect = startPage.canvas.getClientRects()[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue