From fe9afb40bc2be997d8026154571c82103ec66304 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Fri, 23 Aug 2024 13:39:16 +0200 Subject: [PATCH] webmail: for html-only messages, ensure the "html" button is shown as active instead of both "html" and "html with external resources" being shown as inactive. --- webmail/webmail.js | 4 ++-- webmail/webmail.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webmail/webmail.js b/webmail/webmail.js index fcd4a4e98a..f424f72b80 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -4056,11 +4056,11 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad } else { const text = haveText && (pm.ViewMode == api.ViewMode.ModeText || pm.ViewMode == api.ViewMode.ModeDefault && !settings.showHTML); - dom._kids(msgmodeElem, dom.div(dom._class('pad'), msgHeaderSeparatorStyle, !haveText ? dom.span('HTML-only message', attr.title(htmlNote), msgModeWarningStyle, style({ marginRight: '.25em' })) : [], dom.span(dom._class('btngroup'), haveText ? textbtn = dom.clickbutton(text ? dom._class('active') : [], 'Text', clickCmd(cmdShowText, shortcuts)) : [], htmlbtn = dom.clickbutton(text || pm.ViewMode != api.ViewMode.ModeHTML ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() { + dom._kids(msgmodeElem, dom.div(dom._class('pad'), msgHeaderSeparatorStyle, !haveText ? dom.span('HTML-only message', attr.title(htmlNote), msgModeWarningStyle, style({ marginRight: '.25em' })) : [], dom.span(dom._class('btngroup'), haveText ? textbtn = dom.clickbutton(text ? dom._class('active') : [], 'Text', clickCmd(cmdShowText, shortcuts)) : [], htmlbtn = dom.clickbutton(text || !text && pm.ViewMode == api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() { // Shortcuts has a function that cycles through html and htmlexternal. showShortcut('T'); await cmdShowHTML(); - }), htmlextbtn = dom.clickbutton(text || pm.ViewMode != api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts))))); + }), htmlextbtn = dom.clickbutton(text || !text && pm.ViewMode != api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts))))); if (text) { loadText(pm); } diff --git a/webmail/webmail.ts b/webmail/webmail.ts index a1f378e8ec..1ad20feea9 100644 --- a/webmail/webmail.ts +++ b/webmail/webmail.ts @@ -3548,12 +3548,12 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l !haveText ? dom.span('HTML-only message', attr.title(htmlNote), msgModeWarningStyle, style({marginRight: '.25em'})) : [], dom.span(dom._class('btngroup'), haveText ? textbtn=dom.clickbutton(text ? dom._class('active') : [], 'Text', clickCmd(cmdShowText, shortcuts)) : [], - htmlbtn=dom.clickbutton(text || pm.ViewMode != api.ViewMode.ModeHTML ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() { + htmlbtn=dom.clickbutton(text || !text && pm.ViewMode == api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() { // Shortcuts has a function that cycles through html and htmlexternal. showShortcut('T') await cmdShowHTML() }), - htmlextbtn=dom.clickbutton(text || pm.ViewMode != api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts)), + htmlextbtn=dom.clickbutton(text || !text && pm.ViewMode != api.ViewMode.ModeHTMLExt ? [] : dom._class('active'), 'HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts)), ), ) )