From 9bc860e2076f92ae94e6cb5b7462014f95808c88 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Thu, 21 Sep 2023 11:40:22 +0200 Subject: [PATCH] webmail: make double click on mailbox expand/collapse, and make mailbox text unselectable (so the double click doesn't also select text) --- webmail/webmail.html | 2 +- webmail/webmail.js | 10 ++++++++++ webmail/webmail.ts | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/webmail/webmail.html b/webmail/webmail.html index 9067cc5..834d7a6 100644 --- a/webmail/webmail.html +++ b/webmail/webmail.html @@ -49,7 +49,7 @@ table.search td { padding: .25em; } .keyword { background-color: gold; color: black; border: 1px solid #8c7600; padding: 0 .15em; border-radius: .15em; font-weight: normal; font-size: .9em; margin: 0 .15em; white-space: nowrap; } .keyword.keywordcollapsed { background-color: #ffeb7e; color: #333; } .mailbox { padding: .15em .25em; } -.mailboxitem { cursor: pointer; border-radius: .15em; } +.mailboxitem { cursor: pointer; border-radius: .15em; user-select: none; } .mailboxitem.dropping { background: gold !important; } .mailboxitem:hover { background: #eee; } .mailboxitem.active { background: linear-gradient(135deg, #ffc7ab 0%, #ffdeab 100%); } diff --git a/webmail/webmail.js b/webmail/webmail.js index ce800bb..5e559a8 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -4300,6 +4300,16 @@ const newMailboxView = (xmb, mailboxlistView, otherMailbox) => { else if (e.key === 'b') { cmdOpenActions(); } + }, async function dblclick() { + if (mailboxlistView.mailboxLeaf(mbv)) { + return; + } + if (settings.mailboxCollapsed[mbv.mailbox.ID]) { + cmdExpand(); + } + else { + cmdCollapse(); + } }, async function click() { mbv.root.focus(); await withStatus('Opening mailbox', mbv.open(true)); diff --git a/webmail/webmail.ts b/webmail/webmail.ts index dbac731..0da21e6 100644 --- a/webmail/webmail.ts +++ b/webmail/webmail.ts @@ -4157,6 +4157,16 @@ const newMailboxView = (xmb: api.Mailbox, mailboxlistView: MailboxlistView, othe cmdOpenActions() } }, + async function dblclick() { + if (mailboxlistView.mailboxLeaf(mbv)) { + return + } + if (settings.mailboxCollapsed[mbv.mailbox.ID]) { + cmdExpand() + } else { + cmdCollapse() + } + }, async function click() { mbv.root.focus() await withStatus('Opening mailbox', mbv.open(true))