In Chrome in some scenarios native Selection indicates that focusOffset
is 1 even if a range that was just set in Cavnas._moveCaretToTextElement
had an offset of 0. Range returned by Selection indicates a correct
value.
params = {
type: 'caret',
element: element,
- offset: element.isEmpty() ? 0 : nativeSelection.focusOffset
+ offset: element.isEmpty() ? 0 : nativeSelection.getRangeAt(0).startOffset
};
} else if(isText(nativeSelection.focusNode) && isText(nativeSelection.anchorNode)) {
anchorElement = canvas.getDocumentElement(nativeSelection.anchorNode);