Commit Graph

16146 Commits

Author SHA1 Message Date
Calixte Denizet
85f3e23e7f [Editor] Fix few keyboard shortcuts on mac 2022-07-24 22:22:27 +02:00
Jonas Jenwald
37dc0e7d6e Limit the PDFPageView._isStandalone handling to the GENERIC viewer
This code is completely unnecessary in e.g. the Firefox PDF Viewer.
2022-07-24 17:29:37 +02:00
Jonas Jenwald
3446f15bf3 Improve how we disable PDFThumbnailView.setImage for documents with Optional Content (PR 12170 follow-up)
Rather than always disable `PDFThumbnailView.setImage` as soon as user has changed the visibility of the Optional Content, we can utilize the new method added in the previous patch to improve thumbnail performance. Note in particular how, in the old code, even *resetting* of the Optional Content to its default state wouldn't enable `PDFThumbnailView.setImage` again.

While slightly unrelated, this patch also removes the `PDFThumbnailViewer._optionalContentConfigPromise`-property since it's completely unused.
2022-07-24 17:29:37 +02:00
Jonas Jenwald
ceb4f8a6ab [api-minor] Add a new method, in OptionalContentConfig, to detect the initial Optional Content visibility state
This will allow us to improve the `PDFThumbnailView.setImage` handling in the viewer, and thanks to the added caching this should be reasonbly efficient.
2022-07-24 17:29:37 +02:00
Jonas Jenwald
f3d76b42b3 Ensure that OptionalContentGroup.visible cannot be modified from the "outside"
Given that Optional Content visibility is only intended/supported to be updated via the `OptionalContentConfig.setVisibility`-method, this patch actually enforces that now.
Note that this will be used by the next patch in the series, and will help prevent inconsistent state in the `OptionalContentConfig`-class.

