mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 12:58:16 +03:00
webmail: for html-only messages, also show the "show html with external resources" button
This commit is contained in:
parent
a4c6fe815f
commit
383eb483df
@ -2397,11 +2397,13 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||||||
let textbtn, htmlbtn, htmlextbtn;
|
let textbtn, htmlbtn, htmlextbtn;
|
||||||
const activeBtn = (b) => {
|
const activeBtn = (b) => {
|
||||||
for (const xb of [textbtn, htmlbtn, htmlextbtn]) {
|
for (const xb of [textbtn, htmlbtn, htmlextbtn]) {
|
||||||
xb.classList.toggle('active', xb === b);
|
if (xb) {
|
||||||
|
xb.classList.toggle('active', xb === b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const cmdShowText = async () => {
|
const cmdShowText = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!textbtn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadText(await parsedMessagePromise);
|
loadText(await parsedMessagePromise);
|
||||||
@ -2409,14 +2411,14 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||||||
activeBtn(textbtn);
|
activeBtn(textbtn);
|
||||||
};
|
};
|
||||||
const cmdShowHTML = async () => {
|
const cmdShowHTML = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!htmlbtn || !htmlextbtn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadHTML();
|
loadHTML();
|
||||||
activeBtn(htmlbtn);
|
activeBtn(htmlbtn);
|
||||||
};
|
};
|
||||||
const cmdShowHTMLExternal = async () => {
|
const cmdShowHTMLExternal = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!htmlbtn || !htmlextbtn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadHTMLexternal();
|
loadHTMLexternal();
|
||||||
@ -2676,21 +2678,18 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||||||
loadText(pm);
|
loadText(pm);
|
||||||
dom._kids(msgmodeElem);
|
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 {
|
else {
|
||||||
dom._kids(msgmodeElem, dom.div(dom._class('pad'), style({ borderTop: '1px solid #ccc' }), 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() {
|
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'), 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.
|
// Shortcuts has a function that cycles through html and htmlexternal.
|
||||||
showShortcut('X');
|
showShortcut('X');
|
||||||
await cmdShowHTML();
|
await cmdShowHTML();
|
||||||
}), htmlextbtn = dom.clickbutton('HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts)))));
|
}), htmlextbtn = dom.clickbutton('HTML with external resources', attr.title(htmlNote), clickCmd(cmdShowHTMLExternal, shortcuts)))));
|
||||||
if (settings.showHTML) {
|
if (text) {
|
||||||
loadHTML();
|
loadText(pm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loadText(pm);
|
loadHTML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messageLoaded();
|
messageLoaded();
|
||||||
|
@ -1847,12 +1847,14 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||||||
let textbtn: HTMLButtonElement, htmlbtn: HTMLButtonElement, htmlextbtn: HTMLButtonElement
|
let textbtn: HTMLButtonElement, htmlbtn: HTMLButtonElement, htmlextbtn: HTMLButtonElement
|
||||||
const activeBtn = (b: HTMLButtonElement) => {
|
const activeBtn = (b: HTMLButtonElement) => {
|
||||||
for (const xb of [textbtn, htmlbtn, htmlextbtn]) {
|
for (const xb of [textbtn, htmlbtn, htmlextbtn]) {
|
||||||
xb.classList.toggle('active', xb === b)
|
if (xb) {
|
||||||
|
xb.classList.toggle('active', xb === b)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmdShowText = async () => {
|
const cmdShowText = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!textbtn) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loadText(await parsedMessagePromise)
|
loadText(await parsedMessagePromise)
|
||||||
@ -1860,14 +1862,14 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||||||
activeBtn(textbtn)
|
activeBtn(textbtn)
|
||||||
}
|
}
|
||||||
const cmdShowHTML = async () => {
|
const cmdShowHTML = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!htmlbtn || !htmlextbtn) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loadHTML()
|
loadHTML()
|
||||||
activeBtn(htmlbtn)
|
activeBtn(htmlbtn)
|
||||||
}
|
}
|
||||||
const cmdShowHTMLExternal = async () => {
|
const cmdShowHTMLExternal = async () => {
|
||||||
if (!textbtn || !htmlbtn || !htmlextbtn) {
|
if (!htmlbtn || !htmlextbtn) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loadHTMLexternal()
|
loadHTMLexternal()
|
||||||
@ -2296,21 +2298,15 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||||||
} else if (haveText && !pm.HasHTML) {
|
} else if (haveText && !pm.HasHTML) {
|
||||||
loadText(pm)
|
loadText(pm)
|
||||||
dom._kids(msgmodeElem)
|
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 {
|
} else {
|
||||||
|
const text = haveText && !settings.showHTML
|
||||||
dom._kids(msgmodeElem,
|
dom._kids(msgmodeElem,
|
||||||
dom.div(dom._class('pad'),
|
dom.div(dom._class('pad'),
|
||||||
style({borderTop: '1px solid #ccc'}),
|
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'),
|
dom.span(dom._class('btngroup'),
|
||||||
textbtn=dom.clickbutton(settings.showHTML ? [] : dom._class('active'), 'Text', clickCmd(cmdShowText, shortcuts)),
|
haveText ? textbtn=dom.clickbutton(text ? dom._class('active') : [], 'Text', clickCmd(cmdShowText, shortcuts)) : [],
|
||||||
htmlbtn=dom.clickbutton(!settings.showHTML ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() {
|
htmlbtn=dom.clickbutton(text ? [] : dom._class('active'), 'HTML', attr.title(htmlNote), async function click() {
|
||||||
// Shortcuts has a function that cycles through html and htmlexternal.
|
// Shortcuts has a function that cycles through html and htmlexternal.
|
||||||
showShortcut('X')
|
showShortcut('X')
|
||||||
await cmdShowHTML()
|
await cmdShowHTML()
|
||||||
@ -2319,10 +2315,10 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (settings.showHTML) {
|
if (text) {
|
||||||
loadHTML()
|
|
||||||
} else {
|
|
||||||
loadText(pm)
|
loadText(pm)
|
||||||
|
} else {
|
||||||
|
loadHTML()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user