mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-31 20:41:05 +08:00
fix(print): Add print button to preview, don't print immediately (Fixes #1352)
This commit is contained in:
parent
9f8f1750cc
commit
5c8c139965
3 changed files with 33 additions and 7 deletions
|
@ -26,6 +26,9 @@ export default class PrintWindow {
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="print-header">
|
<div id="print-header">
|
||||||
|
<div onClick="continueAndPrint()" id="print-button">
|
||||||
|
Print
|
||||||
|
</div>
|
||||||
<div class="logo-wrapper">
|
<div class="logo-wrapper">
|
||||||
<img src="${imgPath}" alt="nylas-logo"/>
|
<img src="${imgPath}" alt="nylas-logo"/>
|
||||||
<span class="account">${account.name} <${account.email}></span>
|
<span class="account">${account.name} <${account.email}></span>
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
body {
|
body {
|
||||||
overflow: auto !important;
|
overflow: auto !important;
|
||||||
}
|
}
|
||||||
|
#print-button {
|
||||||
|
float:right;
|
||||||
|
margin-left: 10px;
|
||||||
|
|
||||||
|
/* From main button styles: */
|
||||||
|
padding: 0 0.8em;
|
||||||
|
border-radius: 3px;
|
||||||
|
display: inline-block;
|
||||||
|
height: 1.9em;
|
||||||
|
line-height: 1.9em;
|
||||||
|
font-size: 13.02px;
|
||||||
|
cursor: default;
|
||||||
|
color: #231f20;
|
||||||
|
position: relative;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 500;
|
||||||
|
background: linear-gradient(to bottom, #6bb1f9 0%, #0a80ff 100%);
|
||||||
|
box-shadow: none;
|
||||||
|
border: 1px solid #3878fa;
|
||||||
|
}
|
||||||
#print-header {
|
#print-header {
|
||||||
padding: 15px 20px 0 20px;
|
padding: 15px 20px 0 20px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,20 @@
|
||||||
removeClassFromNodes(scrollContentInners, 'scroll-region-content-inner');
|
removeClassFromNodes(scrollContentInners, 'scroll-region-content-inner');
|
||||||
}
|
}
|
||||||
|
|
||||||
function print() {
|
function continueAndPrint() {
|
||||||
window.print();
|
document.getElementById('print-button').style.display = 'none';
|
||||||
// Close this print window after selecting to print
|
window.requestAnimationFrame(function() {
|
||||||
// This is really hackish but appears to be the only working solution
|
window.print();
|
||||||
setTimeout(window.close, 500);
|
// Close this print window after selecting to print
|
||||||
|
// This is really hackish but appears to be the only working solution
|
||||||
|
setTimeout(window.close, 500);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageNodes = document.querySelectorAll('.message-item-area>span');
|
var messageNodes = document.querySelectorAll('.message-item-area>span');
|
||||||
|
|
||||||
removeScrollClasses();
|
removeScrollClasses();
|
||||||
rebuildMessages(messageNodes, window.printMessages);
|
rebuildMessages(messageNodes, window.printMessages);
|
||||||
// Give it a few ms before poppint out the print dialog
|
|
||||||
setTimeout(print, 50);
|
window.continueAndPrint = continueAndPrint;
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue