Commit Graph

560 Commits

Author SHA1 Message Date
Calixte Denizet
1a3ef2a0aa [editor] Add some UI elements in order to set font size & color, and ink thickness & color 2022-06-28 12:05:04 +02:00
Tim van der Meij
f7d69aab15
Update translations to the most recent versions 2022-06-25 15:45:55 +02:00
Jonas Jenwald
17d2380824 Update l10n files 2022-06-12 14:05:41 +02:00
Calixte Denizet
c161a86ba1 [editor] Add an Ink editor
- Approximate the drawn curve by a set of Bezier curves in using
  js code from https://github.com/soswow/fit-curves.
  The code has been slightly modified in order to make the linter
  happy.
2022-06-09 19:35:59 +02:00
Jonas Jenwald
51bf928061 [editor] A couple of small FreeText-related fixes (PR 14976 follow-up)
- Ensure that the modified-warning won't be displayed, when navigating away from the viewer, if the user has added custom Annotations and then *removed all* of them.
 - Ensure that the *initial* editor-buttons state, i.e. the `toggled`-class, is correctly displayed in the toolbar when then viewer loads.
 - Tweak the CSS-classes for the editor-buttons, such that they use the correct focus/hover-rules (similar to the sidebar-buttons).
 - Remove a no longer accurate comment from the `BaseViewer.annotationEditorMode`-setter.
 - Address a couple of *smaller* outstanding review comments, including some re-formatting changes, from PR 14976.
2022-06-04 21:48:11 +02:00
Calixte Denizet
be1aa11986 [edition] Add a FreeText editor (#14970)
- add a basic UI to edit some text in a pdf;
- an editor can be moved, suppressed, cut, copied, pasted, selected;
- add an undo/redo manager.
2022-06-04 18:20:11 +02:00
Jonas Jenwald
db029e17b3 Update l10n files 2022-05-29 09:48:14 +02:00
Jonas Jenwald
54080b6884 Update l10n files 2022-05-15 09:12:37 +02:00
Tim van der Meij
58fed00bc3
Update translations to the most recent versions 2022-05-01 13:10:20 +02:00
Jonas Jenwald
0c086467a9 Update l10n files 2022-04-17 10:25:20 +02:00
Tim van der Meij
312595eb47
Update translations to the most recent versions 2022-04-02 19:43:34 +02:00
Jonas Jenwald
579ff9459e Update l10n files 2022-03-20 10:59:15 +01:00
Jonas Jenwald
114d5e68af Update l10n files 2022-03-06 10:45:24 +01:00
Jonas Jenwald
21f1d1ace2 Update l10n files 2022-02-20 10:10:21 +01:00
Jonas Jenwald
86949cc930 Update l10n files 2022-02-06 11:34:26 +01:00
Jonas Jenwald
cd7fe27468 [GENERIC viewer] Use consistent casing, for the labels, in the findbar
Note that the *browser* findbar in Firefox uses "Title Case" for the labels, and it thus seem like a good idea to ensure that `PDFFindBar` in consistent with that.
Furthermore, the new label added in PR #13261 uses the "Title Case" format which means that currently the default viewer findbar looks inconsistent.

*Please note:* Based on the official Firefox localization docs, see https://firefox-source-docs.mozilla.org/l10n/overview.html#string-updates, changing only the casing should *not* require updating the key:
> 1) If the change is minor, like fixing a spelling error or case, the developer should update the en-US translation without changing the l10n-id.
2022-02-05 11:18:20 +01:00
Calixte Denizet
1f41028fcb Support search with or without diacritics (bug 1508345, bug 916883, bug 1651113)
- get original index in using a dichotomic seach instead of a linear one;
  - normalize the text in using NFD;
  - convert the query string into a RegExp;
  - replace whitespaces in the query with \s+;
  - handle hyphens at eol use to break a word;
  - add some \s* around punctuation signs
