Skip to content

Fix Image Lazy Loading Preventing Image ExportΒ #485

@vicksiyi

Description

@vicksiyi

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

The current implementation of lazy loading for images causes issues when exporting content, as the images are not fully loaded and therefore not included in the export. This PR addresses the problem by ensuring that all images are fully loaded before the export process begins.

Here is the diff that solved my problem:

diff --git a/node_modules/dom-to-image/src/dom-to-image.js b/node_modules/dom-to-image/src/dom-to-image.js
index 27201ac..886298c 100644
--- a/node_modules/dom-to-image/src/dom-to-image.js
+++ b/node_modules/dom-to-image/src/dom-to-image.js
@@ -727,6 +727,7 @@
                             element.onload = resolve;
                             element.onerror = reject;
                             element.src = dataUrl;
+                            element.loading = '';
                         });
                     });
             }

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions