Fix safari issue in positioning text editor cursor

This commit is contained in:
Paulo Gustavo Veiga 2022-04-09 23:46:32 -03:00
parent eb79dab117
commit bb2b65ef47

View File

@ -246,12 +246,12 @@ class MultilineTextEditor extends Events {
private _positionCursor(textareaElem: JQuery<HTMLTextAreaElement>, selectText: boolean) {
textareaElem.focus();
const lengh = this._getTextAreaText().length;
const { length } = this._getTextAreaText();
if (selectText) {
// Mark text as selected ...
textareaElem[0].setSelectionRange(0, lengh);
textareaElem[0].setSelectionRange(0, length);
} else {
textareaElem.focus();
textareaElem[0].setSelectionRange(length, length);
}
}