I was testing print functionality, and it can already be added to the contextmenu (the button with three dots in the popup topbar). Basically, create a file _files/js/custom.js
(see Javascript Config docs) with the following content inside:
_c.config = {
contextmenu: {
'print': {
text: 'print',
icon: 'M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z',
condition: (item) => item.browser_image,
action: (item) => {
// inject temporary iframe
document.body.insertAdjacentHTML('beforeend', '<iframe style="height:0;width:0;visibility:hidden;position:absolute;" srcdoc="' + html_quotes('<html><body style="margin:0;"><img style="display:block;margin:0 auto;max-width:100%;page-break-inside:avoid;max-height:100vh;width:auto;"/></body></html>') + '"></iframe>');
// get iframe
var iframe = document.body.lastElementChild;
iframe.addEventListener('load', () => {
var img = iframe.contentDocument.body.firstElementChild;
img.addEventListener('load', () => {
iframe.contentWindow.addEventListener('afterprint', () => iframe.remove());
iframe.contentWindow.print();
});
img.src = item.url_path;
});
}
}
}
}
I am considering adding it as a native button (enabled or disabled by default), but I'm not sure how useful this feature is for the majority of users.