Skip to content

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

:recycle:

Vanessacc9640833401
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index f3af6ab801..3234974385 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -298,7 +298,9 @@ export const getSelectionPosition = (nodeElement: Element, range?: Range, useDir
const rects = range.getClientRects(); // 由于长度过长折行,光标在行首时有多个 rects https://github.com/siyuan-note/siyuan/issues/6156
if (range.toString()) {
if (useDirect) {
- const selection = window.getSelection();
+ const selection = window.getSelection() as Selection & {
+ direction: "forward" | "backward" | "none"
+ };
// 判断选择方向
const isBackward = (selection && "direction" in selection && selection.direction !== "none") ?
selection.direction === "backward"