DEV: refactors textarea-selection helper to prevent leaking (#7709)

This commit is contained in:
Joffrey JAFFEUX
2019-06-05 19:20:46 +02:00
committed by GitHub
parent 35d0fd038e
commit de013262a7
5 changed files with 14 additions and 18 deletions

View File

@ -0,0 +1,10 @@
export function setTextareaSelection(textarea, selectionStart, selectionEnd) {
textarea.selectionStart = selectionStart;
textarea.selectionEnd = selectionEnd;
}
export function getTextareaSelection(textarea) {
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
return [start, end - start];
}