Commit Graph

16229 Commits

Author SHA1 Message Date
Calixte Denizet
68977ebc26 Use AccentColor as background for selected text in the text layer (bug 1790309)
and use the default color for the viewer in general.
2022-09-19 21:25:56 +02:00
calixteman
bf78ccac30
Merge pull request #15459 from calixteman/1774427
Don't use window.print in the Firefox builtin viewer (bug 1774427)
2022-09-19 15:07:10 +02:00
Calixte Denizet
620f1ef1a9 Don't use window.print in the Firefox builtin viewer (bug 1774427)
Currently, it's impossible to print a pdf in a sandboxed iframe in using window.print.
2022-09-19 14:22:40 +02:00
Jonas Jenwald
2642573702
Merge pull request #15458 from Snuffleupagus/rm-some-search
Replace some unnecessary `String.prototype.search` usage
2022-09-19 14:14:41 +02:00
Jonas Jenwald
bb75b36b77 Replace some unnecessary String.prototype.search usage
Most of the `String.prototype.search` call-sites found throughout the code-base is actually not necessary, since we usually only want a *boolean*, and those can be replaced with `RegExp.prototype.test` instead.
2022-09-19 12:51:46 +02:00
calixteman
dc6c3eacbc
Merge pull request #15438 from calixteman/1726183
Improve CSS for HCM (bug 1726183)
2022-09-18 16:04:56 +02:00
Calixte Denizet
07cd7cb3dc Improve CSS for HCM (bug 1726183)
The default outline for a focused text input is not that bad but for any reason when changing
the background color, all the good default border/outline properties are lost (it's the same
behaviour in Edge).
So in order have something consistent in HCM/non-HCM, a 2px-border+1px-outline (on @MReschenberg
advices) is added when an input is focused with different colors depending on HCM.
While working on the above issue, I noticed few bugs I fixed when in HCM:
 - input, button and select have some default properties which have been created at a time where
   annotation layer didn't exist, hence this patch remove them and set those properties where
   they should live;
 - some elements (like the main toolbar) is using a box-shadow which is invisible in HCM, hence
   it's replaced by a border-bottom in HCM;
 - some separators are invisible in HCM, hence use GrayText color to render them correctly;
 - the options for the zoom selection were invisible in HCM with Desert (one of the Windows 11
   themes).
2022-09-18 16:03:24 +02:00
Tim van der Meij
67160f4cae
Merge pull request #15455 from Snuffleupagus/issue-15453
Don't update the Scroll/Spread-mode in the ViewHistory while PresentationMode is active (issue 15453)
2022-09-18 14:35:00 +02:00
Tim van der Meij
f7ab417757
Merge pull request #15432 from Snuffleupagus/validateFileURL-var
Some *small* viewer clean-up for non-GENERIC builds
2022-09-18 14:32:13 +02:00
Tim van der Meij
d78619cd66
Merge pull request #15452 from Snuffleupagus/chrome-extension
Temporarily stop listing the official Chrome extension in the main README
2022-09-18 14:29:46 +02:00
Tim van der Meij
f91cc3dd5d
Merge pull request #15451 from Snuffleupagus/major-support
[api-major] Update the minimum supported browsers/environments
2022-09-18 14:28:31 +02:00
Tim van der Meij
965713f3e7
Merge pull request #15446 from Snuffleupagus/rm-component-examples-enableScripting
Remove the `enableScripting`-parameter from the component examples (PR 13816 follow-up)
2022-09-18 14:24:27 +02:00
Tim van der Meij
58e30a7048
Merge pull request #15454 from Snuffleupagus/update-packages
Update packages and translations
2022-09-18 14:23:43 +02:00
Jonas Jenwald
2c02a2fc5c Don't update the Scroll/Spread-mode in the ViewHistory while PresentationMode is active (issue 15453)
By force-quitting the browser while the FullScreen API is active, we don't get a chance to exit PresentationMode *cleanly* and some of its state thus remains (via the `ViewHistory`).
To try and improve things here we can skip updating the Scroll/Spread-mode while PresentationMode is active, since they will be changed when entering PresentationMode, which seems to help and is really the best that we can do here (and what the issue describes is very much an edge-case anyway).
2022-09-18 11:42:01 +02:00
Jonas Jenwald
1a04a38a06 Update l10n files 2022-09-18 10:34:53 +02:00
Jonas Jenwald
6a9e584215 Update npm packages 2022-09-18 10:31:32 +02:00
Jonas Jenwald
b7f987a185 [api-major] Update the minimum supported browsers/environments
In the `legacy`-builds we (obviously) support the currently maintained Firefox ESR version, and looking at the [release history](https://wiki.mozilla.org/Release_Management/Calendar) those are officially supported (by Mozilla) for about 1-1.5 years.
However, for non-Firefox browsers the `legacy`-builds currently attempt to "support" browsers that are approximately *three* years old.[1] Historically, in the PDF.js project, trying to support old browsers have caused some maintenance problems and even delayed adoption of new web-platform features/functionality.

To lessen the support burden, given that the primary purpose of the PDF.js library is still to develop the *built-in* Firefox PDF Viewer, this patch proposes that the upcoming *major* release changes the minimum supported browsers/environments as follows:
 - Chrome 85, which was released on 2020-08-25; see https://en.wikipedia.org/wiki/Google_Chrome_version_history
 - Firefox ESR (as before); see https://wiki.mozilla.org/Release_Management/Calendar
 - Safari 14, which was released on 2020-09-16; see https://en.wikipedia.org/wiki/Safari_version_history#Safari_14
 - Node.js 14 (as before), which is now explicitly listed to prevent it from accidentally breaking; see https://en.wikipedia.org/wiki/Node.js#Releases

---
[1] In older browsers some functionality may not be available and generally we'll ask users to update to a modern browser when bugs, specific to old browsers, are being reported.
2022-09-18 01:12:15 +02:00
Jonas Jenwald
afabbc28c5 Temporarily stop listing the official Chrome extension in the main README
The [official Chrome extension](https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm) has unfortunately not been updated for *three years*, which means that it's currently missing out on years worth of bug fixes, performance improvements, and new features.
In particular, the Chrome extension suffers from a known bug with non-embedded standard fonts; see issue 13669 for details.

For the time being, this patch proposes that we *temporary* make the following changes:
 - Remove the mention of the official Chrome extension from the main README, since it seems unfortunate to somewhat prominently recommend users an old and partially non-working extension.
 - Don't run the `gulp lint-chromium` task as part of the CI, since in addition to the official extension not having been updated its code is also not being actively maintained.[1]

Once the official Chrome extension has been updated, and it's being actively maintained again, this patch should be simple enough to revert.

---
[1] The last commits, which aren't e.g. linting or general code-maintenance related, happened a year ago now.
2022-09-17 16:29:19 +02:00
Jonas Jenwald
2f3417a590 Remove the enableScripting-parameter from the component examples (PR 13816 follow-up)
This became unnecessary with PDF.js version `2.11.338`, which was relasesed almost a year ago and is no longer supported.
2022-09-16 10:19:05 +02:00
Jonas Jenwald
bcdf161967
Merge pull request #15445 from Snuffleupagus/issue-15443
Extend `getSupplementalGlyphMapForCalibri` with more entries (issue 15443)
2022-09-15 22:56:44 +02:00
Jonas Jenwald
7a19def34c Extend getSupplementalGlyphMapForCalibri with more entries (issue 15443) 2022-09-15 22:19:16 +02:00
Jonas Jenwald
9bfd997c12
Merge pull request #15442 from Snuffleupagus/issue-15441
Extend `getGlyphMapForStandardFonts` with some quote-entries (issue 15441)
2022-09-15 13:11:06 +02:00
Jonas Jenwald
2f2ecad8fd Extend getGlyphMapForStandardFonts with some quote-entries (issue 15441) 2022-09-15 11:37:20 +02:00
Jonas Jenwald
c21d00ef44
Merge pull request #15430 from srmagura/webpack5
[api-minor] Use `new Worker()` syntax in webpack entrypoint
2022-09-14 10:32:01 +02:00
Sam Magura
1c2d200918 [api-minor] Use new Worker() syntax in webpack entrypoint
This requires Webpack 5 and will break for anyone using Webpack 4.
worker-loader no longer needs to be installed.
2022-09-13 11:12:00 -04:00
Jonas Jenwald
5e5aa9fb69
Merge pull request #15339 from Snuffleupagus/enable-editor
[api-major] Enable editing by default
2022-09-13 15:57:54 +02:00
Jonas Jenwald
3c6b3b55c7 Move the errorWrapper definition in the getViewerConfiguration function
Similar to how we handle e.g. the "Open File"-buttons in non-GENERIC builds, we can handle the `errorWrapper` definition in the same way.
2022-09-13 14:18:38 +02:00
Jonas Jenwald
0988915d06 Only define the validateFileURL variable in GENERIC builds
There's no point in having this variable defined (implicitly) as `undefined` in e.g. the Firefox PDF Viewer.
By defining it with `var` and using an ESLint ignore, rather than `let`, we can move it into the relevant pre-processor block instead. Note that since the entire viewer-code is placed, by Webpack, in a top-level closure this variable will thus not become globally accessible.
2022-09-13 14:18:23 +02:00
Jonas Jenwald
5a6cdffb4b
Merge pull request #15431 from Snuffleupagus/bug-1790552
Disable the editing-indicator, in the document title, during printing (bug 1790552, PR 15351 follow-up)
2022-09-13 11:41:33 +02:00
Jonas Jenwald
00aef590cf Disable the editing-indicator, in the document title, during printing (bug 1790552, PR 15351 follow-up) 2022-09-13 11:33:24 +02:00
Jonas Jenwald
3e8394ee33 [api-major] Enable editing by default
Note that this patch *at least* shouldn't land until both [bug 1784272](https://bugzilla.mozilla.org/show_bug.cgi?id=1784272) and [bug 1785248](https://bugzilla.mozilla.org/show_bug.cgi?id=1785248) are fixed.
2022-09-12 14:58:31 +02:00
calixteman
493bb65005
Merge pull request #15425 from Snuffleupagus/cursor-failed-fullscreen
Don't try to update the cursorTool when switching to PresentationMode failed
2022-09-12 14:51:55 +02:00
calixteman
2d1d64b214
Merge pull request #15416 from calixteman/buttons_telemetry
Add some telemetry to know how often the buttons in the secondary toolbar are used (bug 1789883)
2022-09-12 13:59:45 +02:00
Jonas Jenwald
71f8680d66 Don't try to update the cursorTool when switching to PresentationMode failed
Currently this may print an Error message in the console, and while nothing breaks (since no actual Error is thrown) we should probably avoid this.
2022-09-12 13:36:37 +02:00
Calixte Denizet
05e4aed787 Add some telemetry to know how often the buttons in the secondary toolbar are used (bug 1789883) 2022-09-12 12:37:48 +02:00
Tim van der Meij
f63d584cb1
Merge pull request #15414 from Snuffleupagus/mv-PDFViewer
Remove the abstract `BaseViewer`-class
2022-09-10 13:37:04 +02:00
Tim van der Meij
ae12a219d1
Merge pull request #15420 from Snuffleupagus/issue-15419
Send the `verbosity` when using a workerPort (issue 15419)
2022-09-10 13:31:47 +02:00
Jonas Jenwald
a274f63d50
Merge pull request #15421 from Snuffleupagus/separator-followup
Fix the visibility of a separator in the secondaryToolbar (PR 15391 follow-up)
2022-09-09 18:54:37 +02:00
Jonas Jenwald
4189a8567e Fix the visibility of a separator in the secondaryToolbar (PR 15391 follow-up)
After the changes in PR 15391 one separator may now become visible too soon when the viewer is narrow, applies e.g. to the MOZCENTRAL viewer, since the wrong CSS class is being used.
The reason that this happens is that only the GENERIC viewer includes the "openFile"-buttons, and we thus need the separator to also be conditionally defined.
2022-09-09 17:50:29 +02:00
Jonas Jenwald
d846b8601e Send the verbosity when using a workerPort (issue 15419)
This *should* fix issue 15419, but given the lack of a runnable example it's difficult to know for sure.
2022-09-09 11:47:26 +02:00
Jonas Jenwald
a21ce7ac8b
Merge pull request #15418 from Snuffleupagus/pr-15319-followup
Don't listen for window resolution changes in old browsers (PR 15319 follow-up)
2022-09-09 11:18:15 +02:00
Jonas Jenwald
c36205f10d Don't listen for window resolution changes in old browsers (PR 15319 follow-up)
This is a slightly speculative change, based on something that I happened to notice while browsing MDN, to hopefully prevent PDF.js from outright breaking in older browsers.
According to the following information on MDN, Safari didn't implement support for the necessary features until version 14:
 - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/change_event#browser_compatibility

Given the browsers that we currently support only older versions of Safari should be affected, hence it seems reasonable to simply disable the functionality rather than trying to polyfill it.
(It's interesting how it's very often Safari which is *much* slower than the other browsers at implementing new features.)
2022-09-09 10:39:35 +02:00
Jonas Jenwald
21fe5017bb Remove the abstract BaseViewer-class
After the changes in PR 14112 the `PDFViewer`-class is now "identical" to the `BaseViewer`-class and the `PDFSinglePageViewer`-class is just a very thin wrapper around the `BaseViewer`-class.
Hence we can rename these files, and also remove the abstract `BaseViewer`-class, which helps reduce some unnecessary "closures" in the *built* viewer.

*Please note:* These changes are made in two separate commits, to allow GitHub to preserve `blame` for the affected files.
2022-09-08 12:38:17 +02:00
Jonas Jenwald
6dc4c994b8 Remove the abstract BaseViewer-class
After the changes in PR 14112 the `PDFViewer`-class is now "identical" to the `BaseViewer`-class and the `PDFSinglePageViewer`-class is just a very thin wrapper around the `BaseViewer`-class.
Hence we can rename these files, and also remove the abstract `BaseViewer`-class, which helps reduce some unnecessary "closures" in the *built* viewer.

*Please note:* These changes are made in two separate commits, to allow GitHub to preserve `blame` for the affected files.
2022-09-08 12:38:17 +02:00
calixteman
b0a021d2cc
Merge pull request #15413 from calixteman/items_size
Set a display value for the secondary toolbar buttons
2022-09-08 12:35:08 +02:00
Calixte Denizet
f8ae49d20b Set a display value for the secondary toolbar buttons
and remove a useless property: visibleSmallView.
2022-09-08 12:19:21 +02:00
Calixte Denizet
e56c30eb59 Move 'presentation mode' and 'bookmarks' buttons in the secondary toolbar (bug 1789082) 2022-09-08 12:18:08 +02:00
calixteman
6852001b02
Merge pull request #15384 from calixteman/icons
Update some icons in the toolbar (bug 1739965)
2022-09-07 11:48:27 +02:00
Calixte Denizet
90c69876ca Update some icons in the toolbar (bug 1739965) 2022-09-07 10:45:03 +02:00
Jonas Jenwald
af6aacfc0e
Merge pull request #15398 from Snuffleupagus/more-optional-chaining
Use more optional chaining in the code-base
2022-09-06 20:31:03 +02:00