Commit Graph

17734 Commits

Author SHA1 Message Date
Jonas Jenwald
df9cb772d9 Add a helper method to reduce duplication in StampEditor.#getBitmap
Currently we're repeating virtually the same code *four times* when fetching the bitmap-data, which seems unnecessary.

Also, ensure that the `#bitmapPromise` is always `null`ed by moving that into the `StampEditor.#getBitmapDone` method.
2023-08-17 08:36:07 +02:00
Jonas Jenwald
c72cb5436d
Merge pull request #16835 from Snuffleupagus/improve-Annotation-compression-test
Improve the "write a new annotation, save the pdf and check that the text content is correct" unit-test (PR 16559 follow-up)
2023-08-15 16:44:18 +02:00
Jonas Jenwald
29b2050ac2 Improve the "write a new annotation, save the pdf and check that the text content is correct" unit-test (PR 16559 follow-up)
Currently this unit-test will pass just fine if compression is disabled, e.g. by commenting out the relevant code in the `src/core/writer.js` file.
While we don't have a simple way of *directly* checking that the Annotation text-content is compressed, we can however use the resulting file-size as a fairly good proxy. (Note that if compression is disabled the file-size is more than doubled.)
2023-08-15 15:12:17 +02:00
Tim van der Meij
8cf2f6d352
Merge pull request #16830 from Snuffleupagus/issue-16777-2
Avoid using the global `workerPort` when destruction has started, but not yet finished (issue 16777)
2023-08-13 12:18:28 +02:00
Tim van der Meij
43ab1d2da7
Merge pull request #16831 from Snuffleupagus/rm-no-babel-preset
Remove the "no-babel-preset" comment used with the LIB build-target (PR 16829 follow-up)
2023-08-13 12:09:43 +02:00
Jonas Jenwald
6669a99299 Remove the "no-babel-preset" comment used with the LIB build-target (PR 16829 follow-up)
Similar to the changes in PR 16829, this no longer seems necessary now.
2023-08-13 08:55:58 +02:00
Jonas Jenwald
66437917db Avoid using the global workerPort when destruction has started, but not yet finished (issue 16777)
Given that the `PDFDocumentLoadingTask.destroy()`-method is documented as being asynchronous, you thus need to await its completion before attempting to load a new PDF document when using the global `workerPort`.
If you don't await destruction as intended then a new `getDocument`-call can remain pending indefinitely, without any kind of indication of the problem, as shown in the issue.

In order to improve the current situation, without unnecessarily complicating the API-implementation, we'll now throw during the `getDocument`-call if the global `workerPort` is in the process of being destroyed.
This part of the code-base has apparently never been covered by any tests, hence the patch adds unit-tests for both the *correct* usage (awaiting destruction) as well as the specific case outlined in the issue.
2023-08-12 21:21:50 +02:00
Tim van der Meij
690b873897
Merge pull request #16829 from Snuffleupagus/gulpfile-rm-src-babel-excludes
Remove the `src/core/` Babel excludes, since they no longer seem necessary
2023-08-12 13:35:31 +02:00
Jonas Jenwald
1810191be2 Remove the src/core/ Babel excludes, since they no longer seem necessary
- The `src/core/unicode.js` exclude ought to have become unnecessary already with PR 16200, which significantly shortened and simplified that file.
 - The `src/core/glyphlist.js` exclude no longer seems necessary in practice either, possibly because of improvements in Babel.
