🐛 table 前或最后一个 cell 三击状态不对
This commit is contained in:
parent
e63c96315b
commit
2fca1828d8
1 changed files with 16 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue