From 2b65959cdc9bba1f8c3dbbf6fb4e4871934319c6 Mon Sep 17 00:00:00 2001 From: "Mahdi Cheikh Rouhou (macr)" Date: Fri, 5 Jan 2024 15:57:16 +0100 Subject: [PATCH] [FIX] web_editor: sign documents with safari 15.4+ with ios Issue: ===== Users with IOS can't sign with safari. Steps to reproduce the issue: ============================= - Install sign - Make sure you have a template which has at least one signature sign item. - Share the document and open the link with ios on safari in v 15.4+ (browserstack) for example. - Go to the signature sign item and use auto and click sign or sign all - Nothing will happen. Origin of the issue: ==================== https://github.com/niklasvh/html2canvas/issues/2864 Solution: ========= https://github.com/niklasvh/html2canvas/issues/2864#issuecomment-1111044861 opw-3660682 closes odoo/odoo#149903 X-original-commit: f11723f406f2af95090bdd13e9acb30c89014638 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/web_editor/static/lib/html2canvas.js | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/addons/web_editor/static/lib/html2canvas.js b/addons/web_editor/static/lib/html2canvas.js index ed7442b0dd8..023f9b2c8c0 100644 --- a/addons/web_editor/static/lib/html2canvas.js +++ b/addons/web_editor/static/lib/html2canvas.js @@ -5603,15 +5603,19 @@ return reject("No window assigned for iframe"); } var documentClone = cloneWindow.document; - cloneWindow.onload = iframe.onload = function () { - cloneWindow.onload = iframe.onload = null; - var interval = setInterval(function () { - if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') { - clearInterval(interval); - resolve(iframe); - } - }, 50); - }; + /* + ODOO Patch for safari v 15.4+ in ios: onload is never called. + Issue link: https://github.com/niklasvh/html2canvas/issues/2864 + Suggested change: https://github.com/niklasvh/html2canvas/issues/2864#issuecomment-1111044861 + Version that solves the issue: not available yet + */ + var interval = setInterval(function () { + if (documentClone.body.childNodes.length > 0 && (documentClone.readyState === 'complete' || documentClone.readyState === 'interactive')) { + clearInterval(interval); + resolve(iframe); + } + }, 50); + // End patch }); }; var ignoredStyleProperties = [