Skip to content

Commit

Permalink
Split paste into addr field by commas
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfbacon committed Nov 23, 2024
1 parent 32d4e9a commit 501f594
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions webmail/webmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
18 changes: 18 additions & 0 deletions webmail/webmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,24 @@ const compose = (opts: ComposeOptions, listMailboxes: listMailboxes) => {
autosizeElem.dataset.value = inputElem.value
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(
css('securitybar', {
Expand Down

0 comments on commit 501f594

Please sign in to comment.