Commit Graph

18177 Commits

Author SHA1 Message Date
Jonas Jenwald
bf016743fc Remove the "Open file"-button from the main toolbar
This button is *only* used in the GENERIC viewer, and will currently be visible either in the main or secondary toolbars (depending on the viewer width).
To simplify upcoming changes, and to avoid then having to complicate the relevant CSS rules unnecessarily, let's place the "Open file"-button permanently in the secondary toolbar instead.

(Note that the GENERIC viewer also, since five years, supports drag-and-drop in order to open local files.)
2023-11-09 08:08:17 +01:00
Jonas Jenwald
42f3d57365
Merge pull request #17242 from Snuffleupagus/fieldObjects-async-fetch
Ensure that `fieldObjects` and `#collectFieldObjects` handles References correctly
2023-11-08 15:28:11 +01:00
Jonas Jenwald
ff62fc8e2c Skip fieldObjects that are not actually References
The `fieldObjects`-getter is implemented in the `PDFDocument` class, which means that the `this._localIdFactory`-property that we pass to `AnnotationFactory.create` doesn't actually exist.
The reason that this hasn't caused any bugs, that I'm aware of, is that all /Fields-entries need to be References to actually make sense.
2023-11-08 14:39:13 +01:00
Jonas Jenwald
65c827b0eb Ensure that fieldObjects and #collectFieldObjects handles References correctly
The `fieldObjects`-getter itself is called, from `src/core/worker.js`, in a way that'll ensure that any `MissingDataException`s are handled. However the problem is that the actual data-lookups in `fieldObjects` and `#collectFieldObjects` are done inside of a Promise, which means that `MissingDataException`s won't be handled and parsing could thus break.

To address this we change all data-lookups to be asynchronous instead.
2023-11-08 14:38:57 +01:00
calixteman
c6a717f900
Merge pull request #17233 from calixteman/issue17232
Don't try to collect a nonexistent field because of an invalid ref
2023-11-07 22:50:55 +01:00
Calixte Denizet
acc62f80de Don't try to collect a nonexistent field because of an invalid ref 2023-11-07 19:58:29 +01:00
Tim van der Meij
72338ce05d
Merge pull request #17226 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2023-11-05 19:01:34 +01:00
Tim van der Meij
f16401bd67
Bump the stable version in pdfjs.config 2023-11-05 18:58:09 +01:00
Jonas Jenwald
50f52b43a5
Merge pull request #17222 from Snuffleupagus/rm-viewerCssTheme
Remove the `viewerCssTheme`-option, since it's partially broken
2023-11-04 17:40:03 +01:00
Tim van der Meij
87c83ab31c
Merge pull request #17220 from Snuffleupagus/pr-17176-followup
Also pause translation when expanding the current outline-item (PR 17176 follow-up)
2023-11-04 15:29:14 +01:00
Tim van der Meij
0d574f66bc
Merge pull request #17224 from Snuffleupagus/dist-webpack
Update `external/dist/webpack.js` to account for outputting of JavaScript modules (PR 17055 follow-up)
2023-11-04 15:26:35 +01:00
Jonas Jenwald
13ca668be0 Update external/dist/webpack.js to account for outputting of JavaScript modules (PR 17055 follow-up)
Hopefully this makes sense, since I don't know enough about Webpack to tell exactly how this file is being used in practice.
2023-11-04 13:04:26 +01:00
Tim van der Meij
9eb9d3f949
Merge pull request #17218 from Snuffleupagus/app-open-API-options
Re-factor how some API-options are handled in `PDFViewerApplication.open` (PR 17208 follow-up)
2023-11-04 12:53:18 +01:00
Tim van der Meij
71a6c749d0
Merge pull request #17202 from Snuffleupagus/node-ci-latest
Also test the latest Node.js version in GitHub Actions
2023-11-04 12:45:03 +01:00
Tim van der Meij
09f45e6e52
Merge pull request #17217 from Snuffleupagus/more-optional-chaining-5
Use even more optional chaining in the code-base
2023-11-04 12:36:32 +01:00
Tim van der Meij
5e6d80ad07
Merge pull request #17223 from Snuffleupagus/update-packages
Update packages and translations
2023-11-04 12:30:22 +01:00
Jonas Jenwald
89bb0c9e66 Update l10n files 2023-11-04 09:47:38 +01:00
Jonas Jenwald
e0898a7ee3 Update npm packages
The new major version of `gulp-zip` shouldn't be a problem, given the changes listed in https://github.com/sindresorhus/gulp-zip/releases/tag/v6.0.0
2023-11-04 09:47:31 +01:00
Jonas Jenwald
d46578e959 Remove the viewerCssTheme-option, since it's partially broken
The `viewerCssTheme`-implementation has always been somewhat hacky, and now it's also *partially* broken ever since we've started using CSS nesting.
Trying to support nested media queries would thus require a lot more parsing of the CSS rules, which seems inefficient and thus generally undesirable.[1]

As discussed on Matrix, let's try to remove the `viewerCssTheme`-option and see if there's any (significant) fallout from this.

---
[1] If this option is brought back, it seems to me that it (in Firefox) should probably be set through the platform-code that handles theming.
2023-11-04 09:19:01 +01:00
Jonas Jenwald
bf7e8126df Also pause translation when expanding the current outline-item (PR 17176 follow-up)
Depending on the structure of the outline we could potentially need to expand a few levels, especially in long PDF documents, hence it cannot hurt to pause translation in that case as well.
2023-11-03 13:26:36 +01:00
Jonas Jenwald
84aaafcd3e Use a limit when splitting URL-strings in web/app.js
This should be a *tiny* bit more efficient, since it avoids parsing substrings that we don't care about.
2023-11-03 10:53:19 +01:00
Jonas Jenwald
e20dabb65b Simplify how the docBaseUrl-option is handled in PDFViewerApplication.open
Reduce the "special" handling a bit here, by setting the viewer-option such that it'll be automatically included in the API-parameters.
2023-11-03 10:52:31 +01:00
Jonas Jenwald
8bbfcd3bef Re-factor how the canvasMaxAreaInBytes-option is handled in PDFViewerApplication.open (PR 17208 follow-up)
With the changes in PR 17208, where browser-preferences are now handled as "regular" viewer-options, we can tweak the definition of `canvasMaxAreaInBytes` to slightly simplify things in the `PDFViewerApplication.open` method.
2023-11-03 10:52:27 +01:00
Jonas Jenwald
99522c3201 Also test the latest Node.js version in GitHub Actions
Hopefully this will allow us to catch bugs in new Node.js versions earlier, rather than having to wait for bug reports.

Given that `CompressionStream` is (currently) only potentially used when saving a *modified* PDF document, which is unlikely to be a common use-case in Node.js environments, let's just disable the affected unit-test for now.
2023-11-02 16:58:03 +01:00
Jonas Jenwald
155a302e74 Use even more optional chaining in the code-base 2023-11-02 16:47:33 +01:00
calixteman
f528f6f07b
Merge pull request #17216 from calixteman/issue17215
Render rich text with only one text element
2023-11-02 16:42:01 +01:00
Calixte Denizet
085aa4207d Render rich text with only one text element 2023-11-02 15:35:52 +01:00
Jonas Jenwald
20adb2c44d
Merge pull request #17201 from Snuffleupagus/node-ci-lts
Update the GitHub Actions workflows to use the current Node.js LTS version
2023-11-02 13:28:09 +01:00
Jonas Jenwald
6df897267f
Merge pull request #17208 from Snuffleupagus/browser-prefs-async-init
[Firefox] Fetch browser preferences/options together with the viewer preferences (bug 1862192)
2023-11-01 19:34:57 +01:00
Jonas Jenwald
ce9cfa2d72 Skip the PREFERENCE-branch in AppOptions.getAll in official builds
Given that this branch is only necessary in development mode and *during* building, but is never actually used in the final viewer-bundles, we can utilize the pre-processor to ignore this code.
2023-10-31 20:13:13 +01:00
Jonas Jenwald
eebc230cf1 [Firefox] Fetch browser preferences/options together with the viewer preferences (bug 1862192)
Currently we *synchronously* fetch a number of browser preferences/options, from the platform code, during the viewer respectively PDF document initialization paths.
This seems unnecessary, and we can re-factor the code to instead include the relevant data when fetching the regular viewer preferences.
2023-10-31 15:32:01 +01:00
calixteman
50c0fccda6
Merge pull request #17204 from calixteman/issue17167
[Editor] Don't steal the keyboard events when editing mode is enabled
2023-10-30 10:30:38 +01:00
Calixte Denizet
77475ac610 [Editor] Don't steal the keyboard events when editing mode is enabled 2023-10-30 10:03:44 +01:00
calixteman
1ab0f8a0ec
Merge pull request #17205 from calixteman/issue17200
Fix the intermittent failures with PageOpen/PageClose test
2023-10-29 23:23:09 +01:00
Calixte Denizet
66b1a1f34b Fix the intermittent failures with PageOpen/PageClose test 2023-10-29 20:11:51 +01:00
Tim van der Meij
f95a2bbe29
Merge pull request #17203 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2023-10-29 15:25:57 +01:00
Tim van der Meij
447eeeba4d
Update translations to the most recent versions 2023-10-29 14:29:56 +01:00
Tim van der Meij
ecba5b7c6d
Update dependencies to the most recent versions 2023-10-29 14:22:30 +01:00
Jonas Jenwald
d00c7d5cdc Update the GitHub Actions workflows to use the current Node.js LTS version
The active LTS version is now based on Node.js version 20, hence let's update the relevant workflows to use that one instead; see https://en.wikipedia.org/wiki/Node.js#Releases