2022-02-03 15:42:55 +01:00
Jonas Jenwald
4f03f2a3a7 Update l10n files 2022-01-23 11:00:06 +01:00
Jonas Jenwald
365538a383 Update l10n files 2022-01-09 11:32:34 +01:00
Jonas Jenwald
ea55e8bf41 Update l10n files 2021-12-26 11:19:19 +01:00
Tim van der Meij
c5847141b4
Update translations to the most recent versions 2021-12-11 19:44:52 +01:00
Jonas Jenwald
37bed4ea45 Update l10n files 2021-11-28 11:14:03 +01:00
Jonas Jenwald
c47f5e81fe Update l10n files 2021-11-14 10:48:50 +01:00
Jonas Jenwald
822856e044 Update l10n files 2021-10-31 09:56:41 +01:00
Jonas Jenwald
ee800a064a Update l10n files 2021-10-17 11:49:08 +02:00
Jonas Jenwald
511458fbbc Add a new Page scrolling mode (issue 2638, 8952, 10907)
This implements a new Page scrolling mode, essentially bringing (and extending) the functionality from `PDFSinglePageViewer` into the regular `PDFViewer`-class. Compared to `PDFSinglePageViewer`, which as its name suggests will only display one page at a time, in the `PDFViewer`-implementation this new Page scrolling mode also support spreadModes properly (somewhat similar to e.g. Adobe Reader).

Given the size and scope of these changes, I've tried to focus on implementing the basic functionality. Hence there's room for further clean-up and/or improvements, including e.g. simplifying the CSS/JS related to PresentationMode and implementing easier page-switching with the mouse-wheel/arrow-keys.
2021-10-12 13:45:15 +02:00
Jonas Jenwald
65118bc04d Update l10n files 2021-10-03 08:33:21 +02:00
Jonas Jenwald
32ad677f9c Update l10n files 2021-09-19 09:43:15 +02:00
Jonas Jenwald
a6f8591cc2 Update l10n files 2021-09-05 10:01:23 +02:00
Jonas Jenwald
ab06773758 Update l10n files 2021-08-22 10:43:02 +02:00
Jonas Jenwald
d24476e02c Update l10n files 2021-08-08 10:52:26 +02:00
Jonas Jenwald
aad0316137 Update l10n files 2021-07-25 10:31:40 +02:00
Jonas Jenwald
c9ed65a0c4 Update l10n files 2021-07-11 12:25:54 +02:00
Jonas Jenwald
0326c05db0 Update l10n files 2021-06-27 10:31:06 +02:00
Jonas Jenwald
59f72bbde1 Update l10n files 2021-06-13 10:35:58 +02:00
Jonas Jenwald
0bfd99ae98 Update l10n files 2021-05-30 08:02:55 +02:00
Jonas Jenwald
30908451b4 Update l10n files 2021-05-16 11:44:05 +02:00
Jonas Jenwald
809cb1de4d Update l10n files 2021-05-02 09:38:15 +02:00
Jonas Jenwald
d3ed3761bc Update l10n files 2021-04-18 11:24:51 +02:00
Jonas Jenwald
7d7a8a1a3c [GENERIC viewer] Don't display the errorWrapper, for documents with signatures (PR 13217 follow-up)
According to a decision by UX and PM, please see https://bugzilla.mozilla.org/show_bug.cgi?id=1705060#c2, in Firefox we should first of all *not* display the notification-bar for signatures. Secondly, as can also be seen there, we shouldn't display the notification-bar *at all* and it's thus disabled in https://bugzilla.mozilla.org/show_bug.cgi?id=1705327.

If we purposely don't display a notification, for documents with signatures, in the *built in* Firefox PDF Viewer then it cannot be necessary in the GENERIC viewer either.
2021-04-16 09:53:59 +02:00
Jonas Jenwald
52494be545 [GENERIC viewer] Display a warning message, using the errorWrapper, for documents with signatures (PR 13214 follow-up, issue 13215)
To simplify the overall implementation, given that it only applies to the GENERIC-viewer, this patch purposely re-uses the existing `errorWrapper`-functionality to display the message.
While that one is mostly intended for actual *errors*, by re-using it here we considerably reduce the amount of code/complexity necessary for supporting this new warning. It's obviously possible to re-factor/improve this later on, but the patch should do just fine here since it'll indeed inform users (of the GENERIC-viewer) about unverified signatures.

Finally this patch also tweaks the background-color of the `errorWrapper`, making it 20 percent lighter respectively darker (depending on the theme) to make it "stand out" a little bit *less*.[1] While it may perhaps be useful to re-style/re-factor the `errorWrapper`, this patch probably isn't the right place for doing that.

