discourse/test/javascripts/helpers/textarea-selection-helper.js
2020-03-26 12:25:46 -04:00

11 lines
326 B
JavaScript

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];
}