Split paste into addr field by commas

This commit is contained in:
Matt Fellenz 2024-11-23 14:39:54 +01:00
parent 32d4e9a14c
commit 501f594a0a
No known key found for this signature in database
GPG key ID: DCBCE4091A4F9434
2 changed files with 35 additions and 0 deletions

View file

@ -2862,6 +2862,23 @@ const compose = (opts, listMailboxes) => {
}, function change() { }, function change() {
autosizeElem.dataset.value = inputElem.value; autosizeElem.dataset.value = inputElem.value;
fetchRecipientSecurity(); fetchRecipientSecurity();
}, function paste(e) {
const data = e.clipboardData?.getData('text/plain');
if (typeof data !== 'string' || data === '') {
return;
}
const split = data.split(',');
if (split.length <= 1) {
return;
}
autosizeElem.dataset.value = inputElem.value = split[0];
let last;
for (const rest of split.splice(1)) {
last = newAddrView(rest.trim(), isRecipient, views, btn, cell, row, single);
}
last.input.focus();
e.preventDefault();
e.stopPropagation();
}), securityBar = dom.span(css('securitybar', { }), securityBar = dom.span(css('securitybar', {
margin: '0 1px', margin: '0 1px',
borderBottom: '1.5px solid', borderBottom: '1.5px solid',

View file

@ -1785,6 +1785,24 @@ const compose = (opts: ComposeOptions, listMailboxes: listMailboxes) => {
autosizeElem.dataset.value = inputElem.value autosizeElem.dataset.value = inputElem.value
fetchRecipientSecurity() fetchRecipientSecurity()
}, },
function paste(e: ClipboardEvent) {
const data = e.clipboardData?.getData('text/plain')
if (typeof data !== 'string' || data === '') {
return
}
const split = data.split(',')
if (split.length <= 1) {
return
}
autosizeElem.dataset.value = inputElem.value = split[0]
let last
for (const rest of split.splice(1)) {
last = newAddrView(rest.trim(), isRecipient, views, btn, cell, row, single)
}
last!!.input.focus()
e.preventDefault()
e.stopPropagation()
},
), ),
securityBar=dom.span( securityBar=dom.span(
css('securitybar', { css('securitybar', {