Merged
Conversation
The example PDF ("compressed.tracemonkey-pldi-09.pdf") is not needed and
thus was not included; "templates/viewer.php" acts as "viewer.html", so
the later was not included either.
On the other hand, source maps were kept so they could be used in case
of need.
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The "viewer.php" acts as the "viewer.html" file included in the PDF.js package. This commit updates "viewer.php" with the changes to "viewer.html" from PDF.js 1.9.426 to 2.0.943 while respecting the customized parts of "viewer.php" (like the close button or the "nonce" attribute). Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The PDFViewerApplication options are no longer got from the PDFJS object but from a helper object that holds the configuration. This object is globally set before "PDFViewerApplication.initialize" is called, so it can be used in the custom initialization code. Note that despite setting "isEvalSupported" to false this does not work out of the box with the default Nextcloud Content Security Policy. Due to how the PDF.js library is bundled it tries to execute an "eval" function, which is blocked by the CSP and causes the viewer to not load the PDF file. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The example PDF ("compressed.tracemonkey-pldi-09.pdf") is not needed and
thus was not included; "templates/viewer.php" acts as "viewer.html", so
the later was not included either.
On the other hand, source maps were kept so they could be used in case
of need.
Note that "viewer.html" did not change between v2.0.943 and v2.1.266, so
there is no need to update "templates/viewer.php".
Also note that, unlike v2.0.943, PDF.js v2.1.266 works out of the box
with Nextcloud Content Security Policy.
Signed-off-by: Julius Härtl <[email protected]>
Since v2.1.266 an event is triggered before the PDFViewerApplication is initialized, so the hack that relied on the asynchronous calls during the initialization to hook in is no longer needed. However, as the event is triggered before the initialization the options are now set before the preferences are read. As the preferences override the options the preferences need to be disabled to be able to set "externalLinkTarget". Disabling the preferences has no effect for the rest of them, as they already have the same value as the default options. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Merged
juliusknorr
approved these changes
Apr 2, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport of #168