---
[1] Note how in the MOZCENTRAL-viewer, which instead uses the browser notification-bar, we're purposely using a neutral colour to not draw too much attention to the notification-bar.
2021-04-11 12:46:17 +02:00
Calixte Denizet
5875ebb1ca Display widget signature
- but don't validate them for now;
  - Firefox will display a bar to warn that the signature validation is not supported (see https://bugzilla.mozilla.org/show_bug.cgi?id=854315)
  - almost all (all ?) pdf readers display signatures;
  - validation is done in edge but for now it's behind a pref.
2021-04-10 19:13:28 +02:00
Jonas Jenwald
3d9f6ec0f9 Update l10n files 2021-04-04 11:04:05 +02:00
Jonas Jenwald
4814e23310 Add (temporary) Swedish localizations for the page_landmark/loading strings (PR 13118 follow-up)
I'm adding these temporary l10n strings, so that I don't have to stare at a bunch of warning messages in the web-console when using the development viewer.
2021-03-21 11:12:20 +01:00
Jonas Jenwald
36e79edfaf Update l10n files 2021-03-21 11:12:18 +01:00
Brendan Dahl
9fb0f3b0da Add landmark region and aria-label for each page.
Allows screen readers to jump landmarks and announce
the page. Since landmarks must have content, I also added
aria labels for the loading images.
2021-03-19 14:13:51 -07:00
Jonas Jenwald
d4cf751f91 Update l10n files 2021-03-07 12:05:10 +01:00
Jonas Jenwald
476230bd17 Update l10n files 2021-02-21 12:07:32 +01:00
Jonas Jenwald
6e2ae2264b Remove the unused "loading_error_indicator" l10n string (PR 2719 follow-up)
This l10n string has been completely unused ever since PR 2719, which is now *eight* years ago.
2021-02-12 13:12:37 +01:00
Jonas Jenwald
32a4a30f3a Remove the contentmenu usage, from PresentationMode, since it's no longer working
This feature was Firefox-specific, and it's now been removed from the HTML specification and it's disabled by default starting with Firefox 85. Hence it seems completely unnecessary to keep this code in the default viewer.

Please refer to https://groups.google.com/g/mozilla.dev.platform/c/tc11BCenm2c and the resources that it links to.
2021-02-09 14:29:48 +01:00
Jonas Jenwald
1d56785b6b Update l10n files 2021-02-07 12:04:23 +01:00
Jonas Jenwald
09442351b8 Update l10n files 2021-01-24 08:43:09 +01:00
Jonas Jenwald
3210b91cf8 Update l10n files 2021-01-10 13:34:49 +01:00
Jonas Jenwald
5729c0b32f Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.

Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:

 - The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.

 - With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.

 - The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.

 - Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.

Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.

---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.

[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2021-01-09 16:09:44 +01:00
Jonas Jenwald
689e3e9732 Update l10n files 2020-12-27 11:13:54 +01:00
Jonas Jenwald
ad91972eb2 Update l10n files 2020-12-13 11:43:49 +01:00
Jonas Jenwald
cd2e6d803a Update l10n files 2020-11-29 09:50:36 +01:00
Jonas Jenwald
237c2f7832 Update l10n files 2020-11-15 13:57:28 +01:00
Jonas Jenwald
ab31f95cb4 Update l10n files 2020-10-18 11:01:06 +02:00
Jonas Jenwald
ffb0bb885c Update l10n files 2020-10-04 15:30:24 +02:00
Jonas Jenwald
fcfbc06a9c Update l10n files 2020-09-20 11:43:35 +02:00
Jonas Jenwald
54eeaba014 Update l10n files 2020-09-06 11:51:34 +02:00
Jonas Jenwald
66aabe3ec7 [api-minor] Add support for toggling of Optional Content in the viewer (issue 12096)
*Besides, obviously, adding viewer support:* This patch attempts to improve the general API for Optional Content Groups slightly, by adding a couple of new methods for interacting with the (more complex) data structures of `OptionalContentConfig`-instances. (Thus allowing us to mark some of the data as "private", given that it probably shouldn't be manipulated directly.)

By utilizing not just the "raw" Optional Content Groups, but the data from the `/Order` array when available, we can thus display the Layers in a proper tree-structure with collapsible headings for PDF documents that utilizes that feature.

Note that it's possible to reset all Optional Content Groups to their default visibility state, simply by double-clicking on the Layers-button in the sidebar.
(Currently that's indicated in the Layers-button tooltip, which is obviously easy to overlook, however it's probably the best we can do for now without adding more buttons, or even a dropdown-toolbar, to the sidebar.)

Also, the current Layers-button icons are a little rough around the edges, quite literally, but given that the viewer will soon have its UI modernized anyway they hopefully suffice in the meantime.

To give users *full* control of the visibility of the various Optional Content Groups, even those which according to the `/Order` array should not (by default) be toggleable in the UI, this patch will place those under a *custom* heading which:
 - Is collapsed by default, and placed at the bottom of the Layers-tree, to be a bit less obtrusive.
 - Uses a slightly different formatting, compared to the "regular" headings.
 - Is localizable.

Finally, note that the thumbnails are *purposely* always rendered with all Optional Content Groups at their default visibility state, since that seems the most useful and it's also consistent with other viewers.
To ensure that this works as intended, we'll thus disable the `PDFThumbnailView.setImage` functionality when the Optional Content Groups have been changed in the viewer. (This obviously means that we'll re-render thumbnails instead of using the rendered pages. However, this situation ought to be rare enough for this to not really be a problem.)
2020-08-30 16:28:40 +02:00
Jonas Jenwald
ba8c5bde5f Update l10n files 2020-08-23 10:10:38 +02:00
Jonas Jenwald
7afcdbeebe Update l10n files 2020-08-09 11:05:40 +02:00
Jonas Jenwald
ca61910a2c Update l10n files 2020-07-26 11:18:56 +02:00
Jonas Jenwald
8256981aca Update l10n files 2020-07-13 11:08:28 +02:00
Jonas Jenwald
93b1887512 Update l10n files 2020-06-27 11:37:41 +02:00
Jonas Jenwald
960d639dee Update l10n files 2020-06-13 10:39:20 +02:00
Jonas Jenwald
f2cbd5de42 Update l10n files 2020-05-30 11:01:34 +02:00
Jonas Jenwald
c12c92e598 Update l10n files 2020-05-16 11:47:08 +02:00
Jonas Jenwald
30bd3b24c2 Update l10n files 2020-05-02 13:25:28 +02:00
Jonas Jenwald
cf58f787f1 Update l10n files 2020-04-18 11:11:19 +02:00
Jonas Jenwald
9a3b52f52b Update l10n files 2020-04-02 12:22:18 +02:00
Jonas Jenwald
4ac34c6283 Update l10n files 2020-03-19 09:58:49 +01:00
Jonas Jenwald
af8c371fa9 Update l10n files 2020-03-06 13:08:15 +01:00
Jonas Jenwald
ed01158127 Update l10n files 2020-02-21 17:40:08 +01:00
Jonas Jenwald
9ac5395ca4 Update l10n files 2020-01-31 15:02:59 +01:00
Jonas Jenwald
a977882f54 Remove the supportsDocumentColors warning in MOZCENTRAL builds (bug 844349 follow-up)
With https://bugzilla.mozilla.org/show_bug.cgi?id=844349 now being fixed in Firefox, the textLayer will now actually stay hidden as intended regardless of the browser settings.
Hence it should no longer be necessary to display the fallback bar, nor print a warning in the console, for documents which contains a textLayer.

Besides removing the `supportsDocumentColors` methods in the default viewer, we can also remove a now unused l10n string.
2020-01-19 14:49:26 +01:00
Jonas Jenwald
16a94412e4 Remove the unused id properties from page and thumbnail canvas/image DOM elements (issue 11499)
As described in the issue, having a DOM element with `id=page2` (or any other number) will automatically cause that element to become linkable through the URL hash. That's currently leading to some confusing and outright wrong behaviour, since it obviously only works for pages that have been loaded and rendered.

For PDF documents the only officially supported way to reference a particular page through the URL hash is using the `#page=2` format, which also works for all pages regardless if they're loaded or not.

As far as I can tell there's nothing in the PDF.js default viewer that actually depends on the page/thumbnail `id` at this point in time, hence why I believe that this removal ought to be safe.
Just as a pre-caution this patch adds an `aria-label` to the page canvas, similar to the thumbnail canvas/image, to at least keep this information in the DOM.
2020-01-11 14:11:47 +01:00
Jonas Jenwald
cac953f5a9 Update l10n files 2019-12-28 20:00:03 +01:00
Jonas Jenwald
9386544555 Update l10n files 2019-12-19 11:30:57 +01:00
Jonas Jenwald
1319c9f13b Update l10n files 2019-11-23 12:02:31 +01:00
Jonas Jenwald
d08ecdb9fa Update l10n files 2019-10-26 13:56:37 +02:00
Jonas Jenwald
ee57832de2 Re-add the en-US chrome.properties l10n file, to avoid it being removed at mozilla-central (PR 11256 follow-up)
Unfortunately I forgot to test `gulp mozcentraldiff` with PR 11256, which is really bad since it will cause the en-US `chrome.properties` l10n file to be deleted at mozilla-central; sorry about breaking this!

In order to address this we'll have to re-add (only) the en-US `chrome.properties` l10n file, which is simple enough. Furthermore, since we're not doing any sort of build-specific parsing of the l10n files, we can just copy the en-US files as-is rather than having to run `gulp locale` during `gulp mozcentral`.
2019-10-19 17:28:37 +02:00
Jonas Jenwald
b7ddd10741 Update l10n files 2019-10-17 12:27:16 +02:00
Jonas Jenwald
b663cec383 [Firefox] Stop fetching the chrome.properties files during gulp importl10n (PR 9566 follow-up)
With the removal of the (standalone) Firefox building code in PR 9566 (a year and a half ago), these files are now completely unused in the GitHub repository[1].
Hence it doesn't really seem necessary to keep fetching them with `gulp importl10n`, and the existing files in the `l10n` folder can also be removed (thanks to version control, they're easy enough to restore should the need ever arise).

The patch also allows an additional simplification, for the `gulp locale` and `gulp mozcentral` commands, since it's now possible to stop writing `l10n` files to the `extensions/firefox/` folder and instead just copy them similar to other build targets.

---
[1] They're obviously still used in `mozilla-central`, for fallback messages displayed through `PdfStreamConverter.jsm`, but that doesn't make it necessary to keep them *here* as far as I'm concerned.
2019-10-17 12:27:11 +02:00
Jonas Jenwald
8a057dcf90 [Firefox] Stop building the metadata.inc/chrome.manifest.inc files during gulp locale (PR 9566 follow-up)
With the removal of the (standalone) Firefox building code in PR 9566 (a year and a half ago), these files are now completely unused.
Hence it doesn't really make sense to keep building them as part of `gulp locale`, and the existing files in the `l10n` folder can also be removed (thanks to version control, they're easy enough to restore should the need ever arise).
2019-10-17 11:49:30 +02:00
Jonas Jenwald
307a85901d Remove locales which are unmaintained and/or not shipping in Nightly (PR 11213 follow-up)
With the sole exception of `meh`[1], none of the locales removed here have even been updated since the last change was made to the default `en-US` locale.

