Skip to content

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

:bug: table 前或最后一个 cell 三击状态不对

Vanessa2fca1828d83e
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index bb9f0d05ff..cfe6aca0c2 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -12,7 +12,7 @@ import {
focusByWbr,
focusSideBlock,
getEditorRange,
- getSelectionOffset,
+ getSelectionOffset, setLastNodeRange,
} from "../util/selection";
import {Constants} from "../../constants";
import {getSearch, isMobile} from "../../util/functions";
@@ -841,6 +841,21 @@ export class WYSIWYG {
if (range.toString() === "" ||
window.siyuan.shiftIsPressed // https://ld246.com/article/1650096678723
) {
+ if (event.detail === 3) {
+ // table 前或最后一个 cell 三击状态不对
+ let cursorElement = hasClosestBlock(range.startContainer) as Element;
+ if (cursorElement) {
+ if (cursorElement.nextElementSibling?.classList.contains("table")) {
+ setLastNodeRange(getContenteditableElement(cursorElement), range, false)
+ } else if (cursorElement.classList.contains("table")) {
+ const cellElements = cursorElement.querySelectorAll("th, td");
+ cursorElement = cellElements[cellElements.length - 1];
+ if (cursorElement.contains(range.startContainer)) {
+ setLastNodeRange(cursorElement, range, false)
+ }
+ }
+ }
+ }
return;
}
if (selectElement.length > 0) {