Commit Graph

3970 Commits

Author SHA1 Message Date
ayush
87a1baf29f docs: Make downloadManager optional in JSDoc 2023-09-27 12:47:50 +05:30
Calixte Denizet
71376f089c [Editor] Remove the class fooEditing from the layer when destroying it
and simplify the way to handle the different types of editors.
2023-09-25 18:56:11 +02:00
Jonas Jenwald
fc898e1b38 [Editor] Add padding to the altText-button to account for different locales
*For many non-English locales the translated strings will be longer, which is easy to forget about during development/review.*

Note how for some locales (e.g. Swedish) the altText-button end up looking horizontally "cramped", hence it seems reasonable to add a bit of inline padding to improve this.
2023-09-24 16:13:16 +02:00
Calixte Denizet
57caa4601c [Editor] The ::before containter containing the border of a selected editor mustn't catch mouse events (bug 1854818) 2023-09-23 23:53:19 +02:00
Jonas Jenwald
1df31c0284 Use one noContextMenu function in both the src/- and web/-folders
Currently we duplicate this event handler function in multiple places, which seems unnecessary.
2023-09-23 15:37:13 +02:00
Calixte Denizet
88f3ed7745 [Editor] Disable context menu on alt-text button and in the associated dialog
but keep it for the text area.
Disable pointerdown on the alt-text button to disable dragging the editor
when the button is clicked (especially when slightly moving the mouse
between the down and the up).
2023-09-22 23:27:55 +02:00
Jonas Jenwald
9e0e67918f [Editor] Report telemetry when closing the altText dialog with Esc (PR 16987 follow-up)
The dialog element handles closing with <kbd>Esc</kbd> automatically, however we're not reporting telemetry in that case.
In order to fix that the easiest solution, as far as I'm concerned, seem to be moving the telemetry reporting into the dialog-close handler since it's always invoked.
2023-09-22 22:20:49 +02:00
Jonas Jenwald
8c5da23f67 Don't reset this.#currentEditor when destroying the dialog
This patch addresses an edge-case that'll probably never happen, but it nonetheless seems like something that we want to fix.

