mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 11:46:16 +00:00
12 lines
359 B
JavaScript
12 lines
359 B
JavaScript
const editTextarea = document.getElementsByClassName('edit-form__textarea')[0]
|
|
|
|
function insertTextAtCursor(text, el = editTextarea) {
|
|
const [start, end] = [el.selectionStart, el.selectionEnd];
|
|
el.setRangeText(text, start, end, 'select');
|
|
}
|
|
|
|
function insertDate() {
|
|
let date = new Date().toISOString().split('T')[0]
|
|
insertTextAtCursor(date)
|
|
}
|