|
|
@ -438,15 +438,8 @@ function getWordUntilCaret(ctrl: typeof AntInput) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function GetCaretPosition(ctrl: typeof AntInput) { |
|
|
|
function GetCaretPosition(ctrl: typeof AntInput) { |
|
|
|
let CaretPos = 0 // IE Support
|
|
|
|
let CaretPos = 0 |
|
|
|
if (document) { |
|
|
|
if (ctrl.selectionStart || ctrl.selectionStart === 0) { |
|
|
|
ctrl.focus() |
|
|
|
|
|
|
|
const Sel = document.createRange() as any |
|
|
|
|
|
|
|
Sel.moveStart('character', -ctrl.value.length) |
|
|
|
|
|
|
|
CaretPos = Sel.text.length |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Firefox support
|
|
|
|
|
|
|
|
else if (ctrl.selectionStart || ctrl.selectionStart === '0') { |
|
|
|
|
|
|
|
CaretPos = ctrl.selectionStart |
|
|
|
CaretPos = ctrl.selectionStart |
|
|
|
} |
|
|
|
} |
|
|
|
return CaretPos |
|
|
|
return CaretPos |
|
|
|