mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
webmail: for html-only messages, also show the "show html with external resources" button
This commit is contained in:
@ -1847,12 +1847,14 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
||||
let textbtn: HTMLButtonElement, htmlbtn: HTMLButtonElement, htmlextbtn: HTMLButtonElement
|
||||
const activeBtn = (b: HTMLButtonElement) => {
|
||||
for (const xb of [textbtn, htmlbtn, htmlextbtn]) {
|
||||
xb.classList.toggle('active', xb === b)
|
||||
if (xb) {
|
||||
xb.classList.toggle('active', xb === b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cmdShowText = async () => {
|
||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
||||
if (!textbtn) {
|
||||
return
|
||||
}
|
||||
loadText(await parsedMessagePromise)
|
||||
@ -1860,14 +1862,14 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
||||
activeBtn(textbtn)
|
||||
}
|
||||
const cmdShowHTML = async () => {
|
||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
||||
if (!htmlbtn || !htmlextbtn) {
|
||||
return
|
||||
}
|
||||
loadHTML()
|
||||
activeBtn(htmlbtn)
|
||||
}
|
||||
const cmdShowHTMLExternal = async () => {
|
||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
||||
if (!htmlbtn || !htmlextbtn) {
|
||||
return
|
||||
}
|
||||
loadHTMLexternal()
|
||||
@ -2296,21 +2298,15 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
||||
} else if (haveText && !pm.HasHTML) {
|
||||
loadText(pm)
|
||||
dom._kids(msgmodeElem)
|
||||
} else if (!haveText && pm.HasHTML) {
|
||||
loadHTML()
|
||||
dom._kids(msgmodeElem,
|
||||
dom.div(dom._class('pad'),
|
||||
style({borderTop: '1px solid #ccc'}),
|
||||
dom.span('HTML-only message', attr.title(htmlNote), style({backgroundColor: '#ffca91', padding: '0 .15em'})),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
const text = haveText && !settings.showHTML
|
||||
dom._kids(msgmodeElem,
|
||||
dom.div(dom._class('pad'),
|
||||
style({borderTop: '1px solid #ccc'}),
|
||||
!haveText ? dom.span('HTML-only message', attr.title(htmlNote), style({backgroundColor: '#ffca91', padding: '0 .15em', marginRight: '.25em'})) : [],
|
||||
dom.span(dom._class('btngroup'),
|
||||
textbtn=dom.clickbutton(settings.showHTML ? [] : dom._class('active'), 'Text', clickCmd(cmdShowText, shortcuts)),
|
||||
htmlbtn=dom.clickbutton(!settings.showHTML ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() {
|
||||
haveText ? textbtn=dom.clickbutton(text ? dom._class('active') : [], 'Text', clickCmd(cmdShowText, shortcuts)) : [],
|
||||
htmlbtn=dom.clickbutton(text ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() {
|
||||
// Shortcuts has a function that cycles through html and htmlexternal.
|
||||
showShortcut('X')
|
||||
await cmdShowHTML()
|
||||
@ -2319,10 +2315,10 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
||||
),
|
||||
)
|
||||
)
|
||||
if (settings.showHTML) {
|
||||
loadHTML()
|
||||
} else {
|
||||
if (text) {
|
||||
loadText(pm)
|
||||
} else {
|
||||
loadHTML()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user