Commit Graph

16174 Commits

Author SHA1 Message Date
Jonas Jenwald
9578152ae4
Merge pull request #15392 from Snuffleupagus/issue-15352
Don't allow `adjustToUnicode` to extend a built-in /ToUnicode map (issue 15352)
2022-09-04 15:12:10 +02:00
calixteman
72375ed652
Merge pull request #15395 from calixteman/15340
Don't replace cr by a white space when the last char on the line is an ideographic char
2022-09-04 14:30:22 +02:00
Calixte Denizet
6c6f6fb2b8 Don't replace cr by a white space when the last char on the line is an ideographic char 2022-09-04 14:21:05 +02:00
Tim van der Meij
e3874dab7c
Merge pull request #15394 from Snuffleupagus/update-packages
Update packages and translations
2022-09-04 13:52:23 +02:00
Jonas Jenwald
a65cc8d26d Update l10n files 2022-09-04 10:16:40 +02:00
Jonas Jenwald
21042371e6 Update npm packages 2022-09-04 10:16:40 +02:00
Jonas Jenwald
12d60e0acf Don't allow adjustToUnicode to extend a built-in /ToUnicode map (issue 15352)
Given that the change in PR 13393 was slightly speculative, given the lack of test-cases, let's just revert part of that to fix the referenced issue.
Based on a quick look at old issues and existing test-cases, it seems that most (if not all) PDF documents that benefit from using the font-data in this way lack any /ToUnicode maps which should mean that they're unaffected by these changes.
2022-09-03 23:11:42 +02:00
Tim van der Meij
50d72fc111
Merge pull request #15377 from Snuffleupagus/SetOCGState
[api-minor] Add basic support for the `SetOCGState` action (issue 15372)
2022-09-03 13:26:06 +02:00
Tim van der Meij
d16f591183
Merge pull request #15390 from Snuffleupagus/rm-bower
Remove Bower support in `pdfjs-dist`
2022-09-03 13:21:28 +02:00
Jonas Jenwald
5b903a6e2d Remove Bower support in pdfjs-dist
Given that the official Bower website, since almost five years, has been advising users to utilize other tools it doesn't seem entirely necessary to keep including the `bower.json` file in the `pdfjs-dist` repository; see e.g. https://bower.io/blog/2017/how-to-migrate-away-from-bower/
2022-09-03 13:05:59 +02:00
Tim van der Meij
783c722661
Merge pull request #15360 from Snuffleupagus/Popup-IGNORE_TYPES
Properly ignore PopupAnnotations with custom `trigger`-elements
2022-09-03 12:56:38 +02:00
Tim van der Meij
41c14f84dd
Merge pull request #15388 from Snuffleupagus/rm-browserify
Remove the `browserify` example
2022-09-03 12:29:14 +02:00
Jonas Jenwald
2075800828 Remove the browserify example
This patch proposes removing the `browserify` example for the following reasons:
 - The last `browserify` release was almost two years ago, according to both https://github.com/browserify/browserify/releases and https://www.npmjs.com/package/browserify?activeTab=versions
 - The project no longer seems to be actively maintained, since so far this year there's only been *a single* (seemingly trivial) patch merged; see https://github.com/browserify/browserify/commits/master
 - Because of the previous points `browserify` doesn't support modern and up-to-date JavaScript features, as evident from e.g. issue 14731 and multiple issues found in https://github.com/browserify/browserify/issues
 - Our `browserify` example is most likely not very commonly used, judging by the very low volume of issues/PRs related to it. Looking at the `git` history of that example the only changes have been lint- or maintenance-related.[1]
 - Providing an example for a framework that's no longer actively maintained doesn't seem like a good idea in general, since we probably don't want to steer users towards using (possibly) older frameworks.
 - Given that we've never used `browserify` in the PDF.js project, it's also quite difficult to provide support for the example.

