diff --git a/source/range/Boundaries.ts b/source/range/Boundaries.ts index 4e289ad7..8fb38208 100644 --- a/source/range/Boundaries.ts +++ b/source/range/Boundaries.ts @@ -158,8 +158,13 @@ const moveRangeBoundariesUpTree = ( range.setStart(startContainer, startOffset); - if (startContainer instanceof HTMLElement && !startContainer.isContentEditable) { - range.setStart(endContainer, endOffset); + let node = startContainer; + while (isInline(node)) { + if (node instanceof HTMLElement && !node.isContentEditable) { + range.setStart(endContainer, endOffset); + break; + } + node = node.parentNode!; } range.setEnd(endContainer, endOffset);