diff --git a/webmail/webmail.js b/webmail/webmail.js index 7a0074c..1565be4 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -5499,6 +5499,17 @@ const newMailboxView = (xmb, mailboxlistView, otherMailbox) => { remove(); const mailboxIDs = [mbv.mailbox.ID, ...mailboxlistView.mailboxes().filter(mb => mb.Name.startsWith(mbv.mailbox.Name + '/')).map(mb => mb.ID)]; await withStatus('Marking mailboxes as read', client.MailboxesMarkRead(mailboxIDs)); + })), dom.div(dom.clickbutton('Create mailbox', attr.title('Create new mailbox within this mailbox.'), function click(e) { + let fieldset; + let name; + const ref = e.target; + const removeCreate = popover(ref, {}, dom.form(async function submit(e) { + e.preventDefault(); + await withStatus('Creating mailbox', client.MailboxCreate(mbv.mailbox.Name + '/' + name.value), fieldset); + removeCreate(); + }, fieldset = dom.fieldset(dom.label('Name ', name = dom.input(attr.required('yes'))), ' ', dom.submitbutton('Create')))); + remove(); + name.focus(); })), dom.div(dom.clickbutton('Move to trash', attr.title('Move mailbox, its messages and its mailboxes to the trash.'), async function click() { if (!trashmb) { window.alert('No mailbox configured for trash yet.'); diff --git a/webmail/webmail.ts b/webmail/webmail.ts index 2cb6a20..190fe03 100644 --- a/webmail/webmail.ts +++ b/webmail/webmail.ts @@ -5156,6 +5156,32 @@ const newMailboxView = (xmb: api.Mailbox, mailboxlistView: MailboxlistView, othe await withStatus('Marking mailboxes as read', client.MailboxesMarkRead(mailboxIDs)) }), ), + dom.div( + dom.clickbutton('Create mailbox', attr.title('Create new mailbox within this mailbox.'), function click(e: MouseEvent) { + let fieldset: HTMLFieldSetElement + let name: HTMLInputElement + const ref = e.target! as HTMLElement + const removeCreate = popover(ref, {}, + dom.form( + async function submit(e: SubmitEvent) { + e.preventDefault() + await withStatus('Creating mailbox', client.MailboxCreate(mbv.mailbox.Name + '/' + name.value), fieldset) + removeCreate() + }, + fieldset=dom.fieldset( + dom.label( + 'Name ', + name=dom.input(attr.required('yes')), + ), + ' ', + dom.submitbutton('Create'), + ), + ), + ) + remove() + name.focus() + }), + ), dom.div( dom.clickbutton('Move to trash', attr.title('Move mailbox, its messages and its mailboxes to the trash.'), async function click() { if (!trashmb) {