-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix image decode * Target correct element * Fix tab navigation when product is on Canvas * Xit test and do a follow-up
- Loading branch information
Showing
4 changed files
with
21 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
diff --git a/node_modules/html-to-image/es/embed-images.js b/node_modules/html-to-image/es/embed-images.js | ||
index 70e8468..c8db1a5 100644 | ||
index 70e8468..e04eb19 100644 | ||
--- a/node_modules/html-to-image/es/embed-images.js | ||
+++ b/node_modules/html-to-image/es/embed-images.js | ||
@@ -21,7 +21,7 @@ async function embedImageNode(clonedNode, options) { | ||
@@ -21,7 +21,6 @@ async function embedImageNode(clonedNode, options) { | ||
: clonedNode.href.baseVal; | ||
const dataURL = await resourceToDataURL(url, getMimeType(url), options); | ||
await new Promise((resolve, reject) => { | ||
- clonedNode.onload = resolve; | ||
+ clonedNode.decode = resolve; | ||
clonedNode.onerror = reject; | ||
if (clonedNode instanceof HTMLImageElement) { | ||
clonedNode.srcset = ''; | ||
@@ -30,6 +29,7 @@ async function embedImageNode(clonedNode, options) { | ||
else { | ||
clonedNode.href.baseVal = dataURL; | ||
} | ||
+ clonedNode.decode().then(() => resolve(clonedNode)).catch(reject); | ||
}); | ||
} | ||
async function embedChildren(clonedNode, options) { | ||
diff --git a/node_modules/html-to-image/es/util.js b/node_modules/html-to-image/es/util.js | ||
index d3f734b..e3667ef 100644 | ||
index d3f734b..95098d8 100644 | ||
--- a/node_modules/html-to-image/es/util.js | ||
+++ b/node_modules/html-to-image/es/util.js | ||
@@ -136,7 +136,7 @@ export function canvasToBlob(canvas, options = {}) { | ||
@@ -136,11 +136,11 @@ export function canvasToBlob(canvas, options = {}) { | ||
export function createImage(url) { | ||
return new Promise((resolve, reject) => { | ||
const img = new Image(); | ||
- img.onload = () => resolve(img); | ||
+ img.decode = () => resolve(img); | ||
img.onerror = reject; | ||
img.crossOrigin = 'anonymous'; | ||
img.decoding = 'sync'; | ||
img.src = url; | ||
+ img.decode().then(() => resolve(img)).catch(reject); | ||
}); | ||
} | ||
export async function svgToDataURL(svg) { |