This commit is contained in:
Vanessa 2022-10-10 11:15:00 +08:00
parent 395223d701
commit 92a1af3b7f

View File

@ -305,6 +305,10 @@ export const setFirstNodeRange = (editElement: Element, range: Range) => {
}
let firstChild = editElement.firstChild as HTMLElement;
while (firstChild && firstChild.nodeType !== 3 && !firstChild.classList.contains("render-node")) {
if (firstChild.classList.contains("img")) { // https://ld246.com/article/1665360254842
range.setStartBefore(firstChild);
return range;
}
firstChild = firstChild.firstChild as HTMLElement;
}
if (!firstChild) {