Jonas Jenwald
eded037d06
[api-minor] Use the Fetch API, when supported, to load PDF documents in Node.js environments
...
Given that modern Node.js versions now implement support for a fair number of "browser" APIs, we can utilize the standard Fetch API to load PDF documents that are specified via http/https URLs.
Please find compatibility information at:
- https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility
- https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch
- https://developer.mozilla.org/en-US/docs/Web/API/Response#browser_compatibility
- https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#response
2024-02-21 22:38:42 +01:00
calixteman
72b8b29147
Merge pull request #17701 from calixteman/alt_text_ai
...
[Editor] Add the possibility to query some ML stuff to guess an alt text for an image
2024-02-21 10:14:40 +01:00
Calixte Denizet
46416bb131
[Editor] Add the possibility to query some ML stuff to guess an alt text for an image
...
It's only for an experimental purpose.
2024-02-20 21:29:33 +01:00
Calixte Denizet
95f9bedc7c
[Editor] Disable annotation layer when highlighting (bug 1868759)
...
When highlighting, the annotation editor layer is disabled to get pointer events
from the text layer, but the annotation layer must be then disabled either in
order to avoid bad interactions.
2024-02-20 21:17:05 +01:00
Calixte Denizet
c2fcc66302
[Editor] Avoid to scroll when an editor is unselected
2024-02-18 19:21:45 +01:00
Jonas Jenwald
a7bcc81eb1
Add a dummy beginMarkedContentProps operator when optional content parsing fails (issue 17679)
2024-02-17 13:45:16 +01:00
Jonas Jenwald
e60329cea1
Merge pull request #17666 from Snuffleupagus/issue-17665
...
Skip any whitespace after the first object in linearized PDFs (issue 17665)
2024-02-13 12:39:36 +01:00
Jonas Jenwald
37e98e39f6
Skip any whitespace after the first object in linearized PDFs (issue 17665)
...
This way the code is now consistent with the non-linearized branch in the `PDFDocument.startXRef` getter.
2024-02-12 22:05:36 +01:00
calixteman
05b035602e
Merge pull request #17664 from calixteman/bug1879281
...
[Editor] Ends a free highlight where the mouse pointer is (bug 1879281)
2024-02-12 18:39:18 +01:00
Calixte Denizet
750b8e328a
[Editor] Ends a free highlight where the mouse pointer is (bug 1879281)
2024-02-12 17:26:33 +01:00
Calixte Denizet
de1985abbb
[Editor] Set rotated free highlight at the right position after having changed its thickness (bug 1879108)
2024-02-11 21:06:56 +01:00
calixteman
f15b4b34fd
Merge pull request #17650 from calixteman/editor_highlight_keyboard
...
[Editor] Add a way to highlight text in using the keyboard (bug 1877426)
2024-02-11 18:52:37 +01:00
Calixte Denizet
b5e446213e
[Editor] Disable the thickness slider for non-free highlight
2024-02-09 22:54:53 +01:00
Calixte Denizet
8fc6c5c8a6
[Editor] Add a way to highlight text in using the keyboard (bug 1877426)
2024-02-09 22:52:24 +01:00
Calixte Denizet
8d61fc1fde
[Editor] Compute the position of the last point before applying rotation (bug 1879113)
2024-02-08 21:08:24 +01:00
Calixte Denizet
c4ac7eef95
[Editor] Correctly rotate the mask when rotation a free highlight (bug 1879102)
2024-02-08 15:29:29 +01:00
Jonas Jenwald
06cd278808
Simplify the signature of the PDFDataTransportStream constructor
...
Given that we need to pass in a `PDFDataRangeTransport`-instance a number of the needed parameters can be obtained from it, rather than having to specify them manually.
2024-02-03 13:10:42 +01:00
Wojciech Maj
f80ba44fb0
Make downloadManager optional in AnnotationLayerParameters
...
Continuation of fix started in #17038
2024-02-01 11:08:12 +01:00
calixteman
833d7ac830
Merge pull request #17602 from calixteman/editor_free_highlight_lastpoint
...
[Editor] Fix the position of the free highlight toolbar
2024-01-30 20:34:47 +01:00
calixteman
245fd02141
Merge pull request #17586 from calixteman/editor_freehighlight_outline_inside
...
[Editor] Remove the outline which is inside the free highlight shape
2024-01-30 17:56:52 +01:00
Calixte Denizet
7529c1e3dc
[Editor] Fix the position of the free highlight toolbar
2024-01-30 15:40:33 +01:00
Calixte Denizet
b88c6f9c39
[Editor] Remove the outline which is inside the free highlight shape
...
When an highlight is self-intersecting, the outline was drawn inside.
In order to remove it, we use a svg mask to exclude the shape inside
when drawing the outlines.
That leads to change the outline 1px,white-2px,blue-1px,white to a
2px,white-2px,blue: the part of the stroke which is inside the shape
is removed because of the mask.
2024-01-30 14:40:56 +01:00
Calixte Denizet
f3bdbedf9b
[Editor] Change the cursors for highlighting (bug 1876588)
2024-01-26 18:17:05 +01:00
Calixte Denizet
7f2428a77e
Reduce memory use and improve perfs when computing the bounding box of a bezier curve (bug 1875547)
...
It isn't really a fix for the mentioned bug but it slightly improve things.
In reducing the memory use, the time spent in the GC is reduced either.
The algorithm to compute the bounding box is the same as before but it has just
been rewritten to be more efficient.
2024-01-24 23:41:14 +01:00
Calixte Denizet
2b8ecf5688
[Editor] Add the possibility to change the thickness of a free highlight (bug 1876096)
2024-01-24 22:04:39 +01:00
Calixte Denizet
d713df28c3
[Editor] Update the parameters in the UI of the last selected editor when undoing/redoing
2024-01-24 18:16:51 +01:00
Jonas Jenwald
f9a384d711
Enable the arrow-body-style ESLint rule
...
This manually ignores some cases where the resulting auto-formatting would not, as far as I'm concerned, constitute a readability improvement or where we'd just end up with more overall indentation.
Please see https://eslint.org/docs/latest/rules/arrow-body-style
2024-01-21 16:20:55 +01:00
Jonas Jenwald
9dfe9c552c
Use shorter arrow functions where possible
...
For arrow functions that are both simple and short, we can avoid using explicit `return` to shorten them even further without hurting readability.
For the `gulp mozcentral` build-target this reduces the overall size of the output by just under 1 kilo-byte (which isn't a lot but still can't hurt).
2024-01-21 10:13:12 +01:00
Calixte Denizet
0cca9a0240
[Editor] Don't add the keyboard listener on the color-picker each time the dropdown menu is shown
...
and display/hide the dropdown menu when pressing arrow keys.
2024-01-20 21:57:54 +01:00
Calixte Denizet
f3b76f5ae2
[Editor] Unselect highlights when the user click on the text layer (bug 1869767)
2024-01-19 20:16:55 +01:00
Jonas Jenwald
f8e3c79cb5
Merge pull request #17537 from Snuffleupagus/rm-isArrayBuffer
...
Remove the `isArrayBuffer` helper function
2024-01-19 15:37:02 +01:00
calixteman
f6c4b29aa2
Merge pull request #17531 from calixteman/editor_free_highlight_print_save
...
[Editor] Add support for printing/saving free highlight annotations
2024-01-19 15:23:29 +01:00
calixteman
5d2e7cf3fc
Merge pull request #17533 from calixteman/caret_mode
...
Make the caret visible in the text layer in caret browsing mode
2024-01-19 15:22:08 +01:00
Jonas Jenwald
b37536c38c
Remove the isArrayBuffer helper function
...
This old helper function can now be replaced with `ArrayBuffer.isView()` and/or `instanceof ArrayBuffer` checks, as needed depending on the situation.
2024-01-19 14:10:52 +01:00
Calixte Denizet
a1bf12537c
[Editor] Change the arrow direction when the dropdown is visible in the color picker (bug 1875357)
...
and hide the dropdown when the user click outside of the color picker.
2024-01-19 13:02:11 +01:00
Calixte Denizet
d64f334f98
[Editor] Add support for printing/saving free highlight annotations
2024-01-19 12:58:46 +01:00
Calixte Denizet
83c78dbfa8
Make the caret visible in the text layer in caret browsing mode
...
In order to do that we must change the text layer opacity to 1 but
it has several implications:
- the selection color must have an alpha component,
- the background color of the span used for highlighted words
must have an alpha component either, but now the opacity is 1
we can use some backdrop-filters in HCM making the highlighted
words more visible.
- fix a regression caused by #17196 : the css variable --hcm-highlight-filter
has to live under the #viewer element because in HCM it's overwritten
by js at this level, hence links annotations for example didn't
have the right colors when hovered.
2024-01-18 19:44:21 +01:00
Calixte Denizet
8fbfef0c07
[Editor] Add the ability to make a free highlight (i.e. without having to select some text) (bug 1856218)
...
The free highlighting is enabled when the mouse pointer isn't on some text.
Then we draw a shape with smoothed borders corresponding to the movement of
the mouse.
Printing/saving and changing the thickness will come later.
2024-01-18 16:26:04 +01:00
Calixte Denizet
70a9d8f3bc
[Editor] Avoid to move a non-draggable editor with the keyboard
2024-01-16 21:41:52 +01:00
Calixte Denizet
a76cc40ab8
[Editor] Avoid an exception when pressing space key to change the color of an highlight
2024-01-16 20:00:23 +01:00
calixteman
51413be5b6
Merge pull request #17519 from calixteman/editor_movable_touchscreen
...
[Editor] Make editors draggable with touchscreens
2024-01-16 10:47:38 +01:00
Calixte Denizet
b8aab5d14e
[Editor] Make editors draggable with touchscreens
2024-01-15 23:20:55 +01:00
Calixte Denizet
ee72b32dc2
[Editor] Slightly simplify the serialization of an highlight annotation
...
We were computing width and height of the annotation before serializing
which is useless because the rect already contains this information.
2024-01-15 18:22:01 +01:00
Calixte Denizet
e9946fa22a
[Editor] Draw a line instead of a Bezier curve when an Ink has only one point
...
Fixes #17418 .
2024-01-15 13:32:36 +01:00
calixteman
e98a813e09
Merge pull request #17511 from calixteman/issue17079
...
[Editor] Extract all the lines when adding a FreeText annotation
2024-01-15 10:40:49 +01:00
Calixte Denizet
9765d57a26
[Editor] Extract all the lines when adding a FreeText annotation
...
Fixes #17079 .
2024-01-14 21:11:51 +01:00
Jonas Jenwald
f0af52032b
[api-minor] Validate the workerPort/workerSrc options
...
Ensure that users cannot provide incorrect values when trying to set the global worker-options.
This patch was prompted by occasionally seeing users manually loading the `pdf.worker.mjs`-file and then assigning it to the `workerSrc`-option, something that obviously doesn't make sense and will cause fake-workers to be used (with poor performance as a result).
2024-01-12 17:13:32 +01:00
Calixte Denizet
fc7c320bd8
[Editor] Correctly serialize highlight data (regression from #17499 )
2024-01-12 15:37:01 +01:00
Calixte Denizet
94ad3afab6
[Editor] Move the code to generate the SVG path from draw_layer.js to outliner.js
...
It'll be useful to avoid too much duplicated code when adding the free highlighting tool.
2024-01-11 19:10:33 +01:00
Calixte Denizet
b4a7007397
[Editor] Don't throw when changing the color of an invisible highlight
2024-01-11 17:48:06 +01:00