hugo-embed-pdf-shortcode icon indicating copy to clipboard operation
hugo-embed-pdf-shortcode copied to clipboard

Load PDF.js library from CDN

Open ericswpark opened this issue 3 years ago • 6 comments

Closes #18 Closes #2

ericswpark avatar Jul 02 '21 02:07 ericswpark

@anvithks here's the requested PR :)

ericswpark avatar Jul 02 '21 02:07 ericswpark

@ericswpark thanks for this PR. As you pointed out reverting the previous commit is needed to test it locally. I was able to test this but I feel removing the local files support may not work out for everyone. I would like to explore the option of making this configurable and allowing the user to use either the CDN or local install. Let me know if you could help out with this.

I understand but unfortunately I do not have the time right now. I'll close the PR but feel free to base changes off of this PR.

ericswpark avatar Aug 28 '21 21:08 ericswpark

@ericswpark thanks for this PR. As you pointed out reverting the previous commit is needed to test it locally. I was able to test this but I feel removing the local files support may not work out for everyone. I would like to explore the option of making this configurable and allowing the user to use either the CDN or local install. Let me know if you could help out with this.

I understand but unfortunately I do not have the time right now. I'll close the PR but feel free to base changes off of this PR.

Sorry about that. I will cherrypick from this PR when I get it working. Thank you for the contribution.

anvithks avatar Aug 29 '21 05:08 anvithks

@ericswpark I spent some time over the weekend on the shortcode and tested all the PRs. With the baseURL changes added in 704485b, using the relURL or Site.baseURL results in CORS errors.

This is mentioned in the embed-pdf.html file as part of the pdf.js inline comments

// If absolute URL from the remote server is provided, configure the CORS // header on that server.

In this case the CDN comes in handy.

I would like to merge this PR but it removes the static library.

Ideally I would like the users to have the option of either installing via CDN or static library.

Would it be possible for you to just remove the commits wherein the static library has been removed. I will then update the docs to let the users use the appropriate script source.

It could default to the CDN and if there is a requirement to keep it local then they can follow the alternate installation steps.

Please let me know your thoughts.

anvithks avatar Aug 29 '21 14:08 anvithks

@anvithks I've dropped the commits that remove the library.

ericswpark avatar Aug 31 '21 15:08 ericswpark

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarcloud[bot] avatar May 19 '22 06:05 sonarcloud[bot]