An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Improve text selection within PDF rectangle annotations https://github.com/siyuan-note/siyuan/issues/19284
Daniel388db18746f9
diff --git a/app/src/asset/anno.ts b/app/src/asset/anno.tsindex 493e89f9c5..046bbca589 100644--- a/app/src/asset/anno.ts+++ b/app/src/asset/anno.ts@@ -208,8 +208,9 @@ export const initAnno = (element: HTMLElement, pdf: any) => {}const eventTarget = event.target as HTMLElement;const handleElement = eventTarget.closest(".pdf__rect-resize") as HTMLElement;+ const edgeElement = eventTarget.closest(".pdf__rect-edge");const target = eventTarget.closest(".pdf__rect") as HTMLElement;- if (!target || (!handleElement && !isRectAnnotationElement(target))) {+ if (!target || !isRectAnnotationElement(target) || (!handleElement && !edgeElement)) {return;}const direction = handleElement?.dataset.direction as RectResizeDirection;@@ -985,7 +986,15 @@ const showHighlight = (selected: IPdfAnno, pdf: any, hl?: boolean) => {});rectDiv.setAttribute("data-content", selected.content);if (isRectAnnotationElement(rectDiv)) {+ rectDiv.dataset.mode = "rect";rectDiv.style.touchAction = "none";+ Array.from(rectDiv.children).forEach((rectChild: HTMLElement) => {+ ["n", "e", "s", "w"].forEach(direction => {+ const edge = document.createElement("span");+ edge.className = `pdf__rect-edge pdf__rect-edge--${direction}`;+ rectChild.append(edge);+ });+ });}rectsElement.append(rectDiv);if (hl) {diff --git a/app/src/assets/scss/pdf/_pdf.scss b/app/src/assets/scss/pdf/_pdf.scssindex d200a453d7..ac3ba67ee1 100644--- a/app/src/assets/scss/pdf/_pdf.scss+++ b/app/src/assets/scss/pdf/_pdf.scss@@ -90,6 +90,42 @@&[data-mode="rect"] > div {cursor: move;+ pointer-events: none;+ }++ &-edge {+ position: absolute;+ pointer-events: auto;++ &--n,+ &--s {+ left: -2px;+ right: -2px;+ height: 8px;+ }++ &--n {+ top: -5px;+ }++ &--s {+ bottom: -5px;+ }++ &--e,+ &--w {+ top: -2px;+ bottom: -2px;+ width: 8px;+ }++ &--e {+ right: -5px;+ }++ &--w {+ left: -5px;+ }}&--selected > div {