Commit Graph

15957 Commits

Author SHA1 Message Date
Calixte Denizet
624b26e1de [Editor] Improve a11y for newly added element (#15109)
- In the annotationEditorLayer, reorder the editors in the DOM according
  the position of the elements on the screen;
- add an aria-owns attribute on the "nearest" element in the text layer
  which points to the added editor.
2022-07-19 18:52:17 +02:00
calixteman
ad15532235
Merge pull request #15179 from calixteman/editor_cp
[Editor] Use serialized data when copying/pasting
2022-07-19 18:31:37 +02:00
calixteman
642676a3b7
Merge pull request #15184 from calixteman/rm_allowclick
[Editor] Simplify the way to create an editor on click
2022-07-19 17:56:07 +02:00
Calixte Denizet
3c17dbb43e [Editor] Use serialized data when copying/pasting
- in using the global clipboard, it'll be possible to copy from a
  pdf and paste in an other one;
- it'll allow to edit a previously created annotation;
- copy the editors in the current page.
2022-07-19 17:54:06 +02:00
Calixte Denizet
7024a53e79 [Editor] Simplify the way to create an editor on click
Previously, we had to set the #allowClick property by hand which was
a bit painful because it's easy to overlook one case or an other.
So with this patch a new editor (for now FreeText one only because the
Ink one is a bit different) is created on the first click if none is selected
on mousedown, else the first click will just commit the data and then the
second will creater a new editor.
2022-07-19 17:41:35 +02:00
Tim van der Meij
5bfba89b0a
Merge pull request #15173 from Snuffleupagus/deprecated-svg
[api-minor] Deprecate the SVG back-end
2022-07-17 12:47:58 +02:00
Jonas Jenwald
290aeaf755 Limit more SVG-specific code to the GENERIC viewer
Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a little bit more unnecessary code in e.g. the Firefox PDF Viewer.
2022-07-16 11:24:09 +02:00
Jonas Jenwald
90bf659b29 [api-minor] Deprecate the SVG back-end 2022-07-16 10:24:24 +02:00
Jonas Jenwald
de7d1d2167
Merge pull request #15170 from calixteman/js_rm_null
[JS] Embedded JS scripts can have some null chars
2022-07-15 17:11:29 +02:00
Jonas Jenwald
75b8647a32
Merge pull request #15169 from Snuffleupagus/loadFont-fontRef
Handle errors in the "Loading by ref" code-path in `PartialEvaluator.loadFont`
2022-07-15 16:40:56 +02:00
Jonas Jenwald
acd61a138e Handle errors in the "Loading by ref" code-path in PartialEvaluator.loadFont
Note how we currently throw a "raw" Error, which is problematical since all of the `PartialEvaluator.loadFont` call-sites expect a Promise to be returned. Furthermore, this also means that we don't benefit from the fallback code-path that now exists below.

*Please note:* Unfortunately I don't have a test-case that fails without this patch, since it's something I happened to notice when reading the code while working on another patch.
2022-07-15 16:33:36 +02:00
Calixte Denizet
5f0c95e70e [JS] Embedded JS scripts can have some null chars 2022-07-15 16:05:25 +02:00
calixteman
3256761ead
Merge pull request #15168 from calixteman/disable_canvas_acc
Disable canvas acceleration for linux tests
2022-07-15 14:43:30 +02:00
Calixte Denizet
ad62ae561c Disable canvas acceleration for linux tests 2022-07-15 13:31:37 +02:00
calixteman
41b2f52f70
Merge pull request #15157 from calixteman/1778484
Add unicode mapping in the font cmap to have correct chars when printing in pdf (bug 1778484)
2022-07-13 14:45:12 +02:00
Calixte Denizet
680c293c34 Add unicode mapping in the font cmap to have correct chars when printing in pdf (bug 1778484)
It aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1778484.
2022-07-13 14:38:27 +02:00
Jonas Jenwald
b4a3fd31c8
Merge pull request #15162 from Snuffleupagus/prefer-logical-operator-over-ternary
Enable the `unicorn/prefer-logical-operator-over-ternary` ESLint plugin rule
2022-07-13 09:50:04 +02:00
calixteman
1301b71b7c
Merge pull request #15163 from calixteman/prepare_touch
[Editor] Always have an ink editor (when in ink mode)
2022-07-12 19:35:32 +02:00
Calixte Denizet
2df2defa02 [Editor] Always have an ink editor (when in ink mode)
Previously it was created only on mouseover event but on a touch screen
there are no fingerover event...
The idea behind creating the ink editor on mouseover was to avoid to have
a canvas on each visible page.
So now, when the editor is created, the canvas has dimensions 1x1 and
only when the user starts drawing the dimensions are set to the page ones.
2022-07-12 19:18:37 +02:00
Jonas Jenwald
dcc73423e5 Enable the unicorn/prefer-logical-operator-over-ternary ESLint plugin rule
This leads to ever so slightly more compact code, and can in some cases remove the need for a temporary variable.

Please find additional information here:
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
2022-07-12 10:52:37 +02:00
calixteman
aa6512e70f
Merge pull request #15159 from calixteman/1778982
[Editor] Avoid to have the ink editor smaller than the resizer (bug 1778982)
2022-07-11 18:53:16 +02:00
Calixte Denizet
1b3c0f1799 [Editor] Avoid to have the ink editor smaller than the resizer (bug 1778982) 2022-07-11 17:00:34 +02:00
Jonas Jenwald
e572bc4e76
Merge pull request #15158 from timvandermeij/ttx
Update `ttx` from version 2.5 to version 3.19.0
2022-07-11 11:05:34 +02:00
Tim van der Meij
3d4476ac53
Update ttx from version 2.5 to version 3.19.0
The current version 2.5 is from September 2014, which is almost 8 years
old now. The new version 3.19.0 is from November 2017, which is still
almost 5 years old, but is a step forward towards eventually using the
most recent version. Note that we currently can't update any further;
see #11802 for the details.

Fortunately using this newer version only required a few changes:

- The `ttx` output regexes needed updating to ignore comments that `ttx`
  now puts after some XML nodes (`<!-- ... -->` and `/* ... */`).
- The `ttx` invocation now explicitly uses `python2` (except on Windows
  where this alias doesn't exist) since otherwise the font tests can't
  be run on modern systems anymore given that `python` is nowadays an
  alias for `python3`, and it now points at the new location of the
  `ttx.py` file since the `Tools` folder got removed.
- The note about needing a 32-bit Python 2.6 version is dropped since
  it's obsolete: this version (and also the existing one already) work
  just fine on a 64-bit Python 2.7 as well.
2022-07-10 21:18:36 +02:00
Jonas Jenwald
0205597bd0
Merge pull request #15154 from Snuffleupagus/xfa-rm-id
Replace element `id`s with custom attributes in the xfaLayer
2022-07-10 16:06:17 +02:00
Jonas Jenwald
4b7bf74da2 Replace element ids with custom attributes in the xfaLayer
We want to avoid adding regular `id`s to xfaLayer-elements, since that means that they become "linkable" through the URL hash in a way that's not supported/intended. This could end up clashing with "named destinations", and that could easily lead to bugs; see issue 11499 and PR 11503 for some context.

Rather than using `id`s, we'll instead use a *custom* `data-element-id` attribute such that it's still possible to access the DOM-elements directly if needed. *Please note:* This is basically the xfaLayer-equivalent of PR 15057.
2022-07-10 15:44:54 +02:00
Tim van der Meij
fb1340f74b
Merge pull request #15155 from Snuffleupagus/update-packages
Update packages and translations
2022-07-10 12:49:41 +02:00
Jonas Jenwald
e4a7264564 Update l10n files 2022-07-10 10:45:22 +02:00
Jonas Jenwald
dd10f6397f Update npm packages 2022-07-10 10:43:08 +02:00
Tim van der Meij
220f980e12
Merge pull request #15145 from Snuffleupagus/deprecated-enhanceTextSelection
[api-minor] Deprecate the `enhanceTextSelection` functionality
2022-07-09 12:38:41 +02:00
calixteman
2b6a67c5d0
Merge pull request #15153 from calixteman/1778692
[Annotation] A push button can have no action (bug 1778692)
2022-07-08 21:06:53 +02:00
Calixte Denizet
8f26ba5487 [Annotation] A push button can have no action (bug 1778692) 2022-07-08 15:39:56 +02:00
Jonas Jenwald
4b493c2c33
Merge pull request #15152 from Snuffleupagus/validate-Resources
Ensure that the /Resources-entry is actually a dictionary (issue 15150)
2022-07-08 13:24:47 +02:00
Jonas Jenwald
c2f7942aea Ensure that the /Resources-entry is actually a dictionary (issue 15150)
Prevent issues in *corrupt* PDF documents, if the /Resources-entry is not of the correct and expected type.
2022-07-08 12:43:43 +02:00
Jonas Jenwald
efbd429115
Merge pull request #15151 from calixteman/15149
[Editor] Remove useless and faulty code when destroying the global manager
2022-07-08 11:58:14 +02:00
Calixte Denizet
cec2172225 [Editor] Remove useless and faulty code when destroying the global manager 2022-07-08 11:49:19 +02:00
calixteman
b0a3c9e8cf
Merge pull request #15135 from calixteman/forced_colors
Use default colors only in forced-colors mode (bug 1778068)
2022-07-07 20:30:03 +02:00
calixteman
657edb3892
Merge pull request #15147 from calixteman/editor_size
[Editor] Avoid to resize and redraw the ink canvas when it's useless
2022-07-07 19:49:59 +02:00
Calixte Denizet
fe93742c8f Use default colors only in forced-colors mode (bug 1778068) 2022-07-07 19:36:03 +02:00
Jonas Jenwald
d6a75262d5
Merge pull request #15143 from bernatgy/typescript-compilation-fix
[jsdoc] failing typescript builds - wrong type
2022-07-07 19:27:53 +02:00
calixteman
32d8c55642
Merge pull request #15146 from calixteman/editing_cursor
[Editor] Change the cursor to a pen for the Ink editor
2022-07-07 18:43:41 +02:00
Calixte Denizet
9c4077ebc4 [Editor] Avoid to resize and redraw the ink canvas when it's useless
- and because of rounding errors it led to slightly resize again and again
the ink container;
- when zooming the size is changing but not the ratio, so in this case we
don't need to change the dimension of the container.
2022-07-07 18:39:20 +02:00
Calixte Denizet
edc9ad13bf [Editor] Change the cursor to a pen for the Ink editor 2022-07-07 18:23:59 +02:00
Bernát Gyovai
3d62f09fbd [jsdoc] failing typescript builds - wrong type
`HTMLSectionElement` is not part of the DOM, so the generated typescript definitions contain a non-existing type.

HTML Section elements have to be handled as simple `HTMLElements`.

fixing punctuation and lint problems

[jsdoc] failing typescript builds - wrong type
2022-07-07 17:03:46 +02:00
Jonas Jenwald
815c28da0e [api-minor] Deprecate the enhanceTextSelection functionality 2022-07-07 16:15:31 +02:00
calixteman
403ed07ad9
Merge pull request #15144 from calixteman/editing_delete
[Editor] Allow editors deletion on Backspace or Delete keys
2022-07-07 15:37:06 +02:00
Calixte Denizet
a4329d326c [Editor] Allow editors deletion on Backspace or Delete keys 2022-07-07 15:16:01 +02:00
Jonas Jenwald
7f160d49f9
Merge pull request #15142 from Snuffleupagus/fitCurve
[editor] Use the `fit-curve` package (issue 15004)
2022-07-07 14:03:14 +02:00
Jonas Jenwald
345bb18575 [editor] Use the fit-curve package (issue 15004)
Rather than including all of this external code in the PDF.js repository, we should be using the npm package instead.
Unfortunately this is slightly more complicated than you'd hope, since the `fit-curve` package (which is older) isn't directly compatible with modern JavaScript modules.
In particular, the following cases needed to be considered:
 - For the development viewer (i.e. `gulp server`) and the unit-tests, we thus need to build a fitCurve-bundle that can be directly `import`ed.
 - For the actual PDF.js build-targets, we can slightly reduce the sizes by depending on the "raw" `fit-curve` source-code.
 - For the Node.js unit-tests, the `fit-curve` package can be used as-is.
2022-07-07 10:43:43 +02:00
Jonas Jenwald
bde46632d4
Merge pull request #15130 from calixteman/context_menu
[Editor] Dispatch an event when some global states are changing (bug 1777695)
2022-07-05 22:40:12 +02:00