- anchorElement: canvas.getDocumentElement(nativeSelection.anchorNode),
- anchorOffset: nativeSelection.anchorOffset,
- focusElement: canvas.getDocumentElement(nativeSelection.focusNode),
- focusOffset: nativeSelection.focusOffset
+ anchorElement: anchorElement,
+ anchorOffset: anchorElement.isEmpty() ? 0 : nativeSelection.anchorOffset,
+ focusElement: focusElement,
+ focusOffset: focusElement.isEmpty() ? 0 : nativeSelection.focusOffset