From 4cd059a3fc131e67f979fa8c290f907d68499e27 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 31 May 2024 09:50:54 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11593 --- app/src/protyle/wysiwyg/commonHotkey.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index 4ec052c77..959fb5b00 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -1,6 +1,6 @@ import {matchHotKey} from "../util/hotKey"; import {fetchPost} from "../../util/fetch"; -import {writeText} from "../util/compatibility"; +import {isMac, writeText} from "../util/compatibility"; import { focusBlock, getSelectionOffset, @@ -94,7 +94,8 @@ export const upSelect = (options: { options.event.stopPropagation(); options.event.preventDefault(); } else { - if (getSelectionOffset(options.nodeElement, options.editorElement, options.range).start !== 0) { + if (isMac() // Windows 中 ⌥⇧↓ 默认无选中功能会导致 https://ld246.com/article/1716635371149 + && getSelectionOffset(options.nodeElement, options.editorElement, options.range).start !== 0) { const editElement = getContenteditableElement(options.nodeElement); if (editElement.tagName === "TABLE") { const cellElement = hasClosestByMatchTag(options.range.startContainer, "TH") || hasClosestByMatchTag(options.range.startContainer, "TD") || editElement.querySelector("th, td"); @@ -139,7 +140,8 @@ export const downSelect = (options: { options.event.stopPropagation(); options.event.preventDefault(); } else { - if (getSelectionOffset(options.nodeElement, options.editorElement, options.range).end < getContenteditableElement(options.nodeElement).textContent.length) { + if (isMac() // Windows 中 ⌥⇧↑ 默认无选中功能会导致 https://ld246.com/article/1716635371149 + && getSelectionOffset(options.nodeElement, options.editorElement, options.range).end < getContenteditableElement(options.nodeElement).textContent.length) { // 选中下一个节点的处理在 toolbar/index.ts 中 `shift+方向键或三击选中` return; }