*Please note:* This patch also uncovered a pre-existing bug, related to iterating through the visibility groups in the constructor, for the `baseState === "OFF"` case.
2022-07-24 17:28:08 +02:00
Jonas Jenwald
2d6ebc5801 Convert the OptionalContentConfig to use *properly* private fields/methods
To ensure that this data cannot be directly changed from the outside, use private fields/methods now that those are available.
2022-07-24 13:40:59 +02:00
Tim van der Meij
9cc5260b68
Merge pull request #15214 from Snuffleupagus/update-packages
Update packages and translations
2022-07-24 12:17:47 +02:00
Jonas Jenwald
ca9172ddec Update l10n files 2022-07-24 08:56:47 +02:00
Jonas Jenwald
878e2f726a Update npm packages 2022-07-24 08:54:23 +02:00
Jonas Jenwald
bf00068731
Merge pull request #15211 from calixteman/selection
[Editor] Fix multi-selection on touch screens
2022-07-22 16:55:12 +02:00
Calixte Denizet
a118e268af [Editor] Fix multi-selection on touch screens 2022-07-22 16:11:58 +02:00
calixteman
71db08a139
Merge pull request #15188 from calixteman/touch
[Editor] Replace mouse events by pointer ones (bug 1779015)
2022-07-22 14:14:38 +02:00
Calixte Denizet
7b25b39a17 [Editor] Replace mouse events by pointer ones (bug 1779015)
The goal is to be able to edit a pdf on a touchscreen.
2022-07-22 13:46:39 +02:00
calixteman
185102bd69
Merge pull request #15210 from calixteman/ink_select
[Editor] Unselect correctly removed editors
2022-07-22 13:31:08 +02:00
Calixte Denizet
5bbe0d0782 [Editor] Unselect correctly removed editors
- After undoing a deletion of several editors, they appeared to be selected (they had a red border)
when in fact they were not, consequently, this patch aims to remove the selectedEditor class when
an editor is removed;
- Add a test with some ink editors.
2022-07-22 13:21:08 +02:00
calixteman
6138e16ce2
Merge pull request #15200 from calixteman/multiple_selection
[Editor] Add the ability to make multiple selections (bug 1779582)
2022-07-21 23:15:16 +02:00
Calixte Denizet
d6b9ca48a5 [Editor] Add the ability to make multiple selections (bug 1779582)
- several editors can be selected/unselected using ctrl+click;
- and then they can be copied, pasted, their properties can be changed.
2022-07-21 22:53:52 +02:00
calixteman
9fe4a667bd
Merge pull request #15206 from calixteman/simplify_command_manager
[Editor] Simplify the command manager
2022-07-21 22:13:49 +02:00
Tim van der Meij
e2f6ec83d6
Merge pull request #15183 from Snuffleupagus/rm-svgviewer-example
Remove the `svgviewer` example
2022-07-21 20:18:54 +02:00
Calixte Denizet
af41a5cb49 [Editor] Simplify the command manager
The previous version was maybe functional but definitely painful to maintain
(maybe more efficient... I don't know) so this patch aims to simplify it and
it adds some basic unit tests.
2022-07-21 18:44:41 +02:00
Jonas Jenwald
f4e60ae986 Limit even 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 bit more unnecessary code in e.g. the Firefox PDF Viewer.
2022-07-21 10:03:02 +02:00
Jonas Jenwald
bf7eef7109 Remove the svgviewer example
Given that the SVG back-end is now deprecated, we probably don't need to keep this example around any more.
2022-07-21 09:59:10 +02:00
Jonas Jenwald
5e7eab4dd8
Merge pull request #15196 from calixteman/zindex
[Editor] Add a z-index in order to draw them in the right order
2022-07-21 09:38:12 +02:00
Jonas Jenwald
c78fbe5282
Merge pull request #15199 from mozilla/dependabot/npm_and_yarn/terser-5.14.2
Bump terser from 5.14.1 to 5.14.2
2022-07-21 09:17:41 +02:00
dependabot[bot]
a5b50d06bd
Bump terser from 5.14.1 to 5.14.2
Bumps [terser](https://github.com/terser/terser) from 5.14.1 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-21 06:01:41 +00:00
Calixte Denizet
a7a5e98b7e [Editor] Add a z-index in order to draw them in the right order
The elements in the annotationEditor layer are rearranged to make them
more accessible, but we must draw them in the order they have been created,
hence this patch adds a z-index to the editors.
2022-07-20 15:47:43 +02:00
calixteman
408c10b5bb
Merge pull request #15195 from calixteman/empty_editor
[Editor] No need to click twice to create an editor when the last one is empty
2022-07-20 14:29:16 +02:00
Calixte Denizet
6d0676fd86 [Editor] No need to click twice to create an editor when the last one is empty 2022-07-20 14:15:00 +02:00
Jonas Jenwald
a9fc8792c8
Merge pull request #15192 from Snuffleupagus/issue-15139
Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
2022-07-20 12:45:04 +02:00
calixteman
f18a27bee9
Merge pull request #15186 from calixteman/freetext_commit
[Editor] Move the keyboard manager at the container level
2022-07-20 12:38:31 +02:00
Calixte Denizet
e1f28d3504 [Editor] Move the keyboard manager at the container level
- This way, the keyboard callbacks are called even if the page has not
the focus, hence the user doesn't have to guess that they have to click
on the page which is a bit painful especially in Ink mode.
- Add two keyboard shortcuts to commit a Freetext editor (ctrl+enter and
escape).
2022-07-20 12:24:30 +02:00
Jonas Jenwald
60bd9580e2 Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
In the referenced PDF document the fonts have /CIDToGIDMap-entries that cannot be loaded. Hence, only when `ignoreErrors` is set, we'll now ignore these corrupt /CIDToGIDMap-entries and fallback to simply assume that no such data is available.

Given that this is *clearly* a case of a corrupt PDF document, there's no guarantee that this will "fix" things in the general case since a /CIDToGIDMap may be *required* in order for some composite fonts to render correctly. However, attempting to render *something* is surely better than skipping a font altogether.
2022-07-20 11:58:44 +02:00
calixteman
7a4b72ed11
Merge pull request #15185 from calixteman/ink_translation
[Editor] Ink editor was too much translated after commit
2022-07-20 10:34:37 +02:00
calixteman
33d7a35515
Merge pull request #15187 from calixteman/rm_useless_ed
[Editor] Remove useless and potentially deleted editors
2022-07-20 10:04:22 +02:00
Calixte Denizet
964fb77fa5 [Editor] Remove useless and potentially deleted editors
After a deletion, a reference on a deleted editor can still be used
(for example in changing the font size just after having deleted all
editors).
2022-07-19 23:04:33 +02:00
Jonas Jenwald
f46895d750
Merge pull request #15110 from calixteman/editing_a11y
[Editor] Improve a11y for newly added element (#15109)
2022-07-19 20:02:53 +02:00
Jonas Jenwald
98f70d87f6
Merge pull request #15174 from Snuffleupagus/more-for-of
Use more `for...of` loops in the code-base
2022-07-19 19:04:47 +02:00
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
Calixte Denizet
35671127d9 [Editor] Ink editor was too much translated after commit
The problem is clearly visible when the thickness is at max.
It's mainly because the thickness was not taken into account when
translating the div but it was when the line is drawn on the canvas.
2022-07-19 17:33:34 +02:00
Jonas Jenwald
37ebc28756 Use more for...of loops in the code-base
Note that these cases, which are all in older code, were found using the [`unicorn/no-for-loop`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md) ESLint plugin rule.
However, note that I've opted not to enable this rule by default since there's still *some* cases where I do think that it makes sense to allow "regular" for-loops.
2022-07-17 16:18:54 +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