Commit Graph

17856 Commits

Author SHA1 Message Date
Calixte Denizet
b6b51f57ed [Editor] Avoid to have slightly truncated images because of non-integer canvas dimensions 2023-08-10 14:11:42 +02:00
Jonas Jenwald
4962d005f8
Merge pull request #16815 from Snuffleupagus/more-optional-chaining-3
Introduce even more optional chaining in the code-base
2023-08-10 13:33:20 +02:00
calixteman
f66072b658
Merge pull request #16818 from calixteman/no_cancelled_stamp_in_unod
[Editor] Avoid to add a cancelled added image in the undo/redo stack
2023-08-10 13:19:20 +02:00
Calixte Denizet
b6432ef9de [Editor] Avoid to add a cancelled added image in the undo/redo stack
We're adding the action in the undo/redo stack whatever the status of the
operation was. This patch aims to add the action only when the image has been
successfully added.
2023-08-10 12:18:15 +02:00
Jonas Jenwald
ec7746350d Introduce even more optional chaining in the code-base
This replaces a few more small/simple if-statements with optional chaining.
2023-08-09 17:04:54 +02:00
calixteman
f89020e9b1
Merge pull request #16813 from calixteman/editor_move_params
[Editor] Move the parameter elements for FreeText and Ink annotations at the right place (follow-up of #16802)
2023-08-09 14:06:21 +02:00
calixteman
1447049513
Merge pull request #16812 from calixteman/editor_dont_lose_selection_on_bluring
[Editor] Avoid to unselect some editors when the main window is focused
2023-08-09 14:06:04 +02:00
Calixte Denizet
149f18b766 [Editor] Move the parameter elements for FreeText and Ink annotations at the right place (follow-up of #16802) 2023-08-09 13:35:45 +02:00
Calixte Denizet
9ae7ad0fa6 [Editor] Avoid to unselect some editors when the main window is focused
When several editors are selected and the window loses and then gets back its focus,
the previously focused editor is triggering its focus callback making it the only
selected one.
This patch aims to avoid triggering the focus callback called when the main window
gets its focus back.
2023-08-09 12:09:15 +02:00
calixteman
77392dfce4
Merge pull request #16809 from calixteman/editor_focus_after_moving_in_dom
[Editor] Move an the editor div in the DOM once a translation with the keyboard is done
2023-08-09 10:10:28 +02:00
Calixte Denizet
7d8b53bf7a [Editor] Move an the editor div in the DOM once a translation with the keyboard is done
When moving an element in the DOM, the focus is potentially lost, so we need to make sure
that the focused element before the translation will get back its focus after it.
But we must take care to not execute any focus/blur callbacks because the user didn't
do anything which should trigger such events: it's a detail of implementation. For example,
when several editors are selected and moved, then at the end the same must be selected, so
no element receive a focus event which will set it as selected.
2023-08-08 21:02:05 +02:00
calixteman
ec2b717705
Merge pull request #16808 from calixteman/editor_no_newline_freetext
[Editor] Avoid to add a new line when hitting enter with a selected freetext editor
2023-08-08 20:15:10 +02:00
Calixte Denizet
8f6635bacf [Editor] Avoid to add a new line when hitting enter with a selected freetext editor 2023-08-08 18:24:48 +02:00
calixteman
e914870c14
Merge pull request #16793 from calixteman/editor_resize_rotated
[Editor] Fix the resizing of an editor when it's rotated (bug 1847268)
2023-08-08 18:24:20 +02:00
calixteman
a476000271
Merge pull request #16802 from calixteman/editor_bug1847707
[Editor] Move the stamp button on the right of the pen one (bug 1847707)
2023-08-08 17:09:13 +02:00
Jonas Jenwald
2e9f2e630c
Merge pull request #16804 from Snuffleupagus/issue-16800
Take fill-alpha into account with default icons for FileAttachment annotations (issue 16800)
2023-08-08 16:39:37 +02:00
calixteman
007b46279d
Merge pull request #16807 from calixteman/bug1847733
[Annotation] Strip out the array index in the path only when the path is from a terminal node (bug 1847733)
2023-08-08 16:14:23 +02:00
Jonas Jenwald
e2819d0c67 Take fill-alpha into account with default icons for FileAttachment annotations (issue 16800) 2023-08-08 15:53:48 +02:00
Calixte Denizet
e2f20a1afe [Annotation] Strip out the array index in the path only when the path is from a terminal node (bug 1847733) 2023-08-08 15:05:27 +02:00
calixteman
15c21d7758
Merge pull request #16798 from calixteman/issue16797
[Editor] Fix the dimensions of the annotation editor layer (follow-up of #16794)
2023-08-08 14:06:50 +02:00
Calixte Denizet
aa71619c2d [Editor] Fix the resizing of an editor when it's rotated (bug 1847268)
There are 2 rotation we've to deal with: the viewer one and the editor one.
The previous implementation was a bit complex and having to deal with these
rotation would have potentially increase it.
So this patch aims to simplify the implementation and deal with all the possible
cases.
The main idea is to transform the mouse deltas according to the rotations and then
apply the resizing in the page coordinates system.
2023-08-08 12:54:12 +02:00
Calixte Denizet
35d1f5485e [Editor] Move the stamp button on the right of the pen one (bug 1847707) 2023-08-08 11:35:51 +02:00
Calixte Denizet
400699687e [Editor] Fix the dimensions of the annotation editor layer (follow-up of #16794) 2023-08-08 11:19:04 +02:00
Jonas Jenwald
19c712c2d0
Merge pull request #16799 from Snuffleupagus/editor-resize-cursors
[Editor] Change the resize cursors to bidirectional variants
2023-08-07 08:34:26 +02:00
Jonas Jenwald
8bd45cb260 [Editor] Change the resize cursors to bidirectional variants
When resizing an editor we're currently using unidirectional cursors, please refer to https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
Given that editors can (generally) be resized to become either smaller or larger, it seems overall more appropriate to use bidirectional cursors to make this clearer to the user.

Note that as mentioned in the MDN article some environments, which seems to apply to e.g. Windows 11, doesn't differentiate between the two cursor formats and simply use bidirectional ones unconditionally.

One additional benefit of these changes is that the relevant CSS rules become slightly more compact.
2023-08-06 22:09:15 +02:00
Tim van der Meij
de1f31aae8
Merge pull request #16794 from Snuffleupagus/CSS-round
Use the `round` CSS function in the `setLayerDimensions` helper function
2023-08-06 13:22:07 +02:00
Tim van der Meij
b67c60922f
Merge pull request #16790 from Snuffleupagus/addGlobalExports
Attempt to expose e.g. `pdfjsLib` globally regardless of how the library is imported (issue 16778)
2023-08-06 12:58:58 +02:00
Tim van der Meij
64b33da236
Merge pull request #16795 from Snuffleupagus/update-packages
Update packages and translations
2023-08-06 12:48:30 +02:00
Jonas Jenwald
1182f4965d Update l10n files 2023-08-06 09:25:38 +02:00
Jonas Jenwald
d50237da3c Update npm packages 2023-08-06 09:25:30 +02:00
Jonas Jenwald
e414dfcff7 Use the round CSS function in the setLayerDimensions helper function
This has now been enabled unconditionally in Firefox, see https://bugzilla.mozilla.org/show_bug.cgi?id=1814589

For the `page`-containers in the viewer, this patch should restore the behaviour prior to PR 15770; see e.g. https://github.com/mozilla/pdf.js/pull/15770/files#diff-c48e3561004f5db8f11d5ebab2fd661591222ba911cb4173fbced15f026bac6bL182-L183
Note that these changes this will lead to a tiny bit of movement in some `text` and `annotations` reference tests.

Please find additional information at https://developer.mozilla.org/en-US/docs/Web/CSS/round
2023-08-04 14:33:06 +02:00
calixteman
399475247f
Merge pull request #16781 from calixteman/editor_rewrite_dragging
[Editor] Refactor dragging and dropping an editor (bug 1802895, bug 1844618)
2023-08-03 15:38:12 +02:00
Calixte Denizet
b59b1a81a9 [Editor] Refactor dragging and dropping an editor (bugs 1802895, 1844618)
It'll help to have a full control on what's happening when moving an editor.
2023-08-03 14:47:16 +02:00
calixteman
be29a4dce5
Merge pull request #16786 from calixteman/editor_resizers_blur
[Editor] Stop the resize session when the window is blurred
2023-08-03 13:47:11 +02:00
Jonas Jenwald
42e6243ebf Attempt to expose e.g. pdfjsLib globally regardless of how the library is imported (issue 16778)
We obviously don't want to re-introduce any `require` usage in e.g. the viewer, since we should strive to only use native `import` statements wherever possible.[1]
Hopefully exposing e.g. the library globally in more cases won't break anything, however it's somewhat difficult for me to imagine all the ways in which third-party users may be accessing the PDF.js library. (Given the lack of a runnable test-case in the issue, I also cannot guarantee that this is enough to fully address the problem.)

---
[1] Ideally we should probably not rely on e.g. `pdfjsLib` being globally available in the *built* viewer, and rather always `import` the library instead.
Unfortunately this would require larger (possibly breaking) changes in the builds that we provide, however note that Firefox only recently got support for `import` in workers and that Webpack still only have *experimental* support for outputting "proper" modules.
2023-08-03 12:53:27 +02:00
Calixte Denizet
99c62f9248 [Editor] Stop the resize session when the window is blurred 2023-08-03 10:51:47 +02:00
calixteman
2747928a54
Merge pull request #16784 from calixteman/editor_fix_rescale_svg
[Editor] Use a getter and not a function for the _checkIfSVGFitsInCanvas (bug 1846727)
2023-08-03 10:16:28 +02:00
Calixte Denizet
fcfb2457bc [Editor] Use a getter and not a function for the _checkIfSVGFitsInCanvas (bug 1846727)
It's a followup of #16780.
2023-08-03 09:46:31 +02:00
calixteman
0725b6299f
Merge pull request #16780 from calixteman/editor_fix_rescale_svg
[Editor] Let SVG images be resized horizontally/vertically without keeping the aspect ratio (bug 1846727)
2023-08-02 14:21:21 +02:00
Calixte Denizet
556f42fe52 [Editor] Let SVG images be resized horizontally/vertically without keeping the aspect ratio (bug 1846727) 2023-08-02 12:43:39 +02:00
Jonas Jenwald
e6728f94f4
Merge pull request #16779 from Snuffleupagus/deprecate-getJavaScript
[api-minor] Deprecate the `PDFDocumentProxy.getJavaScript` method
2023-08-01 20:58:36 +02:00
calixteman
4735ed8f16
Merge pull request #16776 from calixteman/gv_print_or_save
[GeckoView] Allow to query pdf.js to know if we can avoid to print a pdf (bug 1846296)
2023-08-01 15:21:10 +02:00
Calixte Denizet
8bd4a18190 [GeckoView] Allow to query pdf.js to know if we can avoid to print a pdf (bug 1846296) 2023-08-01 15:15:04 +02:00
Jonas Jenwald
64e8557fb5 [api-minor] Deprecate the PDFDocumentProxy.getJavaScript method
This method is very old, however with the exception of the auto-print hack (when scripting is disabled) in the viewer it's never actually been used.

Most likely the idea with `PDFDocumentProxy.getJavaScript` was that it'd be useful if scripting support was added, however it turned out that it was a bit too simplistic and instead a number of new methods were added for the scripting use-cases.
2023-08-01 09:02:05 +02:00
calixteman
5b8f680480
Merge pull request #16029 from calixteman/bug1815196
[api-minor] Don't print hidden annotations (bug 1815196)
2023-07-31 20:14:43 +02:00
Calixte Denizet
71960bea64 Don't print hidden annotatons (bug 1815196)
and handle correctly the NoView and NoPrint flags when they're changed
from JS.
2023-07-31 13:04:15 +02:00
calixteman
ce9f94848c
Merge pull request #16773 from calixteman/editor_stamp_input_filter
[Editor] Limit image types to the ones supported by the browser (bug 1846230)
2023-07-31 11:06:21 +02:00
Calixte Denizet
f2bf0ccc4f [Editor] Limit image types to the ones supported by the browser (bug 1846230) 2023-07-31 11:01:28 +02:00
Jonas Jenwald
0e6d141edf
Merge pull request #16771 from Snuffleupagus/gv-dialog-css-vars
[GeckoView] Add missing CSS variables for the dialog functionality
2023-07-30 19:45:09 +02:00
calixteman
621c92dbdd
Merge pull request #16766 from calixteman/fix_willprint
Make sure WillPrint ran before starting printing
2023-07-30 18:37:26 +02:00