Note how we're using the `#currentEditor`-field to prevent opening the dialog when it's already active, and it being reset once the dialog has been closed.
By also resetting the `#currentEditor`-field during destruction, instead of waiting until the dialog has actually closed (assuming it's currently open), there's a *tiny* window of time[1] during which we could theoretically allow to (incorrectly) re-open the dialog and thus getting out-of-sync state in the viewer-component.

---
[1] Since the "close" event, on a dialog-element, is dispatched asynchronously by the browser.
2023-09-22 21:53:26 +02:00
Calixte Denizet
d5936d9a15 [Editor] Let the Save button always enabled in the alt-text dialog 2023-09-22 20:46:29 +02:00
calixteman
f66613c8e4
Merge pull request #17005 from calixteman/alt_text_tweak_save_flow
[Editor] Tweak the save flow in the alt-text dialog
2023-09-22 17:45:49 +02:00
Jonas Jenwald
43c7e88fa9 Don't bother trying to unregister the "reporttelemetry" event listener
Note that both event-unbind methods are unused in MOZCENTRAL builds; see https://searchfox.org/mozilla-central/rev/48b6992e03fa66f77ac9688ba61c95d31a451bc1/toolkit/components/pdfjs/content/web/viewer.js#1864-1869
2023-09-22 17:24:32 +02:00
Calixte Denizet
050093c9f5 [Editor] Tweak the save flow in the alt-text dialog
When the user edit an existing alt-text and remove it, we want to be able
to save this state and consequently remove the done state from the
alt-text button.
Remove the button from its parent when the editor is removed: it should
help to save few Kb of memory.
2023-09-22 17:10:20 +02:00
calixteman
3f859f76e6
Merge pull request #17010 from calixteman/alt_text_mask_1
[Editor] Darken the toolbar when the alt-text dialog is opened
2023-09-22 13:34:57 +02:00
Calixte Denizet
0237e2eb2b [Editor] Darken the toolbar when the alt-text dialog is opened
It aims to fix the issue spotted in:
https://github.com/mozilla/pdf.js/pull/17002#issuecomment-1730962273
2023-09-22 13:11:37 +02:00
Jonas Jenwald
ee5b8bcf9e [Editor] Make the altText dialog labels part of telemetry (PR 16987 follow-up)
Radio-buttons can also be toggled by clicking on their associated `label`-elements, and not only the `input`-elements itself, however it seems that "pointerdown" event listeners don't cover that case.
Hence it's possible that telemetry could miss certain cases of a mouse being used, and the easiest solution seem to be to instead use "click" event listeners and just ignore keyboard-based events.
2023-09-22 12:26:03 +02:00
calixteman
2fc8ab3477
Merge pull request #17002 from calixteman/alt_text_mask
[Editor] Avoid to darken the current editor when opening the alt-text dialog
2023-09-22 12:17:21 +02:00
Calixte Denizet
6545551e76 [Editor] Avoid to darken the current editor when opening the alt-text dialog 2023-09-21 20:44:53 +02:00
Jonas Jenwald
9b21f17b03 Prevent wheel/touch zooming in the viewer when a dialog is open 2023-09-21 20:08:08 +02:00
Jonas Jenwald
5711d0f95d [GeckoView] Exclude annotation_editor_layer_builder.css in the build (issue 16994)
Given the limitations of the old pre-processor that's used for CSS/HTML files, this unfortunately isn't as "easy" to implement as it is for JavaScript code.
Since this is the first case where we've wanted to do conditional CSS imports, rather than trying to completely re-write the pre-processor, this patch settles for handling it explicitly in the `expandCssImports` function.
2023-09-21 15:51:33 +02:00
calixteman
a7894a4d7b
Merge pull request #16993 from Snuffleupagus/gv-no-AltTextManager
[GeckoView] Avoid bundling the `AltTextManager` class, since it's unused
2023-09-21 14:19:51 +02:00
Calixte Denizet
61c77c7d8b Make one of the m-c linters happy 2023-09-21 14:09:48 +02:00
Jonas Jenwald
80e691d2ad Enable the Stylelint declaration-block-no-duplicate-properties rule (issue 16995)
Please refer to https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties
2023-09-21 13:42:05 +02:00
Jonas Jenwald
e2b7896826 [GeckoView] Avoid bundling the AltTextManager class, since it's unused 2023-09-21 12:51:34 +02:00
calixteman
561aea530b
Merge pull request #16991 from Snuffleupagus/alt_text_edit-boolean
Ensure that all "alt_text_*" save-telemetry values are boolean (PR 16987 follow-up)
2023-09-21 11:04:06 +02:00
calixteman
237b8ce4a8
Merge pull request #16988 from calixteman/alt_text_dialog_others
[Editor] Tweak few values after review from UX
2023-09-21 11:03:19 +02:00
calixteman
67ddabcbc2
Merge pull request #16990 from calixteman/alt_text_aria_label
[Editor] Add an aria-label to the alt-text button depending on its state
2023-09-21 10:56:25 +02:00
Calixte Denizet
b5d18006a7 [Editor] Tweak few values after review from UX 2023-09-21 10:52:58 +02:00
Jonas Jenwald
5660cdfe68 Ensure that all "alt_text_*" save-telemetry values are boolean (PR 16987 follow-up)
Looking at the save-telemetry values they're all boolean *except* for "alt_text_edit" in one instance, since `this.#previousAltText` may be an empty string (looking at the `editAltText` method) and this value may thus become an empty string as well.
2023-09-21 08:36:41 +02:00
Calixte Denizet
c90ea2314e [Editor] Add an aria-label to the alt-text button depending on its state 2023-09-20 21:56:16 +02:00
Jonas Jenwald
fe60db27b1 Use the new "reporttelemetry" event in more viewer components
By utilizing the recently added "reporttelemetry" event, we can avoid having to manually pass in `externalServices` to a number of viewer components.
2023-09-20 20:18:10 +02:00
Calixte Denizet
7d0bf376d0 [Editor] Change the colors for the disabled Save button in alt text dialoag in HCM 2023-09-20 18:58:31 +02:00
calixteman
67646387c8
Merge pull request #16986 from calixteman/alt_text_contents
[Editor] Change some strings in the alt-text dialog
2023-09-20 18:52:37 +02:00
Calixte Denizet
9a677d0d4d [Editor] Change some strings in the alt-text dialog 2023-09-20 18:44:56 +02:00
Calixte Denizet
0a278ef0bc [Editor] Add more telemetry for the 'add image' feature (bug 1853960) 2023-09-20 17:23:23 +02:00
calixteman
b80e0d881d
Merge pull request #16984 from Snuffleupagus/altText-close
Don't try to close the `altText` dialog if it's not open (PR 16977 follow-up)
2023-09-20 11:14:28 +02:00
Calixte Denizet
7952a36384 [Editor] Add a tooltip showing the alt text when hovering the alt-text button (bug 1844952) 2023-09-20 10:50:28 +02:00
Jonas Jenwald
21c55b56bf Don't try to close the altText dialog if it's not open (PR 16977 follow-up)
When closing a document in the viewer, e.g. by running `PDFViewerApplication.close()` in the console, the `AltTextManager.#finish` method currently throws *unless* the `altText` dialog is actually open.
Similar to e.g. the PasswordPrompt, we should thus only attempt to close the `altText` dialog when it's open.
2023-09-20 07:59:46 +02:00
Calixte Denizet
c162b004ce [Editor] Remove copy/paste listener when alt text dialog is displayed 2023-09-19 22:41:47 +02:00
Calixte Denizet
c12049db07 [Editor] Allow the user to add and save an alt-text for images (bug 1844952) 2023-09-19 21:46:48 +02:00
calixteman
daae6589b6
Merge pull request #16979 from calixteman/alt_text_change_str1
[Editor] Update alt text dialog description
2023-09-19 10:36:50 +02:00
Calixte Denizet
f7870c04ae [Editor] Make the border of the resizers slightly rounded
It's a part of the UX specifications. There's a drawing issue in Firefox
(see bug https://bugzilla.mozilla.org/1853288) but setting the
background-clip property to content-box seems to be a good workaround.
2023-09-19 09:57:00 +02:00
Calixte Denizet
0df9d1d934 [Editor] Update alt text dialog description 2023-09-19 09:27:43 +02:00
Calixte Denizet
df0da86b64 [Editor] Add a dialog box in order to get alt-text data (bug 1844952)
Implement the specifications provided by UX for light, dark and HCM modes.
2023-09-18 21:42:52 +02:00
Calixte Denizet
60ccce5cb1 [Editor] Use the same height as in the svg for icons for the alt-text button 2023-09-18 19:07:36 +02:00
calixteman
c8727d9c70
Merge pull request #16974 from calixteman/fix_css_linter_issue
Fix a CSS linter issue in removing a useless comma
2023-09-18 19:01:33 +02:00
Calixte Denizet
9b6e37c2cd Fix a CSS linter issue in removing a useless comma 2023-09-18 18:45:14 +02:00
Calixte Denizet
9dbe95c63c [Editor] Avoid to have some transparency in the icon used in the 'Alt text' button 2023-09-18 18:25:03 +02:00
Calixte Denizet
a216836fd5 [Editor] Add a button to trigger a dialog for adding an alt text (bug 1844952) 2023-09-18 15:07:09 +02:00
Jonas Jenwald
2d79be941e Convert PDFBug, in web/debugger.js, to a class with static methods
This gets rid of one more closure from the code-base.
2023-09-17 08:06:43 +02:00
Jonas Jenwald
c9cd934f8a Stop hard-coding the panel width in web/debugger.js
Thanks to CSS variables we can avoid hard-coding the panel width in the JavaScript code.
2023-09-17 08:06:33 +02:00