discourse/test/javascripts/helpers/textarea-selection-helper.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
326 B
JavaScript
Raw Normal View History

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