mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Move the opening of PDF file attachments into the DownloadManager
-implementations
Note how the `PDFAttachmentViewer` handles PDF file attachments specially, by opening them in a new window/tab, rather than forcing them to be downloaded. This is done to improve the overall UX, since browsers in general are able to handle PDF files internally. However, for file *annotations* we're currently not attempting to do the same thing and are instead just downloading them directly. In order to unify the behaviour, without having to duplicate a lot of code, the opening of PDF file attachments is thus moved into a new `DownloadManager.openOrDownloadData` method.
This commit is contained in:
parent
fafe039849
commit
df931ef685
5 changed files with 97 additions and 61 deletions
|
@ -69,6 +69,9 @@ const SpreadMode = {
|
|||
// Used by `PDFViewerApplication`, and by the API unit-tests.
|
||||
const AutoPrintRegExp = /\bprint\s*\(/;
|
||||
|
||||
// Used by the (various) `DownloadManager`-implementations.
|
||||
const PdfFileRegExp = /\.pdf$/i;
|
||||
|
||||
// Replaces {{arguments}} with their values.
|
||||
function formatL10nValue(text, args) {
|
||||
if (!args) {
|
||||
|
@ -1059,6 +1062,7 @@ export {
|
|||
normalizeWheelEventDirection,
|
||||
NullL10n,
|
||||
parseQueryString,
|
||||
PdfFileRegExp,
|
||||
PresentationModeState,
|
||||
ProgressBar,
|
||||
RendererType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue