This commit is contained in:
Vanessa 2022-09-17 22:04:07 +08:00
parent cd3da736db
commit 772dee2fc7
3 changed files with 9 additions and 2 deletions

View file

@ -116,6 +116,9 @@ export const getEditorRange = (element: Element) => {
targetElement = getContenteditableElement(element);
if (!targetElement) {
targetElement = element;
} else if (targetElement.tagName === "TABLE") {
// 文档中开头为表格,获取错误 https://ld246.com/article/1663408335459?r=88250
targetElement = targetElement.querySelector("th") || element.querySelector("td");
}
}
range = targetElement.ownerDocument.createRange();