This commit is contained in:
Vanessa 2023-12-13 12:16:45 +08:00
parent d61ee623f9
commit 6d8b14bbf3
2 changed files with 15 additions and 1 deletions

View file

@ -6,7 +6,7 @@ import * as dayjs from "dayjs";
import {unicode2Emoji} from "../../../emoji";
import {focusBlock} from "../../util/selection";
import {isMac} from "../../util/compatibility";
import {hasClosestByClassName} from "../../util/hasClosest";
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {stickyRow} from "./row";
import {getCalcValue} from "./calc";
@ -303,6 +303,16 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
focusBlock(e);
}
}
if (getSelection().rangeCount > 0) {
// 修改表头后光标重新定位
const range = getSelection().getRangeAt(0)
if (!hasClosestByClassName(range.startContainer, "av__title")) {
const blockElement = hasClosestBlock(range.startContainer)
if (blockElement && e.isSameNode(blockElement)) {
focusBlock(e);
}
}
}
e.querySelector(".layout-tab-bar").scrollLeft = (e.querySelector(".layout-tab-bar .item--focus") as HTMLElement).offsetLeft;
if (cb) {
cb();