From a852654b4585e3201892bd53e0136d42834a4b34 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 15 Jan 2024 15:59:51 +0100 Subject: [PATCH] Fix thumbnail not working anymore --- www/common/common-thumbnail.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/common/common-thumbnail.js b/www/common/common-thumbnail.js index 2298a904a..7dcf55455 100644 --- a/www/common/common-thumbnail.js +++ b/www/common/common-thumbnail.js @@ -230,17 +230,17 @@ define([ Thumb.fromDOM = function (opts, cb) { var element = opts.getContainer(); if (!element) { return; } - var todo = function () { + var todo = function (html2canvas) { + if (!window.html2canvas) { window.html2canvas = html2canvas; } if (opts.filter) { opts.filter(element, true); } window.html2canvas(element, { allowTaint: true, - onrendered: function (canvas) { - if (opts.filter) { opts.filter(element, false); } - setTimeout(function () { - var D = getResizedDimensions(canvas, 'pad'); - Thumb.fromCanvas(canvas, D, cb); - }, 10); - } + }).then(function (canvas) { + if (opts.filter) { opts.filter(element, false); } + setTimeout(function () { + var D = getResizedDimensions(canvas, 'pad'); + Thumb.fromCanvas(canvas, D, cb); + }, 10); }); }; if (window.html2canvas) { return void todo(); }