From 74fa91e0b381d1eaee188a95620d3ea84ffb5fe3 Mon Sep 17 00:00:00 2001 From: dht-odoo Date: Tue, 15 Feb 2022 12:50:04 +0000 Subject: [PATCH] [IMP] web: open external links (from PDF viewer) in new tab Currently when we click on external links from a PDF opened in our PDF viewer, you are redirected to the link, means you are leaving the record which is not ideal. With this commit, external links in PDF document will be opened in new tab so that the opened record is not lost. For that we need to change the default option of the pdfjs lib, because we cannot pass this parameter in iframe (link of the documentation is available in task pad). For that, we changed the value of 'externalLinkTarget' from 0 (which sets target to NONE) to 2 (which sets target to BLANK) in 'getDefaultPreferences' function. taskID-2752002 closes odoo/odoo#84594 Signed-off-by: Thibault Delavallee (tde) --- addons/web/static/lib/pdfjs/web/viewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/lib/pdfjs/web/viewer.js b/addons/web/static/lib/pdfjs/web/viewer.js index 54f95117ab9..3824f59c6af 100644 --- a/addons/web/static/lib/pdfjs/web/viewer.js +++ b/addons/web/static/lib/pdfjs/web/viewer.js @@ -13913,9 +13913,9 @@ function getDefaultPreferences() { "disablePageLabels": false, "enablePrintAutoRotate": false, "enableWebGL": false, - // Odoo: This change is needed here as we can't change this parameter in an iframe. + // Odoo: Below two preference changes are needed here as we can't change them as parameters in an iframe. "eventBusDispatchToDOM": true, - "externalLinkTarget": 0, + "externalLinkTarget": 2, "historyUpdateUrl": false, "pdfBugEnabled": false, "renderer": "canvas",