2023-08-12 10:09:03 +02:00
calixteman
890550653a
Merge pull request #16828 from calixteman/editor_paste_image
[Editor] Add the possibility to paste an image from the clipboard (bug 1848317)
2023-08-11 22:28:33 +02:00
Calixte Denizet
2dd6f07b57 [Editor] Add the possibility to paste an image from the clipboard (bug 1848317) 2023-08-11 19:49:18 +02:00
calixteman
4b2eebf32e
Merge pull request #16826 from calixteman/editor_remove_empty_stamp
[Editor] Remove the stamp editor displayed when the image was loading (bug 1848313)
2023-08-11 17:17:45 +02:00
Calixte Denizet
d527fb3ff2 [Editor] Remove the stamp editor displayed when the image was loading (bug 1848313)
Make the annotation editor layer unclickable while the image is loading and
change the cursor to 'wait'.
2023-08-11 16:46:23 +02:00
calixteman
4eca3ca199
Merge pull request #16819 from calixteman/editor_stamp_button
[Editor] Add a button to explicitly add an image (bug 1848108)
2023-08-11 15:32:47 +02:00
Calixte Denizet
659fbc5020 [Editor] Add a button to explicitly add an image (bug 1848108)
The main stamp button will be used to just enter in a add/edit image mode:
 - the user can add a new image in using the new button.
 - the user can edit an image in resizing, moving it.
In image mode, when the user clicks outside on the page but not on an editor,
then all the selected editors will be unselected.
2023-08-11 15:05:46 +02:00
Jonas Jenwald
d57e3ebbe4
Merge pull request #16810 from Snuffleupagus/_initializeAutoPrint-refactor
Re-factor `PDFViewerApplication._initializeAutoPrint` slightly (PR 16779 follow-up)
2023-08-11 08:49:45 +02:00
Jonas Jenwald
caebe335b2 Re-factor PDFViewerApplication._initializeAutoPrint slightly (PR 16779 follow-up)
After the `src/core/`-changes in PR 16779 the `PDFDocumentProxy.getJSActions` method should no longer be able to return *empty* entries, which means that we can simplify the "JavaScript support is not enabled"-warning in the viewer.
Furthermore, improve the auto-printing hack used when scripting is disabled.
2023-08-10 21:36:08 +02:00
calixteman
1d523d3ec1
Merge pull request #16825 from calixteman/editor_avoid_right_click
[Editor] Avoid showing the context menu or resizing when a resizer is right clicked
2023-08-10 18:37:59 +02:00
calixteman
0dd70c4e66
Merge pull request #16824 from calixteman/editor_dont_unselect_on_render
[Editor] Avoid to unselect when a new page is rendered
2023-08-10 18:37:42 +02:00
Calixte Denizet
96a1f323c4 [Editor] Avoid showing the context menu or resizing when a resizer is right clicked 2023-08-10 18:24:57 +02:00
Jonas Jenwald
f1bd98c6d8
Merge pull request #16823 from Snuffleupagus/_getPageIndex-fallback
Fallback to check all pages when getting the pageIndex of FieldObjects
2023-08-10 18:06:54 +02:00
Calixte Denizet
71f5050ed2 [Editor] Avoid to unselect when a new page is rendered 2023-08-10 18:02:27 +02:00
Jonas Jenwald
389a26c115 Fallback to check all pages when getting the pageIndex of FieldObjects
Given that the FieldObjects are parsed in parallel, in combination with the existing caching in the `getPage`-method and `annotations`-getter, adding additional caches for this fallback code-path doesn't seem entirely necessary.
2023-08-10 17:10:04 +02:00
calixteman
4be6c90796
Merge pull request #16822 from calixteman/issue16821
[Editor] Don't forget to encrypt image streams (see issue #16821)
2023-08-10 16:18:17 +02:00
calixteman
ea259710fa
Merge pull request #16811 from calixteman/editor_drag_selected
[Editor] Add the possibility to move all the selected editors with the mouse (bug 1847894)
2023-08-10 15:23:34 +02:00
Calixte Denizet
7a5b3423d6 [Editor] Don't forget to encrypt image streams (see issue #16821)
and encrypt a compressed stream after having been compressed.
2023-08-10 15:19:45 +02:00
Calixte Denizet
402e3fed95 [Editor] Add the possibility to move all the selected editors with the mouse (bug 1847894) 2023-08-10 14:45:36 +02:00
calixteman
d4ba312f00
Merge pull request #16820 from calixteman/editor_stamp_integer_dims
[Editor] Avoid to have slightly truncated images because of non-integer canvas dimensions
2023-08-10 14:16:46 +02:00
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