Commit Graph

224 Commits

Author SHA1 Message Date
Calixte Denizet
65d618635c When zooming the scrollbar can disappear and then no scrollend is triggered 2024-03-15 15:37:06 +01:00
Calixte Denizet
b4267cd294 [Editor] Add a floating button close to the selected text to highlight it (bug 1867742)
For now keep this feature behind a pref in order to make some experiments before
deciding to enable it.
2024-03-12 15:06:46 +01:00
calixteman
fb9e438442
Merge pull request #17781 from calixteman/stamp_altext_button_cp
[Editor] Make sure the alt-text button is there when pasting an image from an other tab
2024-03-07 21:44:53 +01:00
Calixte Denizet
0f8dda1af0 [Editor] Make sure the alt-text button is there when pasting an image from an other tab 2024-03-07 18:24:34 +01:00
Calixte Denizet
39aeea3e94 [Editor] Add a toggle button to show/hide all the highlights (bug 1867740) 2024-03-07 13:16:59 +01:00
calixteman
9ee4c6528d
Merge pull request #17776 from calixteman/bug1883609
[Annotations] Widget annotations must be in front of the other ones (bug 1883609)
2024-03-06 10:53:11 +01:00
Calixte Denizet
4e1b96c781 [Annotations] Widget annotations must be in front of the other ones (bug 1883609) 2024-03-05 19:04:58 +01:00
Calixte Denizet
bd5875d066 [Editor] Let a free highlight be clipped when its bounding box exceeds the page limits (bug 1883632) 2024-03-05 16:47:07 +01:00
Calixte Denizet
1859412507 [Editor] Unselect highlight editor when pressing Escape when the focus is on the color picker without a dropdown menu 2024-03-04 16:32:09 +01:00
Calixte Denizet
30101cbb31 [Editor] Fix the quadpoints value when serializing an highlight annotation
The coordinates of each point in a box are in the page coordinates system.
2024-03-01 11:36:16 +01:00
Calixte Denizet
7af90bb8bc [Editor] Enable the thickness input when no editors are selected (bug 1881219) 2024-02-29 23:05:33 +01:00
Calixte Denizet
f52bf2836f [Editor] Make the delete button clickable with the space key (bug 1882248) 2024-02-29 19:05:38 +01:00
Calixte Denizet
a9f47e87d5 [Editor] Add the possibility to move the caret with the keyboard once an highlight has been made (bug 1881684) 2024-02-29 18:18:13 +01:00
Calixte Denizet
0520f2f0cb [Editor] In caret browsing mode, allow to select in pressing shift and arrow down (bug 1881802)
In implementing caret browsing mode in pdf.js, I didn't notice that selectstart isn't always triggered.
So this patch removes the use of selectstart and rely only on selectionchange.
In order to simplify the selection management, the selection code is moved in the AnnotationUIManager:
 - it simplifies the code;
 - it allows to have only one listener for selectionchange instead of having one by visible page
   for selectstart.
