mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 08:41:56 +08:00
DEV: refactors textarea-selection helper to prevent leaking (#7709)
This commit is contained in:
10
test/javascripts/helpers/textarea-selection-helper.js.es6
Normal file
10
test/javascripts/helpers/textarea-selection-helper.js.es6
Normal 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];
|
||||
}
|
Reference in New Issue
Block a user