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
2 changed files with 35 additions and 0 deletions

View File

@ -2862,6 +2862,23 @@ const compose = (opts, listMailboxes) => {
}, function change() {
autosizeElem.dataset.value = inputElem.value;
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', {
margin: '0 1px',
borderBottom: '1.5px solid',