I had to add a delay in the integration tests for highlighting (there's a comment with an explanation),
it isn't really nice, but it's the only way I found and in real life there always is a delay between
press and release.
2024-02-25 15:35:30 +01:00
Calixte Denizet
bb19cf9b64 [Editor] In caret browsing mode, get the caret position in the text layer (bug 1881692)
The function caretPositionFromPoint return the position within the last visible element
and sometimes there are some elements on top of the ones in the text layer.
So the idea is to hide the visible elements which aren't in the text layer in order
to get the right caret position.
2024-02-23 16:50:19 +01:00
Calixte Denizet
e1f6f5179f [Editor] Add the possibility to create an highlight from the context menu when some text is selected (bug 1867739) 2024-02-23 16:18:03 +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
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
Tim van der Meij
4b7382edcb
Merge pull request #17657 from Snuffleupagus/eslint-jasmine-no-dupes
Prevent duplicate names in unit/integration tests
2024-02-11 12:18:31 +01:00
Jonas Jenwald
5732faee1e Prevent duplicate names in unit/integration tests
Having identical names for different test-cases may result in less helpful output, which we can avoid with the use of the ESLint Jasmine plugin.
This patch enables the rules at the `branch` level, to limit the amount/scope of the changes slightly. (We could thus make this rule more strict in the future, if that's deemed useful.)

Please refer to:
 - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-spec-dupes.md
 - https://github.com/tlvince/eslint-plugin-jasmine/blob/master/docs/rules/no-suite-dupes.md
2024-02-11 11:45:09 +01:00
Tim van der Meij
28418598e5
Update puppeteer to version 22.0.0
This is a major version bump that requires two changes on our side:

- The new headless mode is now the default, so we can remove our
  transformation code (see https://github.com/puppeteer/puppeteer/pull/11815).
- The `page.waitForTimeout` API is removed. Sadly we still used it in
  the integration tests (but fortunately much less than before we worked
  on fixing intermittent failures), so until we remove the final
  occurrences we provide an implementation ourselves (see
  https://github.com/puppeteer/puppeteer/pull/11780).

The full changelog can be found here:
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v22.0.0
2024-02-10 19:05:36 +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
81466ee039 Implement caret browsing mode (bug 807730)
The users will be able to navigate within the pdf in using the arrows
and they'll be able to select some text, for example in order to
highlight it.
2024-02-07 09:35:22 +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
calixteman
f24246150e
Merge pull request #17541 from calixteman/issue17540
Use the original value of a field when propagating event (fixes #17540)
2024-01-20 21:51:37 +01:00
Calixte Denizet
5732c0c54a Use the original value of a field when propagating event (fixes #17540)
And avoid to not format a field when the value is 0.
2024-01-19 22:13:51 +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
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
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
Calixte Denizet
9765d57a26 [Editor] Extract all the lines when adding a FreeText annotation
Fixes #17079.
2024-01-14 21:11:51 +01:00
Calixte Denizet
fc7c320bd8 [Editor] Correctly serialize highlight data (regression from #17499) 2024-01-12 15:37:01 +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
Calixte Denizet
0392feaee4 Remove terminal white spaces when extracting text from annotation appearances 2024-01-09 10:42:53 +01:00
Calixte Denizet
17e1519410 [Editor] Init the default highlight color before creating the first editor instance
We want to be able to draw an highlight with the default color but without having an
instance of the HighlightEditor.
2024-01-05 17:52:54 +01:00
Calixte Denizet
7839e7b495 Preserve the whitespaces when getting text from FreeText annotations (bug 1871353)
When the text of an annotation is extracted in using getTextContent, consecutive white spaces
are just replaced by one space and. So this patch add an option to make sure that white
spaces are preserved when appearance is parsed.
For the case where there's no appearance, we can have a fast path to get the correct string
from the Content entry.
When an existing FreeText is edited, space (0x20) are replaced by non-breakable (0xa0) ones
to make to see all of them on screen.
2024-01-05 10:20:32 +01:00
Tim van der Meij
39a1fc6992
Merge pull request #17400 from calixteman/autoprint_test
Set a print listener as soon as possible in the autoprint integration test
2023-12-09 20:12:45 +01:00
Calixte Denizet
82be74d036 Set a print listener as soon as possible in the autoprint integration test
This test intermittently fails, likely because the auto-print is triggered fast enough
that we don't manage to get it.
So this patch aims to try to set a listener very early in order to be sure that
we'll be aware that a print has been triggered.
2023-12-09 16:59:43 +01:00
Calixte Denizet
e25cf1ba6f Don't run beforeunload callback when closing page in integration tests
For now, running such callbacks is disabled in Firefox but there are some
plan to reenable them: https://bugzilla.mozilla.org/show_bug.cgi?id=1824220
Having them blocks us to switch to bidi with Chrome.
2023-12-09 14:15:18 +01:00
Calixte Denizet
c63af10191 Use page.evaluateHandle when we want to await on document promises in integration tests
For reference: https://github.com/mozilla/pdf.js/pull/17378#issuecomment-1842864939
2023-12-07 17:00:12 +01:00
Calixte Denizet
621b7af60d [Editor] Highlight must keep selected after the document has been scrolled 2023-12-05 23:22:35 +01:00
Calixte Denizet
f7fec8c6d7 [Editor] Don't remove elements from the draw layer after it has been destroyed
Fixes issue #17379.
2023-12-05 22:41:20 +01:00
Calixte Denizet
11610a9e66 [Editor] Always give the focus to the ink editor when starting drawing (bug 1867588)
This way, when the editor is blurred, it can be committed and everything works fine.
It fixes issue #17373.
2023-12-05 10:26:59 +01:00
Calixte Denizet
43eea0b38e [Editor] Make sure that all layers are disabled when an editing session is done
Fixes issue #17368.
2023-12-04 13:27:39 +01:00
Henrik Skupin
9052327e07
Use "count" and not "clickCount" when calling page.mouse.click() 2023-11-30 09:40:57 +01:00