---
[1] It's interesting to compare with the `webpack` example, since that's generated both issues *and* also PRs (for missing features) from users.
2022-09-02 18:15:42 +02:00
calixteman
c503006b2e
Merge pull request #15386 from calixteman/text_cursor
[Editor] Change the cursor when we switch to FreeText mode (bug 1787297)
2022-09-02 17:58:00 +02:00
Calixte Denizet
1b14b06e4c [Editor] Change the cursor when we switch to FreeText mode (bug 1787297) 2022-09-02 15:17:24 +02:00
calixteman
51035194d9
Merge pull request #15385 from calixteman/editor_icons
Update editing icons (bug 1785248)
2022-09-02 13:28:12 +02:00
Calixte Denizet
ec165abfa1 Update editing icons (bug 1785248) 2022-09-02 12:42:25 +02:00
calixteman
eab411a379
Merge pull request #15378 from calixteman/editor_strings
[Editor] Update some strings (bug 1787299)
2022-09-02 09:36:02 +02:00
calixteman
3043423c82
Merge pull request #15381 from calixteman/rm_leftover
[Editor] Remove some useless code (#15373 follow-up)
2022-09-01 20:38:07 +02:00
Calixte Denizet
c4aa00bee1 [Editor] Remove some useless code (#15373 follow-up) 2022-09-01 19:34:30 +02:00
Calixte Denizet
b8fa789022 [Editor] Update some strings (bug 1787299) 2022-09-01 18:02:17 +02:00
Jonas Jenwald
cc4baa2fe9 [api-minor] Add basic support for the SetOCGState action (issue 15372)
Note that this patch implements the `SetOCGState`-handling in `PDFLinkService`, rather than as a new method in `OptionalContentConfig`[1], since this action is nothing but a series of `setVisibility`-calls and that it seems quite uncommon in real-world PDF documents.

The new functionality also required some tweaks in the `PDFLayerViewer`, to ensure that the `layersView` in the sidebar is updated correctly when the optional-content visibility changes from "outside" of `PDFLayerViewer`.

---
[1] We can obviously move this code into `OptionalContentConfig` instead, if deemed necessary, but for an initial implementation I figured that doing it this way might be acceptable.
2022-09-01 17:34:24 +02:00
calixteman
e9bdbe4574
Merge pull request #15373 from calixteman/copy_paste
[Editor] Use the global clipboard for the copy/paste/cut operations
2022-08-31 16:53:16 +02:00
Calixte Denizet
372d4d64e3 [Editor] Use the global clipboard for the copy/paste/cut operations
It slightly helps to reduce the code size and its complexity.
But the cool thing is that it allows to copy/paste some anntations from a pdf
to an other.
2022-08-31 16:32:19 +02:00
calixteman
54d3b64497
Merge pull request #15369 from calixteman/update_params
[Editor] Avoid to update default params too early
2022-08-31 11:18:08 +02:00
Calixte Denizet
e91d67563f [Editor] Avoid to update default params too early 2022-08-31 10:28:58 +02:00
Jonas Jenwald
1865bb6526
Merge pull request #15368 from Snuffleupagus/issue-15367
[api-minor] Support Named-actions in the outline (issue 15367)
2022-08-30 22:13:29 +02:00
Jonas Jenwald
216b86a082 [api-minor] Support Named-actions in the outline (issue 15367)
Apparently this is implemented in e.g. Adobe Reader, and the specification does support it, however it cannot be commonly used in real-world PDF documents since it took over ten years for this feature to be requested.
2022-08-30 18:47:45 +02:00
Jonas Jenwald
0ecf6458ee Properly ignore PopupAnnotations with custom trigger-elements
A number of Annotation-types are currently creating their own PopupAnnotations, since they need to use a custom `trigger`-element. However, because of where that check is currently implemented[1] we end up attaching empty/unused containers for those PopupAnnotations to the DOM[2]; see e.g. the `annotation-line.pdf` file in the test-suite for one example.

By instead moving the types-check into the `PopupAnnotationElement` constructor, we can completely skip those PopupAnnotations that are being explicitly handled elsewhere.
Note that I don't *believe* that this is a new issue, although I've not tried to bisect it, but this likely goes back quite some time (possibly even as far as PR 8228).

---
[1] In the `PopupAnnotationElement.render` method.

[2] Please note that the actual Popup-element *itself* isn't being attached/rendered here, just its container which by itself serves no purpose as far as I can tell.
2022-08-29 16:32:47 +02:00
Tim van der Meij
86370bd5c5
Merge pull request #15286 from Snuffleupagus/rm-deprecated
[api-major] Remove (most of) the remaining `deprecated` code
2022-08-28 19:21:45 +02:00
Tim van der Meij
7b7b54ce0f
Merge pull request #15259 from Snuffleupagus/rm-enhanceTextSelection
[api-major] Remove the `enhanceTextSelection` functionality (PR 15145 follow-up)
2022-08-28 19:13:33 +02:00
Jonas Jenwald
78f24e5535 [api-major] Remove (most of) the remaining deprecated code
There's three notable exceptions here:
 - The `saveDocument` one is converted into a permanent `warn`, since it still works when the `annotationStorage` is empty although it's (obviously) less efficient than `getData`.
 - The `fallbackWorkerSrc` functionality (for browsers), since just removing it would risk too much third-party breakage.
 - The SVG back-end, since a final decision is yet to be made. (It might be completely removed, or left as-is in an essentially "frozen" state.)
2022-08-28 15:05:00 +02:00
Jonas Jenwald
d3005603e1 Move the saveDocument method, within the PDFDocumentProxy/WorkerTransport classes
To improve discoverability, since these methods are very closely related, move `saveDocument` to just after `getData` instead.
2022-08-28 15:05:00 +02:00
Jonas Jenwald
571ce13dd6 [api-major] Remove the enhanceTextSelection functionality (PR 15145 follow-up)
For the `gulp mozcentral` command, this reduces the size of the *built* `pdf.js` file by `> 10` kB.
2022-08-28 15:04:47 +02:00
Tim van der Meij
3f8b5449e8
Merge pull request #15357 from timvandermeij/bump
Bump versions in `pdfjs.config`
2022-08-28 13:48:00 +02:00
Tim van der Meij
eba4da5802
Bump versions in pdfjs.config 2022-08-28 13:34:57 +02:00
Tim van der Meij
172ccdbe5b
Merge pull request #15356 from Snuffleupagus/Node-amend-compat-info
Update the Node.js `atob`/`btoa` compatibility info
2022-08-28 13:04:11 +02:00
Jonas Jenwald
ca823d1bbc Update the Node.js atob/btoa compatibility info
Given that Node.js has finally implemented native support for `atob`/`btoa`, it can't hurt to update the comments in `src/shared/compatibility.js` so that we don't forget to remove the polyfills once Node.js version `16` becomes the lowest supported LTS release; see
 - https://developer.mozilla.org/en-US/docs/Web/API/atob#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/btoa#browser_compatibility
2022-08-28 12:58:02 +02:00
Tim van der Meij
d62cce455f
Merge pull request #15349 from Snuffleupagus/bug-1787295
[editor] Remove the `editorNone` toolbar button (bug 1787295)
2022-08-27 14:04:06 +02:00
Tim van der Meij
c5b9e9aef8
Merge pull request #15351 from Snuffleupagus/bug-1785854
[api-minor][editor] Indicate, in the title, if the document has been edited (bug 1785854)
2022-08-27 13:52:07 +02:00
Tim van der Meij
d715094383
Merge pull request #15346 from Snuffleupagus/deprecated-imageLayer
[api-minor] Deprecate the `imageLayer` functionality
2022-08-27 13:16:31 +02:00
Tim van der Meij
4469453425
Merge pull request #15341 from Snuffleupagus/PasswordPrompt-cancel-button
Improve handling of the "Cancel"-button in the password dialog
2022-08-27 13:10:39 +02:00
Tim van der Meij
a1cc9238b0
Merge pull request #15343 from Snuffleupagus/AbortController-unconditional
Use `AbortController` unconditionally with the Fetch API
2022-08-27 13:08:26 +02:00
Tim van der Meij
cb8d56f988
Merge pull request #15344 from Snuffleupagus/prefer-array-find
Enable the `unicorn/prefer-array-find` ESLint plugin rule
2022-08-27 13:06:41 +02:00
Jonas Jenwald
4c63a91036
Merge pull request #15355 from Snuffleupagus/bug-1787456
Always focus the `viewerContainer` when entering PresentationMode (bug 1787456)
2022-08-27 11:18:19 +02:00
Jonas Jenwald
d93d21fdfd Always focus the viewerContainer when entering PresentationMode (bug 1787456)
This fixes the regression in [bug 1787456](https://bugzilla.mozilla.org/show_bug.cgi?id=1787456), assuming that it should be handled on the PDF.js side.
2022-08-26 21:42:06 +02:00
Jonas Jenwald
f2b5210b36
Merge pull request #15347 from federicobond/fix-types
Update types in PDFPageViewOptions to properly declare optional parameters
2022-08-26 20:48:12 +02:00
Jonas Jenwald
19182d5f25 [editor] Remove the editorNone toolbar button (bug 1787295) 2022-08-26 09:25:05 +02:00
Jonas Jenwald
151dfc9a25 [api-minor][editor] Indicate, in the title, if the document has been edited (bug 1785854)
Note that this patch prepends the document title with "* ", rather than only "*" as suggested in the bug, since there's nothing that says that a PDF document cannot specify a title[1] beginning with an asterisk. To reduce possible confusion, having a space between the "editing marker" and the actual document title thus cannot hurt as far as I'm concerned.

In order to notify the viewer when all `AnnotationEditor`s have been removed, we utilize the existing `onAnnotationEditor`-callback to allow the document title to be updated as necessary.

Finally, this patch makes the following (slightly unrelated) changes:
 - Rename the `AnnotationStorage.removeKey` method to just `AnnotationStorage.remove` instead. This is consistent with e.g. the `has`-method and should suffice to explain what it does.
 - Remove the `AnnotationStorage.hasAnnotationEditors` getter, since the viewer now tracks the necessary state internally. This avoids unnecessarily having to iterate through the `AnnotationStorage`-instance when saving/printing the document.

---
[1] Using either an /Info dictionary or a /Metadata stream.
2022-08-26 00:20:58 +02:00
Jonas Jenwald
76f665d57f
Merge pull request #15348 from Snuffleupagus/bug-1787296
[editor] Change the focus-outline to blue (bug 1787296)
2022-08-25 22:53:10 +02:00