Vanessa 2024-05-31 09:50:54 +08:00
parent 062275f69a
commit 4cd059a3fc

View file

@ -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;
}