-
Notifications
You must be signed in to change notification settings - Fork 16
Use PDF.js locally from this repo to allow embedding locally uploaded PDFs #197
Conversation
Have this pretty close but working on an issue with CI tests. Looks like absolute paths are being passed into the For instance, on Travis:
Locally:
Tracked it down to the @rmccue, was wondering if you've run into this before in your work on plugin paths/sym links. |
@goldenapples Following up #193 (comment),
Since we only need a sub-folder of |
Ooh, I think that would be way too complicated for me. Unless I'm missing something, I think that'd also break the link to the upstream repo? If so, it wouldn't actually simplify things here. I was thinking something like this:
|
@goldenapples Cleaned it up to use submodule but still fails CI due to the plugin basename issue 🐛 |
@@ -19,7 +19,7 @@ The follow shortcodes are now available for your use within the content field: | |||
- Facebook `[facebook url="https://www.facebook.com/willpd/posts/1001217146572688"]` | |||
- iFrames (requires code-level configuration of accepted domains) `[iframe src="http://www.buzzfeed.com"]` | |||
- Infogram `[infogram url="http://infogr.am/washington_marijuana_sales"]` | |||
- PDF's (requires PDF served from domain with `Access-Control-Allow-Origin` header) `[pdf url="https://assets.fusion.net/edit/pdfs/the_interview_budget_excerpts.pdf"]` | |||
- PDF's (requires PDF be served locally or from domain with `Access-Control-Allow-Origin` header) `[pdf url="https://assets.fusion.net/edit/pdfs/the_interview_budget_excerpts.pdf"]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor note: This README file is built from the readme.txt
file (using the grunt readme
task), so this change should be made there as well.
Prevents ugly failures caused by the symlink in the test suite.
I like this as is. I don't think we need to really test that the plugin url path matches what we'd expect, since that's outside of the scope of this plugin. I think it would be reasonable for the test suite to just test that the pdf markup contains That said, doing something like what I did in #202 should make the tests here pass, if you'd like to merge that into this branch... |
Set WP_PLUGIN_DIR constant for tests
Thanks for the assist on test coverage @goldenapples. Feels good for merge. Hat tip to @rmccue for the initial PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. I'd be happy to merge this as an enhancement for the next release, unless anyone has objections.
If we merge this, I think it'd be good to follow to up with some related enhancements - like maybe hook into the attachment selector to pick a local PDF or upload a PDF, or enable the CORS proxying of remote PDFs. But this makes embedding pdfs a lot easier than previously, since they can just be uploaded to the media library and embedded from the URL there.
Good idea about the PDF attachment, hopefully we can tap into some of the recent enhancements. |
Connected to #192. |
Cleans up tests for #193