Please note that if/when these locales would start shipping in Nightly again, they will automatically be re-added in PDF.js as well with the `gulp importl10n` command.

---
[1] The current translation is also somewhat incomplete, to put it mildly.
2019-10-09 10:18:00 +02:00
Jonas Jenwald
8d74a9ae7f Update l10n files 2019-10-06 18:12:29 +02:00
Tim van der Meij
27dee5e911
Update translations and packages 2019-09-21 13:42:27 +02:00
Tim van der Meij
bdd28fd717
Remove unmaintained localizations
Fixes #11167.
2019-09-21 13:31:42 +02:00
Tim van der Meij
7ce36644e3
Update translations 2019-09-15 15:31:44 +02:00
Tim van der Meij
ce1acff5f0
Update translations 2019-08-24 20:05:47 +02:00
Tim van der Meij
087e975478
Update translations 2019-06-29 12:33:23 +02:00
Tim van der Meij
1f3723f54c
Update translations 2019-05-25 16:21:09 +02:00
Tim van der Meij
be1d6626a7
Implement creation/modification date for annotations
This includes the information in the core and display layers. The
date parsing logic from the document properties is rewritten according
to the specification and now includes unit tests.

Moreover, missing unit tests for the color of a popup annotation have
been added.

Finally the styling of the popup is changed slightly to make the text a
bit smaller (it's currently quite large in comparison to other viewers)
and to make the drop shadow a bit more subtle. The former is done to be
able to easily include the modification date in the popup similar to how
other viewers do this.
2019-05-05 14:51:03 +02:00
Tim van der Meij
b0de15e855
Update translations 2019-04-13 17:23:33 +02:00
Tim van der Meij
4653dc196b
Update translations 2019-03-30 18:56:17 +01:00
Tim van der Meij
ff8e7114f4
Update translations 2019-03-02 14:19:27 +01:00