Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Image has already been loaded #389

Merged

Conversation

zjhch123
Copy link
Contributor

Description

Sometimes the image has already been loaded and it can't trigger the onload event. So we should check if the image has been loaded before binding the event, and if it has been loaded, we can call setLoaded directly. Otherwise, bind the onload event.

Testing

Take the screenshot as an example:

image

Because epid4.png has already been loaded, so the onload event doesn't be triggered as expected and the DOM shows data-rmiz-content="not-found".

After my change, it works!

image

Please let me know if any questions.

Thanks.

Sometimes the image has already been loaded and it can't trigger the `onload` event. So we should check if the image has been loaded before binding the event, and if it has been loaded, we can call `setLoaded` directly. Otherwise, bind the `onload` event.
@zjhch123
Copy link
Contributor Author

@rpearce
Copy link
Owner

rpearce commented Dec 31, 2022

@zjhch123 Thank you for this contribution! I will look at it when I get time in the next day or two (it is a holiday here).

1 similar comment
@rpearce
Copy link
Owner

rpearce commented Dec 31, 2022

@zjhch123 Thank you for this contribution! I will look at it when I get time in the next day or two (it is a holiday here).

@rpearce
Copy link
Owner

rpearce commented Jan 4, 2023

This is still on my TO DO list. Thanks for the latest commit

@rpearce
Copy link
Owner

rpearce commented Feb 25, 2023

I'm extremely sorry for the delay here. I'm testing this now...

Copy link
Owner

@rpearce rpearce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely change! Thank you for contributing. I'll publish this as a patch release and add you to the contributors!

@rpearce rpearce merged commit d99b52e into rpearce:main Feb 25, 2023
@rpearce
Copy link
Owner

rpearce commented Feb 25, 2023

This has been released in v5.1.3

@zjhch123
Copy link
Contributor Author

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants