From 9a445afffefd9bedd8886bc8d241c0354caeead0 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Tue, 3 Aug 2021 06:59:21 +0000 Subject: [PATCH] [FIX] web: pdfjs: restore download button in attachment viewer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to the following PR: https://github.com/odoo/odoo/pull/70092 the download icon wasn't present in the document viewer. We had to do this to avoid crash in mobile apps (Android and iOS). But even if there are multiple other ways to download file, some of our users are used to use pdf js download button that was previously hidden. So in this commit, we restore it on desktop as we can now correctly handle the error on Android tablets and hide this button on iOS tablets. Note that pdfjs button is not needed on mobile as we doesnt' have attachements preview on small screens. Another button is available when you open the file. Steps to reproduce: - Go to Accounting - Customer Invoices - After printing it once, the download icon wasn't present in pdfjs preview closes odoo/odoo#74675 X-original-commit: 036c2475ac5c9ae3a0692486badfceb45de1f52b Signed-off-by: Adrien Dieudonné (adr) --- addons/web/static/src/legacy/js/libs/pdfjs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/legacy/js/libs/pdfjs.js b/addons/web/static/src/legacy/js/libs/pdfjs.js index 015983fc5dc..c3dbc0fcde1 100644 --- a/addons/web/static/src/legacy/js/libs/pdfjs.js +++ b/addons/web/static/src/legacy/js/libs/pdfjs.js @@ -16,12 +16,12 @@ import config from 'web.config'; export function hidePDFJSButtons(rootElement) { const cssStyle = document.createElement("style"); cssStyle.rel = "stylesheet"; - cssStyle.innerHTML = `button#secondaryDownload.secondaryToolbarButton, button#download.toolbarButton, -button#secondaryOpenFile.secondaryToolbarButton, button#openFile.toolbarButton { + cssStyle.innerHTML = `button#secondaryOpenFile.secondaryToolbarButton, button#openFile.toolbarButton { display: none !important; }`; if (config.device.isMobileDevice) { cssStyle.innerHTML = `${cssStyle.innerHTML} +button#secondaryDownload.secondaryToolbarButton, button#download.toolbarButton, button#secondaryPrint.secondaryToolbarButton, button#print.toolbarButton{ display: none !important; }`;