Given that we still support Node.js version 18, i.e. the maintenance LTS version, in the PDF.js library we'll keep testing both versions in GitHub Actions to prevent regressions.
2023-10-29 12:42:11 +01:00
Tim van der Meij
0329b5e130
Merge pull request #17153 from Snuffleupagus/src-navigator-checks
Guard `navigator`-object accesses in `src/`-files (issue 15728)
2023-10-29 11:59:32 +01:00
Tim van der Meij
355bce28f5
Merge pull request #17199 from timvandermeij/setup-node-4
Upgrade `setup-node` to version 4 in the GitHub Actions workflows
2023-10-29 11:44:28 +01:00
Jonas Jenwald
26fc69f241
Merge pull request #17192 from Snuffleupagus/textLayer-pause-l10n
Pause translation when appending the textLayer and structTreeLayer to the page
2023-10-29 09:31:09 +01:00
Jonas Jenwald
80612f3714
Merge pull request #17184 from Snuffleupagus/xfaLayer-append-print
Handle appending consistently in the xfaLayer regardless of rendering intent (PR 17177 follow-up)
2023-10-28 22:33:17 +02:00
Jonas Jenwald
b798415147
Merge pull request #17081 from Snuffleupagus/examples-modules
Update the `examples/`-folder to account for outputting of JavaScript modules (PR 17055 follow-up)
2023-10-28 22:08:45 +02:00
Tim van der Meij
6dff90ac1f
Upgrade setup-node to version 4 in the GitHub Actions workflows
This major version mainly involves not using Node.js 16 internally
anymore, which will be end of life on September 11th. This prevents the
workflows from using an unsupported version of Node.js as well as
deprecation warnings getting printed in the workflow logs.

For more information please refer to
https://github.com/actions/setup-node/releases/tag/v4.0.0 and
https://github.com/actions/setup-node/issues/850.
2023-10-28 21:08:02 +02:00
Tim van der Meij
973cbb000b
Merge pull request #17198 from timvandermeij/python-3.12-lint
Update the GitHub Actions workflow for the Fluent linter
2023-10-28 20:48:34 +02:00
Tim van der Meij
4845d35c50
Fix the configuration path in the GitHub Actions workflow for the Fluent linter
I noticed the following warning in the GitHub Actions workflow logs:

`Configuration file not found: .github/linter_config.yml`

The configuration file is called `fluent_linter_config.yml` instead, so
this commit fixes the path so it points to the correct file.

Fixes 487816b.
2023-10-28 20:15:25 +02:00
Tim van der Meij
9d6cdf216d
Use Python 3.12 in the GitHub Actions workflow for the Fluent linter
The current stable version of Python is Python 3.12, see
https://www.python.org/downloads, so we should switch to that since
Python 3.10 is older and only receives security updates.
2023-10-28 20:10:15 +02:00
Tim van der Meij
4be44a370e
Improve consistency in the GitHub Actions workflow for the Fluent linter
This commit tweaks the Fluent linter workflow to match the other
workflow files we have, so we make sure the steps have a newline between
them for better readability and align names and descriptions of steps
with how they are called in the other workflow files we have.
2023-10-28 20:02:39 +02:00
Jonas Jenwald
c1fef7d2f2 Guard navigator-object accesses in src/-files (issue 15728)
There are environments that include *incomplete* polyfills for the `navigator`-object, which may thus cause the PDF.js library to break.
Despite that clearly not being our fault, it may still result in bug reports filed against the PDF.js project; see e.g. 15728.

Currently this even seem to affect *the latest* version of Node.js; see e.g. [here].

*Please note:* Thanks to the pre-processor none of these changes affect the Firefox PDF Viewer, however it does add "overhead" when working with and reviewing the affected code (which is why I'm not crazy about this).
2023-10-28 14:41:46 +02:00