1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-23 16:48:08 +02:00
Commit graph

6351 commits

Author SHA1 Message Date
Calixte Denizet
a3873e4c68 Don't hide the editor layer when rotating (follow-up of #17802)
Before the patch in #17802, the layer was made visible when calling updateMode
after the rotation angle was set.
2024-03-19 18:36:55 +01:00
Calixte Denizet
1b00511301 [Editor] Make the text layer focusable before the editors (bug 1881746)
Keep the different layers in a constant order to avoid the use of a z-index
and a tab-index.
2024-03-19 16:14:55 +01:00
Jonas Jenwald
0022310b9c
Merge pull request #17706 from Snuffleupagus/Node-Fetch-API
[api-minor] Use the Fetch API, when supported, to load PDF documents in Node.js environments
2024-03-19 11:04:28 +01:00
calixteman
a142c8c945
Merge pull request #17802 from calixteman/fix_tests
[Editor] Fix the rect used to click in some freetext integration tests
2024-03-19 10:50:34 +01:00
Calixte Denizet
5437199c95 [Editor] Fix the rect used to click in some freetext integration tests
And avoid to uselessly set the pointer listeners in the annotation editor layer.
2024-03-18 10:29:32 +01:00
Calixte Denizet
9c3471dd01 Don't render corrupted inlined images
Fixes #17794.
2024-03-15 15:33:18 +01:00
Jonas Jenwald
e650b95253
Merge pull request #17714 from Snuffleupagus/Node-fs-promise
Use `fs/promises` in the Node.js-specific code in the `src/`-folder
2024-03-12 18:09:33 +01:00
Calixte Denizet
b4267cd294 [Editor] Add a floating button close to the selected text to highlight it (bug 1867742)
For now keep this feature behind a pref in order to make some experiments before
deciding to enable it.
2024-03-12 15:06:46 +01:00
Jonas Jenwald
70b6ddc5d9 Move the /SetOCGState handling into the OptionalContentConfig class (PR 15377 follow-up)
This helps ensure that /SetOCGState actions always take the `Usage` dictionary into account as expected.
2024-03-12 13:18:15 +01:00
Jonas Jenwald
3c78ff5fb0 [api-minor] Implement basic support for OptionalContent Usage dicts (issue 5764, bug 1826783)
The following are some highlights of this patch:
 - In the Worker we only extract a *subset* of the potential contents of the `Usage` dictionary, to avoid having to implement/test a bunch of code that'd be completely unused in the viewer.

 - In order to still allow the user to *manually* override the default visible layers in the viewer, the viewable/printable state is purposely *not* enforced during initialization in the `OptionalContentConfig` constructor.

 - Printing will now always use the *default* visible layers, rather than using the same state as the viewer (as was the case previously).
   This ensures that the printing-output will correctly take the `Usage` dictionary into account, and in practice toggling of visible layers rarely seem to be necessary except in the viewer itself (if at all).[1]

---
[1] In the unlikely case that it'd ever be deemed necessary to support fine-grained control of optional content visibility during printing, some new (additional) UI would likely be needed to support that case.
2024-03-12 13:18:15 +01:00
Calixte Denizet
f676c2c0c8 [Editor] Improve the accessibility of the highlight editor (bug 1881743) 2024-03-11 14:21:43 +01:00
calixteman
fb9e438442
Merge pull request #17781 from calixteman/stamp_altext_button_cp
[Editor] Make sure the alt-text button is there when pasting an image from an other tab
2024-03-07 21:44:53 +01:00
Calixte Denizet
0f8dda1af0 [Editor] Make sure the alt-text button is there when pasting an image from an other tab 2024-03-07 18:24:34 +01:00
Calixte Denizet
39aeea3e94 [Editor] Add a toggle button to show/hide all the highlights (bug 1867740) 2024-03-07 13:16:59 +01:00
calixteman
9ee4c6528d
Merge pull request #17776 from calixteman/bug1883609
[Annotations] Widget annotations must be in front of the other ones (bug 1883609)
2024-03-06 10:53:11 +01:00
Calixte Denizet
4e1b96c781 [Annotations] Widget annotations must be in front of the other ones (bug 1883609) 2024-03-05 19:04:58 +01:00
Calixte Denizet
bd5875d066 [Editor] Let a free highlight be clipped when its bounding box exceeds the page limits (bug 1883632) 2024-03-05 16:47:07 +01:00
calixteman
c451b6d684
Merge pull request #17764 from calixteman/telemetry_null_stats
[Editor] Use a null instead of an empty stats object when sending the telemetry
2024-03-04 19:16:57 +01:00
calixteman
a55f976e2e
Merge pull request #17766 from calixteman/escape_color_picker
[Editor] Unselect highlight editor when pressing Escape when the focus is on the color picker without a dropdown menu
2024-03-04 19:16:34 +01:00
Calixte Denizet
ecb4262b13 [Editor] Set the creation method for free highlights to 'main_toolbar' (bug 1883394) 2024-03-04 16:58:50 +01:00
Calixte Denizet
1859412507 [Editor] Unselect highlight editor when pressing Escape when the focus is on the color picker without a dropdown menu 2024-03-04 16:32:09 +01:00
Calixte Denizet
d096dc79b2 [Editor] Use a null instead of an empty stats object when sending the telemetry 2024-03-04 10:18:24 +01:00
calixteman
29c493d36b
Merge pull request #17760 from calixteman/fix_quadpoints
[Editor] Fix the quadpoints value when serializing an highlight annotation
2024-03-01 13:08:44 +01:00
Calixte Denizet
30101cbb31 [Editor] Fix the quadpoints value when serializing an highlight annotation
The coordinates of each point in a box are in the page coordinates system.
2024-03-01 11:36:16 +01:00
Jonas Jenwald
61036383b5
Merge pull request #17710 from Snuffleupagus/pr-17277-followup
Simplify the `XMLHttpRequest`-branch in the `fetchData` helper function (PR 17277 follow-up)
2024-03-01 10:23:02 +01:00
Calixte Denizet
7af90bb8bc [Editor] Enable the thickness input when no editors are selected (bug 1881219) 2024-02-29 23:05:33 +01:00
Calixte Denizet
f52bf2836f [Editor] Make the delete button clickable with the space key (bug 1882248) 2024-02-29 19:05:38 +01:00
Calixte Denizet
a9f47e87d5 [Editor] Add the possibility to move the caret with the keyboard once an highlight has been made (bug 1881684) 2024-02-29 18:18:13 +01:00
Jonas Jenwald
a92b38e71c Inline the HighlightEditor.#telemetryType getter at its only call-site (PR 17748 follow-up) 2024-02-28 20:47:01 +01:00
Calixte Denizet
3a7e638fce [Editor] Count the colors used when highlighting whatever the highlight kind is 2024-02-28 18:24:24 +01:00
calixteman
07abd647f4
Merge pull request #17737 from calixteman/highlight_telemetry
[Editor] Add some telemetry for the highlight feature (bug 1866437)
2024-02-28 15:20:57 +01:00
Calixte Denizet
65342d2bee [Editor] Add some telemetry for the highlight feature (bug 1866437) 2024-02-28 10:17:11 +01:00
Calixte Denizet
e0b843d991 Always add links in the annotation layer
Fixes #17730.
2024-02-27 22:48:08 +01:00
calixteman
ca4ab064e5
Merge pull request #17720 from calixteman/editor_simplify_highlighting
[Editor] In caret browsing mode, allow to select in pressing shift and arrow down (bug 1881802)
2024-02-25 17:52:11 +01:00
Calixte Denizet
0520f2f0cb [Editor] In caret browsing mode, allow to select in pressing shift and arrow down (bug 1881802)
In implementing caret browsing mode in pdf.js, I didn't notice that selectstart isn't always triggered.
So this patch removes the use of selectstart and rely only on selectionchange.
In order to simplify the selection management, the selection code is moved in the AnnotationUIManager:
 - it simplifies the code;
 - it allows to have only one listener for selectionchange instead of having one by visible page
   for selectstart.
I had to add a delay in the integration tests for highlighting (there's a comment with an explanation),
it isn't really nice, but it's the only way I found and in real life there always is a delay between
press and release.
2024-02-25 15:35:30 +01:00
Calixte Denizet
fe41e789de Fix the string GlobalConstants.IDS_INVALID_DATE 2024-02-23 21:39:06 +01:00
Jonas Jenwald
346efe919a
Merge pull request #17718 from Snuffleupagus/hexNumbers-tweak
Tweak how the `hexNumbers` Array, used by `Util.makeHexColor`, is built
2024-02-23 18:17:10 +01:00
Calixte Denizet
e1f6f5179f [Editor] Add the possibility to create an highlight from the context menu when some text is selected (bug 1867739) 2024-02-23 16:18:03 +01:00
Jonas Jenwald
49a2aff532 Tweak how the hexNumbers Array, used by Util.makeHexColor, is built
*Please note:* This is a micro optimization, hence I fully understand if the patch is rejected.

Currently we create two temporary Arrays and have to iterate twice in total when building the final `hexNumbers` Array.
With this patch there's only one temporary Array and a single iteration required to build the final `hexNumbers` Array.
2024-02-23 14:20:53 +01:00
Jonas Jenwald
db2849cc17 Use fs/promises in the Node.js-specific code in the src/-folder
This is available in all Node.js versions that we currently support, and using it allows us to remove callback-functions; please see https://nodejs.org/docs/latest-v18.x/api/fs.html#promises-api
2024-02-22 16:50:13 +01:00
Jonas Jenwald
33c5ef349e Simplify the XMLHttpRequest-branch in the fetchData helper function (PR 17277 follow-up) 2024-02-21 23:00:24 +01:00
Jonas Jenwald
eded037d06 [api-minor] Use the Fetch API, when supported, to load PDF documents in Node.js environments
Given that modern Node.js versions now implement support for a fair number of "browser" APIs, we can utilize the standard Fetch API to load PDF documents that are specified via http/https URLs.

Please find compatibility information at:
 - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility
 - https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch
 - https://developer.mozilla.org/en-US/docs/Web/API/Response#browser_compatibility
 - https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#response
2024-02-21 22:38:42 +01:00
calixteman
72b8b29147
Merge pull request #17701 from calixteman/alt_text_ai
[Editor] Add the possibility to query some ML stuff to guess an alt text for an image
2024-02-21 10:14:40 +01:00
Calixte Denizet
46416bb131 [Editor] Add the possibility to query some ML stuff to guess an alt text for an image
It's only for an experimental purpose.
2024-02-20 21:29:33 +01:00
Calixte Denizet
95f9bedc7c [Editor] Disable annotation layer when highlighting (bug 1868759)
When highlighting, the annotation editor layer is disabled to get pointer events
from the text layer, but the annotation layer must be then disabled either in
order to avoid bad interactions.
2024-02-20 21:17:05 +01:00
calixteman
70015ffe6b
Merge pull request #17688 from calixteman/editor_no_scroll_unselect
[Editor] Avoid to scroll when an editor is unselected
2024-02-20 17:00:43 +01:00
Calixte Denizet
a6eadf8150 Avoid to access to a missing cidSystemInfo property
Fixes #17689.
2024-02-19 09:55:23 +01:00
Calixte Denizet
c2fcc66302 [Editor] Avoid to scroll when an editor is unselected 2024-02-18 19:21:45 +01:00
Jonas Jenwald
a7bcc81eb1 Add a dummy beginMarkedContentProps operator when optional content parsing fails (issue 17679) 2024-02-17 13:45:16 +01:00
calixteman
a83a8d7e4f
Merge pull request #17674 from calixteman/issue17671
Fix the endoffset of the last glyph when it's followed by a null offset in the loca table
2024-02-15 10:19:55 +01:00