mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 02:18:33 +08:00
11 lines
326 B
Plaintext
11 lines
326 B
Plaintext
|
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];
|
||
|
}
|