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

Image failed to display with this plugin #111

Closed
khoint0210 opened this issue Sep 17, 2019 · 5 comments
Closed

Image failed to display with this plugin #111

khoint0210 opened this issue Sep 17, 2019 · 5 comments

Comments

@khoint0210
Copy link

Issue

After decrypting the article the image not show up

Expected Behavior

Should show image

Actual Behavior

Not show up

Steps to Reproduce the Problem

Not yet

Specifications

below is the tag without enable plugin
image

below is the tag with an enabled plugin
image

(The version of the project, operating system, hardware etc.)
I'm using the Hexo theme

@D0n9X1n
Copy link
Owner

D0n9X1n commented Sep 18, 2019

Can you provide your theme link on github? Make sure we can reproduce the problem.

It looks like your theme use lazyload to fetch images.

@khoint0210
Copy link
Author

Oh yes, my theme is using lazyload so it would conflict with this plugin?

@khoint0210
Copy link
Author

@D0n9X1n
Copy link
Owner

D0n9X1n commented Sep 18, 2019

Yes, for now. We try to find a good way to support such functionality.

You can add the following code to https://github.com/MikeCoder/hexo-blog-encrypt/blob/1a9073258567a56514cf0363e4f24eafe2ca4482/lib/blog-encrypt.js#L187 for temporary fix.

      document.getElementById('hexo-blog-encrypt').appendChild(await convertHTMLToElement(decoded));
      document.getElementById('hexo-blog-encrypt').appendChild(hideButton);

      // add code here
      document.querySelectorAll('img').forEach((elem) => {
        if (elem.getAttribute("data-src") && !elem.src) {
          elem.src = elem.getAttribute('data-src');
        }
      });
      //=======

      // TOC part
      var tocDiv = document.getElementById("toc-div");
      if (tocDiv) {
        tocDiv.style.display = 'inline';
      }

@D0n9X1n
Copy link
Owner

D0n9X1n commented Sep 18, 2019

Or try to update plugin to v3.0.3.

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

No branches or pull requests

2 participants