Commit Graph

18356 Commits

Author SHA1 Message Date
Calixte Denizet
1ea6293923 [Editor] Add a new editor to highlight some text in a pdf (bug 1866119)
This patch is first big step for the new highlight feature.
Few patches will follow in order to conform to the specs UX/UI gave us.
2023-11-28 14:21:53 +01:00
calixteman
4bf7ff2027
Merge pull request #17344 from calixteman/issue17342
[Editor] Avoid to add a new ink editor when we aren't editing anymore
2023-11-27 16:53:48 +01:00
Calixte Denizet
2be136ab70 [Editor] Avoid to add a new ink editor when we aren't editing anymore 2023-11-27 16:18:31 +01:00
calixteman
b7e943bc7d
Merge pull request #17340 from calixteman/issue17332
Don't throw when there isn't enough data to get block info in flate stream
2023-11-26 19:23:25 +01:00
Calixte Denizet
52ea20eda4 Don't throw when there isn't enough data to get block info in flate stream
but just ends the stream.
2023-11-26 18:12:22 +01:00
Tim van der Meij
02a0189795
Merge pull request #17339 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2023-11-26 13:50:08 +01:00
Tim van der Meij
dd07267da6
Bump the stable version in pdfjs.config 2023-11-26 13:46:23 +01:00
Tim van der Meij
f4b396f6c8
Merge pull request #17334 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2023-11-25 19:42:40 +01:00
Tim van der Meij
ab692f805a
Update translations to the most recent versions 2023-11-25 19:34:44 +01:00
Tim van der Meij
dd7ff7e662
Update the JSDoc comments for the new TypeScript version
This commit fixes the JSDoc comment for the `annotationEditorMode` setter.
The types tests fail on that now because the input value was changed from
a number to an object with various properties in recent patches, but the
JSDoc comment was not updated accordingly.

Moreover, the types tests also fail because TypeScript 5.3 assumes that
getters and setters have equal return and input value types, which is
arguably also what one would expect, but our `annotationEditorMode`
getter and setter deviate from that because the getter returns a number
while the setter accepts an object. Given that it seems more important
to document the setter entirely, including the meaning and types of its
properties, and the type of the getter can easily be inferred from this
comment and the other JSDoc comments that have `annotationEditorMode` in
it, we remove the getter type to make the types tests pass again.
2023-11-25 19:34:44 +01:00
Tim van der Meij
8aa26fad24
Update the code style for the new Prettier version
This patch is automatically generated using `gulp lint --fix`.
2023-11-25 18:15:09 +01:00
Tim van der Meij
7381515e20
Update dependencies to the most recent versions 2023-11-25 17:25:35 +01:00
calixteman
9d863f5180
Merge pull request #17331 from calixteman/lang_marker
Remove language codes from text strings.
2023-11-25 16:43:37 +01:00
Calixte Denizet
eb5f610d18 Remove language codes from text strings.
And take care to have an even number of bytes with utf16 strings.
2023-11-25 15:09:31 +01:00
Tim van der Meij
4b1de1537f
Merge pull request #17320 from tamuratak/fix_webpack_readme
Fix examples/webpack/README.md.
2023-11-25 12:49:04 +01:00
Jonas Jenwald
3d9f68cb97
Merge pull request #17328 from Snuffleupagus/fetchData-blob
Use the `fetchData` helper function in more cases
2023-11-25 08:31:12 +01:00
calixteman
58316369e5
Merge pull request #17330 from calixteman/issue17327
[Editor] Only focus the canvas for mouse events when drawing in the canvas
2023-11-24 19:09:18 +01:00
Calixte Denizet
42147e8839 [Editor] Only focus the canvas for mouse events when drawing in the canvas
And if we've to focus it, we must prevent scrolling to avoid to draw at an
unexpected position.
2023-11-24 16:00:04 +01:00
Jonas Jenwald
fd7a7e2859 Use the fetchData helper function in more cases
- Extend the `fetchData` helper function to also support fetching of "blob" data.

 - Use the `fetchData` helper function more in the code-base, when fetching non-PDF data. Given that the Fetch API isn't supported for all protocols, this should improve compatibility for the PDF.js library.
2023-11-24 13:05:57 +01:00
calixteman
d679078beb
Merge pull request #17318 from calixteman/bug1864136_2
Make sure that only one radio button is checked in its group (bug 1864136)
2023-11-24 08:40:23 +01:00
Calixte Denizet
1f0f51613a Make sure that only one radio button is checked in its group (bug 1864136)
When the first checked radio is met, the others in the group are set to false.
2023-11-23 17:01:49 +01:00
Takashi Tamura
6e7381bc20 Fix examples/webpack/README.md. The .mjs extension is necessary. Close #17319 2023-11-23 09:25:20 +09:00
Jonas Jenwald
5781e722bf
Merge pull request #17294 from Snuffleupagus/toolbarViewerRight-reorder
Move the editor-buttons in the main toolbar
2023-11-22 14:06:24 +01:00
Jonas Jenwald
5df7c97074 Move the editor-buttons in the main toolbar
By introducing a CSS variable for the editor-toolbars we're able to handle resizing of the viewer without complicating the code too much.
2023-11-22 13:04:05 +01:00
calixteman
09ff1b98ee
Merge pull request #17304 from calixteman/editor_highlight2
[Editor] Add support for saving/printing a newly added Highlight annotation (bug 1865708)
2023-11-22 12:23:27 +01:00
Calixte Denizet
f8f4432961 [Editor] Add support for saving/printing a newly added Highlight annotation (bug 1865708) 2023-11-22 10:41:55 +01:00
Jonas Jenwald
83f0029212
Merge pull request #17287 from Snuffleupagus/CSS-loading-icon
Re-factor the loading-icons used in the viewer toolbars
2023-11-21 14:11:55 +01:00
Jonas Jenwald
625d4f794e Re-factor the loading-icons used in the viewer toolbars
Currently the SVG images for the loading-icons exist in two versions, for the light- respectively dark-theme, which nowadays are the only "duplicated" icons left.
The reason for this is that these icons are being used in `input`-elements, where the regular `mask-image` approach used for all buttons don't work.

To address this we add containers for the `input`-elements, such that we have a "regular" DOM-element where we can use `mask-image`.
2023-11-21 13:55:36 +01:00
calixteman
02ccdbb2b1
Merge pull request #17291 from calixteman/editor_highlight1
[Editor] Add a way to extract the outlines of a union of rectangles
2023-11-21 10:56:18 +01:00
Jonas Jenwald
086a5921dc
Merge pull request #17303 from Snuffleupagus/issue-17302
Throw a `JpegError` when a JPEG image has no frame data (issue 17302)
2023-11-20 18:53:35 +01:00
Calixte Denizet
31d9b9f574 [Editor] Add a way to extract the outlines of a union of rectangles
The goal is to be able to get these outlines to fill the shape corresponding
to a text selection in order to highlight some text contents.
The outlines will be used either to show selected/hovered highlights.
2023-11-20 18:45:19 +01:00
Jonas Jenwald
a6f0609a6e Throw a JpegError when a JPEG image has no frame data (issue 17302)
Given that there's nothing to parse in this case, since we're dealing with an invalid JPEG image, throwing an *explicit* Error makes sense here.
2023-11-20 17:33:49 +01:00
calixteman
d8424a43ba
Merge pull request #17300 from calixteman/issue17299
[Editor] Make the alt-text button large enough to display correctly whatever string
2023-11-20 15:45:53 +01:00
Calixte Denizet
bd6c2a192c [Editor] Make the alt-text button large enough to display correctly whatever string 2023-11-20 13:22:02 +01:00
calixteman
3459615ec3
Merge pull request #17293 from calixteman/dark
Restore the option to set light/dark mode for chromium and generic builds
2023-11-18 21:48:09 +01:00
Calixte Denizet
53101b379b Restore the option to set light/dark mode for chromium and generic builds 2023-11-18 21:32:25 +01:00
calixteman
ffbfd680ec
Merge pull request #17281 from calixteman/delete_button_tooltip
[Editor] Add a tooltip to the delete button
2023-11-15 12:59:52 +01:00
Calixte Denizet
b7d28a3bf6 [Editor] Add a tooltip to the delete button 2023-11-15 10:51:39 +01:00
Jonas Jenwald
1df648733e
Merge pull request #17277 from Snuffleupagus/L10n-fetchData
Re-factor how the `GenericL10n` class fetches localization-data
2023-11-14 16:09:05 +01:00
Jonas Jenwald
5099dc4699
Merge pull request #17273 from Snuffleupagus/L10n-lowercase-locales
Re-factor the `L10n`-implementations to use lowercase language-codes internally
2023-11-14 15:59:13 +01:00
Jonas Jenwald
709d89420e Re-factor how the GenericL10n class fetches localization-data
- Re-factor the existing `fetchData` helper function such that it can fetch more types of data, and it now supports "arraybuffer", "json", and "text".
   This only needed minor adjustments in the `DOMCMapReaderFactory` and `DOMStandardFontDataFactory` classes.[1]

 - Expose the `fetchData` helper function in the API, such that the viewer is able to access it.

 - Use the `fetchData` helper function in the `GenericL10n` class, since this should allow fetching of localization-data even if the default viewer is run in an environment without support for the Fetch API.

---
[1] While testing this I also noticed a minor inconsistency when handling standard font-data on the worker-thread.
2023-11-14 13:45:14 +01:00
Jonas Jenwald
1f9533bae9 Re-factor the L10n-implementations to use lowercase language-codes internally
This is consistent with the implementation used in the (now removed) webL10n-library, and by only using lowercase language-codes internally in the `L10n`-implementations we should avoid future issues e.g. when users manually set the `locale`-option (in the default viewer).
2023-11-13 21:06:03 +01:00
Jonas Jenwald
44cde3ccca
Merge pull request #17263 from timvandermeij/font-tests
Introduce a GitHub Actions workflow for running the font tests
2023-11-13 17:43:08 +01:00
calixteman
787d092ecb
Merge pull request #17271 from calixteman/maif
Get the field name from its parent when it doesn't have one when collecting fields (bug 1864136)
2023-11-13 15:57:42 +01:00
Calixte Denizet
09b4fe6a30 Get the field name from its parent when it doesn't have one when collecting fields (bug 1864136)
Some fields, somewhere under the Fields entry in Acroform, could have no name (in T)
but with a parent which has a name but which isn't somewhere under Fields.
As a side-effect, this patch prevents infinite loops because of potential cycles
under Fields.
2023-11-13 14:41:14 +01:00
Jonas Jenwald
096c5fe2b5
Merge pull request #17272 from Snuffleupagus/issue-17254
Fix typo in the `--hcm-highlight-filter` CSS variable name (issue 17254)
2023-11-13 11:34:02 +01:00
Jonas Jenwald
90864a5672 Fix typo in the --hcm-highlight-filter CSS variable name (issue 17254) 2023-11-13 11:18:35 +01:00
Jonas Jenwald
7b89e7e0d2
Merge pull request #17270 from Snuffleupagus/issue-17269
[GENERIC viewer] Fallback to the short-format of the language code (issue 17269)
2023-11-13 11:10:33 +01:00
Jonas Jenwald
3f7fd2f035 [GENERIC viewer] Fallback to the short-format of the language code (issue 17269)
This shouldn't cause any issues, since `GenericL10n.#createBundle` has an early return for languages that don't exist in the `locale.json` file.
2023-11-13 10:04:48 +01:00
Tim van der Meij
8157f39c62
Introduce a GitHub Actions workflow for running the font tests
This commit migrates the font tests away from the bots. Not only are the
font tests broken on the Windows bot since some time, they also run on
Python 2 (end of life since January 2020) and `ttx` 3.19.0 (released in
November 2017). The latter is installed via a submodule, which requires
more complicated logic for finding and running `ttx`.

We solve the issues by implementing a modern workflow that installs the
most recent stable Python and `ttx` (`fonttools` package) versions. This
simplifies the `ttx` driver code as well because it can now assume `ttx`
is available on the path (just like we do for e.g. `node` invocations).
GitHub Actions takes care of creating a virtual environment with
`fonttools` in it so that the `ttx`  entrypoint is available. Locally
the font tests can be run in a similar way by creating and sourcing a
virtual environment with `fonttools` in it before running the font
tests, and a README file is included with instructions for doing so.
2023-11-12 17:48:04 +01:00